diff --git a/README.md b/README.md index 77fe8a2..11a7ecc 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ - [Device Types](#device-type) - [UUID Update Notes](#uuid-update-notes) - [Air Purifier BLE open API](/devicetypes/airpurifier.md) +- [Art Frame 2 and E Ink Photo Magnet BLE open API](/devicetypes/artframe2.md) - [Blind Tilt BLE open API](/devicetypes/blindtilt.md) - [Bot BLE open API](/devicetypes/bot.md) - [Color Bulb BLE open API](/devicetypes/colorbulb.md) @@ -82,9 +83,11 @@ byte. Most products have a `0x00…` and a `0x01…` form. These are the Product | Device Type | Product ID | |----------------------------|------------| | Art Frame | 0x00113e10, 0x01113e10 | +| Art Frame 2 | 0x0011f1c0, 0x0111f1c0 | | Candle Warmer Lamp | 0x001122b8, 0x011122b8 | | Circulator Fan Pro | 0x0011b340, 0x0111b340 | | Climate Panel | 0x0010f3d8, 0x0110f3d8 | +| E Ink Photo Magnet | 0x001295d0, 0x011295d0 | | Floor Lamp | 0x0010d0b0, 0x0110d0b0 | | Hub3 | 0x0010b940, 0x0110b940 | | Hub4 | 0x00128248, 0x01128248 | diff --git a/devicetypes/artframe2.md b/devicetypes/artframe2.md new file mode 100644 index 0000000..78429d4 --- /dev/null +++ b/devicetypes/artframe2.md @@ -0,0 +1,88 @@ +# Art Frame 2 and E Ink Photo Magnet BLE open API + +Art Frame 2 (Product ID `0x0011f1c0` / `0x0111f1c0`) and E Ink Photo Magnet (Product ID +`0x001295d0` / `0x011295d0`) share one protocol. They have no single-byte Device Type; see +[Device Types](../README.md#device-types) for how Product IDs are read. This is what +[pySwitchbot](https://github.com/sblibs/pySwitchbot) implements (`switchbot/adv_parsers/image_frame.py`, +`switchbot/devices/art_frame2.py`). It does not cover the original Art Frame. + +## Broadcast Message + +### Manufacturer Data + +Byte offsets count from the start of the manufacturer data payload, after the 2-byte company ID +`0x0969`. + + + + + + + + + + + + +
ByteFieldValue
0~5MAC AddressDevice MAC address
6Sequence NumberIncreases when the broadcast data is updated
7Batterybit7: charging
bit6-0: battery 0~100%
8~9Image IDID of the image on screen, little-endian
10Displaybit7-4: display size
bit3: display mode
bit2: last network status
bit1: orientation
+ +## Commands + +Both products use an encrypted connection: commands are sent with the account's key ID and +encryption key, as implemented by `SwitchbotEncryptedDevice` in pySwitchbot. The commands below are +shown before encryption. A response status (Byte 0) of `0x01` means OK. + + + + + + + + + + + + +
CommandBytes
Get basic info0x5702
Next image0x570f7a0701
Previous image0x570f7a0700
Show image0x570f7a02 + image ID (2 bytes, little-endian)
Read image list0x570f7b07 + packet number (1 byte, from 0x00)
+ +### Basic info + + + + + + + + + + + + + + + +
ByteFieldValue
0Status0x01 OK
1Batterybit7: charging
bit6-0: battery 0~100%
2FirmwareFirmware version × 10
3HardwareHardware version
4Displaybit7-4: display size
bit3: display mode
bit2: last network status
5~6Current image IDLittle-endian
7~8Number of imagesLittle-endian
9OrientationOrientation
+ +### Image list + +The stored images are a bitmap sent over one or more packets. Read packet `0x00` first, then each +following packet until the total reported in Byte 1. Each response is: + + + + + + + + + + + +
ByteFieldValue
0Status0x01 OK
1Total packetsNumber of packets in the bitmap (at least 1)
2Packet numberSame as the requested packet number
3~BitmapNext bytes of the image bitmap
+ +Join the bitmap bytes of all packets in order. Bit `b` (bit0 first) of bitmap byte `i` set means +image ID `i × 8 + b + 1` is stored. pySwitchbot rejects a bitmap longer than 2560 bytes. The +image IDs in this list are the values the Show image command takes. + +### Back to [Home](https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/) +### Back to [Device Types](../README.md) diff --git a/devicetypes/lock.md b/devicetypes/lock.md index f34118a..7a33928 100644 --- a/devicetypes/lock.md +++ b/devicetypes/lock.md @@ -56,9 +56,9 @@ start of the manufacturer data payload, after the 2-byte company ID `0x0969`. Th 6Sequence NumberIncreases when the broadcast data is updated 7Lock Infobit7: calibrated (0 no, 1 yes)
bit6-3: lock status (see Lock status)
bit2-0: reserved 8Door Infobit7-6: update from secondary lock
bit5: door open, reported by the secondary lock
bit4: door open (0 closed, 1 open)
bit3: automatic locking paused
bit2-0: reserved - 9Batterybit7: reserved
bit6-0: battery 0~100% + 9Batterybit7: charging (Lock Pro only; reserved on the others)
bit6-0: battery 0~100% 10Double Lockbit7: double lock mode
bit6: this is the secondary lock
bit5: manual unlock linkage
bit4-0: reserved - 11Alarmsbit7: unclosed door alarm
bit6: unlocked alarm
Lock Pro / Lock Pro WiFi: bit5: low temperature alarm, bit2: left battery compartment alarm, bit1: right battery compartment alarm
Lock Ultra / Ultra Max / UWB Lock / Vision Pro: bit4: power alarm, bit2-0: battery status + 11Alarmsbit7: unclosed door alarm
bit6: unlocked alarm
Lock Pro: bit5: low temperature alarm, bit4: power alarm, bit3: door magnet alarm, bit2: left battery compartment alarm, bit1: right battery compartment alarm
Lock Pro WiFi: bit5: low temperature alarm, bit2: left battery compartment alarm, bit1: right battery compartment alarm
Lock Ultra / Ultra Max / UWB Lock / Vision Pro: bit4: power alarm, bit2-0: battery status @@ -128,6 +128,22 @@ The lock info and enable-notification commands end with a model byte: | Lock Vision, Lock Vision Pro | `0x570f4f8102` | `0x570e01001e00008102` | | Lock Pro WiFi | `0x570f4f810a` | `0x570e01001e0000810a` | +### Lock Pro battery bays + +The Lock Pro reads the level of each of its two battery bays with `0x570f4f0409` (pySwitchbot +implements it for the Lock Pro only). The response is: + + + + + + + + + + +
ByteFieldValue
0Status0x01 OK, 0x06 OK with a low battery
1Left baybit7: battery present (0 empty bay)
bit6-0: battery 0~100%
2Right baybit7: battery present (0 empty bay)
bit6-0: battery 0~100%
+ ### Lock info data The lock info response (after the status byte) and status notifications carry the same lock info diff --git a/devicetypes/meter.md b/devicetypes/meter.md index c5bf081..504153f 100644 --- a/devicetypes/meter.md +++ b/devicetypes/meter.md @@ -588,6 +588,174 @@ the Service Data. Byte offsets count from the start of the manufacturer data pay The battery is read from Service Data Byte 2 (bit6-0). +## Meter Pro and Meter Pro CO2 Settings + +Meter Pro (`4`) and Meter Pro CO2 (`5`) settings are read with `0x570f69…` commands and written +with `0x570f68…` commands, unencrypted. Byte 0 of every response is the status; `0x01` means OK. +This is what [pySwitchbot](https://github.com/sblibs/pySwitchbot) implements +(`switchbot/devices/meter_pro.py`). Multi-byte numbers are big-endian unless noted. + +Temperatures use the same encoding as [0x31](#0x31-read-the-display-mode-and-value-of-the-meter): +an integer byte with bit7 set for a positive value (bit6-0: integer part, °C) and a separate 0~9 +tenths value. + +### Weather + +The weather shown on the screen when a zone's source is Network. + +| Command | Bytes | +| ------- | ----- | +| Read weather | `0x570f6906` | +| Write weather | `0x570f680601` + icon + response Bytes 2~4 | + + + + + + + + + + + +
ByteFieldValue
1Icon0 none, 1 sunny, 2 cloudy, 3 overcast, 4 light rain, 5 heavy rain, 6 light snow, 7 heavy snow
2Temperature decimalbit3-0: tenths 0~9
3Temperaturebit7: sign (1 positive, 0 negative)
bit6-0: integer part, °C
4Humiditybit7: temperature shown in °F
bit6-0: humidity 1~99%, 0 when not set
+ +pySwitchbot reads the weather first and keeps the bits it does not change (Byte 2 bit7-4, Byte 4 +bit7) in the write. + +### Calibration + +| Command | Bytes | +| ------- | ----- | +| Read calibration | `0x570f6903` | +| Write calibration | `0x570f6803` + Bytes 1~3 below | + + + + + + + + + + +
ByteFieldValue
1Temperature correctionbit7: sign (1 positive, 0 negative)
bit6-0: integer part, °C
2Humidity correctionbit7: sign (1 positive, 0 negative)
bit6-0: 0~99 %RH
3Temperature correction decimalbit3-0: tenths 0~9
+ +A zero correction is read back with the sign bit cleared. + +### Display + +| Command | Bytes | +| ------- | ----- | +| Read display settings | `0x570f690701` | +| Set a zone | `0x570f680701` + zone (`0x01` middle, `0x02` bottom) + icon (`0xFF` keeps it) + source + source MAC (6 bytes) | +| Set zone icons | `0x570f68070103` + middle icon + bottom icon (`0x0F` keeps an icon) | +| Set data update interval | `0x570f68070105` + seconds (2 bytes); the app offers 300, 600 and 1800 | +| Set date format | `0x570f68070107` + `0x00` month/day or `0x01` day/month | +| Set battery icon | `0x570f68070108` + `0x00` only when low or `0x01` always | +| Set temperature unit | `0x570f68070109` + `0x00` °C or `0x01` °F | +| Read button functions | `0x570f690704` | +| Set button functions | `0x570f68070106` + unit switch + source switch (`0xFF` keeps a function) | + +Zone icon: `1` indoor, `2` outdoor. Zone source: `0` none, `1` Meter, `2` Meter Plus, `3` +Indoor/Outdoor Thermo-Hygrometer, `4` Hub 2 or Hub Mini Matter, `5` Meter Pro (this device when +the MAC is all zeros), `6` Network (the [weather](#weather) values), `8` Weather Station, `9` Hub 3. +The MAC is all zeros for none, Network and this device. The screen applies a new zone at the next +data update. + +Display settings response: + + + + + + + + + + + + + + + +
ByteFieldValue
1Zone iconsbit7-4: middle
bit3-0: bottom
2Zone sourcesbit7-4: middle
bit3-0: bottom
3~8Middle source MACAll zeros when none
9~14Bottom source MACAll zeros when none
15~16Data update intervalSeconds
17Date format0x00 month/day, 0x01 day/month
18Reserved
19Battery icon0x00 only when low, 0x01 always
+ +pySwitchbot treats Bytes 15~19 as optional (a shorter response leaves them unset). + +Button functions (read response Bytes 1~2, and the write): unit switch `0x00` allowed, `0x01` +not allowed; source switch `0x01` allowed, `0x00` not allowed. + +### Comfort level and temperature/humidity alarm + +| Command | Bytes | +| ------- | ----- | +| Read comfort level | `0x570f69020101` | +| Read temperature/humidity alarm | `0x570f69020100` | +| Write comfort level | `0x570f680201` + `0x88` (custom) or `0x80` (default) + limits | +| Write temperature/humidity alarm | `0x570f680201` + alarm conditions (bit7 clear) + limits | +| Read alarm mode and volume | `0x570f690204` | +| Write alarm mode and volume | `0x570f680204` + volume (`0xFF` keeps it) + mode | + +Both reads return Byte 1 (comfort: `0x00` default, `0x01` custom; alarm: conditions), the limits +in Bytes 2~6, and a status in Byte 7. The limits are: + + + + + + + + + + + + +
Limits byteFieldValue
0High temperaturebit7: sign (1 positive)
bit6-0: integer part, °C
1High humiditybit6-0: 0~99%
2Temperature decimalsbit7-4: high temperature tenths
bit3-0: low temperature tenths
3Low temperaturebit7: sign (1 positive)
bit6-0: integer part, °C
4Low humiditybit6-0: 0~99%
+ +Alarm conditions (bit flags): `0x01` temperature low, `0x02` temperature high, `0x04` temperature +in range, `0x10` humidity low, `0x20` humidity high, `0x40` humidity in range. + +Byte 7 of the comfort response, bit1-0: `0` comfortable, `1` dry, `2` wet, `3` unavailable. Byte 7 +of the alarm response: bit5-4 temperature alarm, bit1-0 humidity alarm, each `0` none, `1` low, +`2` high, `3` in range. + +Alarm mode and volume response: Byte 1 volume (`1` off, `2` low, `3` medium, `4` high), Byte 2 +mode (`0` disabled, `1` flash only, `2` sound and flash). + +### CO2 (Meter Pro CO2 only) + +| Command | Bytes | +| ------- | ----- | +| Take a CO2 sample now | `0x570f680b04` | +| Start CO2 calibration | `0x570f680b02` | +| Read USB power state | `0x570f690b02` (Byte 1: `0x01` USB-C power connected, `0x00` not) | +| Read USB-powered update interval | `0x570f690b03` (Bytes 1~2: seconds) | +| Write USB-powered update interval | `0x570f680b01` + seconds (2 bytes, 1~65535) | +| Read battery-powered update interval | `0x570f690b04` (Bytes 1~2: seconds) | +| Write battery-powered update interval | `0x570f680b06` + seconds (2 bytes, 1~65535) | +| Read CO2 alarm | `0x570f69020301` | +| Write CO2 alarm | `0x570f68020301` + Bytes 1~5 below | +| Read CO2 level thresholds | `0x570f69020302` (Bytes 1~2: green-to-yellow ppm, Bytes 3~4: yellow-to-red ppm) | +| Write CO2 level thresholds | `0x570f68020302` + green-to-yellow ppm (2 bytes) + yellow-to-red ppm (2 bytes), in 100 ppm steps | + +Before calibrating, place the meter outdoors in a well-ventilated area for one minute, and keep it +still during the five-minute calibration. + +CO2 alarm response: + + + + + + + + + + + +
ByteFieldValue
1ConditionsBit flags: 0x01 low, 0x02 high, 0x04 in range, 0x08 custom setting
2~3High limitppm
4~5Low limitppm
6Statusbit1-0: 0 none, 1 low, 2 high, 3 in range
+ ### Other This section is for devices that don't quite fit the general