2018-05-19 16:31:55 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
"""
|
2019-10-27 11:04:08 +00:00
|
|
|
decode-status.py - decode status for Tasmota
|
2018-05-19 16:31:55 +01:00
|
|
|
|
2021-01-01 12:57:04 +00:00
|
|
|
Copyright (C) 2021 Theo Arends
|
2018-05-19 16:31:55 +01:00
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
Requirements:
|
|
|
|
- Python
|
2020-07-04 16:39:56 +01:00
|
|
|
- pip json requests
|
2018-05-19 16:31:55 +01:00
|
|
|
|
|
|
|
Instructions:
|
|
|
|
Execute command with option -d to retrieve status report from device or
|
|
|
|
get a copy of the status message with http command http://sonoff/cm?cmnd=status%200
|
|
|
|
and store it in file status.json
|
|
|
|
|
|
|
|
Usage:
|
2018-09-14 15:39:06 +01:00
|
|
|
./decode-status.py -d <hostname or IP address> [-u username] [-p password]
|
2018-05-19 16:31:55 +01:00
|
|
|
or
|
|
|
|
./decode-status.py -f <JSON status information file>
|
|
|
|
|
|
|
|
Example:
|
|
|
|
./decode-status.py -d sonoff1
|
2018-09-14 15:39:06 +01:00
|
|
|
./decode-status.py -d sonoff1 -p 12345678
|
2018-05-19 16:31:55 +01:00
|
|
|
or
|
|
|
|
./decode-status.py -f status.json
|
|
|
|
"""
|
|
|
|
|
|
|
|
import io
|
|
|
|
import os.path
|
|
|
|
import json
|
2020-07-04 16:39:56 +01:00
|
|
|
import requests
|
|
|
|
import urllib
|
2018-05-19 16:31:55 +01:00
|
|
|
from sys import exit
|
|
|
|
from optparse import OptionParser
|
|
|
|
|
|
|
|
a_on_off = ["OFF","ON "]
|
|
|
|
|
2018-07-25 11:42:53 +01:00
|
|
|
a_setoption = [[
|
2020-11-29 14:59:40 +00:00
|
|
|
"(Settings) Save power state (1) and use after restart",
|
|
|
|
"(Button) Control button single press (1) or multipress (0)",
|
2021-09-01 08:42:10 +01:00
|
|
|
"(MQTT) Add global temperature/humidity/pressure info to JSON sensor message",
|
2020-11-29 14:59:40 +00:00
|
|
|
"(MQTT) Enable (1)",
|
|
|
|
"(MQTT) Switch between RESULT (0) or COMMAND (1)",
|
|
|
|
"(MQTT) Retain on Power",
|
|
|
|
"(MQTT) Retain on Button",
|
|
|
|
"(MQTT) Retain on Switch",
|
|
|
|
"(Temperature) Switch between Celsius (0) or Fahrenheit (1)",
|
|
|
|
"(MQTT) Retain on Sensor",
|
|
|
|
"(MQTT) Control LWT message format, Offline (1) or none (0)",
|
|
|
|
"(Button) Swap (1) button single and double press functionality",
|
|
|
|
"(Settings) Switch between dynamic (0) or fixed (1) slot flash save location",
|
|
|
|
"(Button) Support only single press (1) to speed up button press recognition",
|
|
|
|
"(Interlock) Power interlock mode",
|
2023-02-05 12:34:02 +00:00
|
|
|
"(Light) Switch between commands PWM (0) or COLOR/DIMMER/CT/CHANNEL (1)",
|
2020-11-29 14:59:40 +00:00
|
|
|
"(WS2812) Switch between clockwise (0) or counter-clockwise (1)",
|
|
|
|
"(Light) Switch between decimal (1) or hexadecimal (0) output",
|
|
|
|
"(Light) Pair light signal (1) with CO2 sensor",
|
|
|
|
"(HAss) Control automatic discovery (1) (See SetOption59)",
|
|
|
|
"(Light) Control power in relation to Dimmer/Color/Ct changes (1)",
|
|
|
|
"(Energy) Show voltage even if powered off (1)",
|
|
|
|
"(MQTT) Serial",
|
|
|
|
"(MQTT) Serial binary",
|
|
|
|
"(Pressure) switch between hPa (0)or mmHg (1) unit",
|
|
|
|
"(KNX) Enabled",
|
|
|
|
"(MQTT, HAss) Switch between POWER (0) or POWER1 (1)",
|
|
|
|
"(KNX) Enhancement",
|
|
|
|
"(RF) Receive data format hexadecimal (0) or decimal (1)",
|
|
|
|
"(IR) Receive data format hexadecimal (0) or decimal (1)",
|
|
|
|
"(HAss) enforce autodiscovery as light (1)",
|
|
|
|
"(Wifi, MQTT) Control link led blinking (1)"
|
2018-07-25 11:42:53 +01:00
|
|
|
],[
|
2022-07-25 09:00:12 +01:00
|
|
|
"(Button/Switch) Key hold time detection in decaseconds (default 40)",
|
|
|
|
"(Energy) Maximum number of retries before deciding power limit overflow (default 5)",
|
|
|
|
"(Backlog) Minimal delay in milliseconds between executing backlog commands (default 200)",
|
2019-02-04 10:41:51 +00:00
|
|
|
"(not used) mDNS delayed start (Sec)",
|
2022-07-25 09:00:12 +01:00
|
|
|
"(Restart) Number of restarts to start detecting boot loop (default 1)",
|
|
|
|
"(Light) RGB and White channel separation (default 0)",
|
|
|
|
"(IR) Set the smallest sized UNKNOWN message packets we actually care about (default 6, max 255)",
|
2023-10-26 17:04:34 +01:00
|
|
|
"(CSE7766) Number of invalid power measurements before declaring it invalid allowing low load measurements (default 128)",
|
2022-07-25 09:00:12 +01:00
|
|
|
"(Button/Shutter) Ignore button change in seconds (default 0)",
|
|
|
|
"(Wifi) Interval in seconds between gratuitous ARP requests (default 60)",
|
|
|
|
"(Energy) Turn all power off at or above this temperature (default 90C)",
|
|
|
|
"(Rotary) Rotary step boundary (default 10)",
|
|
|
|
"(IR) Base tolerance percentage for matching incoming IR messages (default 25, max 100)",
|
|
|
|
"(Bistable) Pulse time in milliseconds for two coil bistable latching relays (default 40)",
|
2022-11-07 10:06:17 +00:00
|
|
|
"(PowerOn) Add delay of 10 x value milliseconds at power on",
|
|
|
|
"(PowerOn) Add delay of value seconds at power on before activating relays",
|
2023-07-01 13:25:05 +01:00
|
|
|
"(Energy) Support energy dummy relays",
|
2019-08-01 14:42:58 +01:00
|
|
|
"",
|
2019-02-04 00:04:42 +00:00
|
|
|
],[
|
2020-11-29 14:59:40 +00:00
|
|
|
"(Timers) Enabled",
|
|
|
|
"(GPIO) Enable ESP8285 user GPIO's (1)",
|
|
|
|
"(Time) Append timezone to JSON time (1)",
|
|
|
|
"(GUI) Show hostname and IP address in GUI main menu (1)",
|
|
|
|
"(Tuya) Apply SetOption20 settings to Tuya device (1)",
|
|
|
|
"(mDNS) Service on (1) or off (0)",
|
|
|
|
"(Wifi) Scan network at restart for configured AP's (1) or used stored AP (0)",
|
|
|
|
"(Wifi) Scan network every 44 minutes for configured AP's (1)",
|
|
|
|
"(IR) Add IR Raw data to JSON message (1)",
|
|
|
|
"(MQTT) Send tele/%topic%/STATE in addition to stat/%topic%/RESULT (1)",
|
|
|
|
"(Sleep) Enable normal sleep (1) instead of dynamic sleep (0)",
|
|
|
|
"(Button, Switch) Force local operation (1) when button/switch topic is set",
|
|
|
|
"(MQTT) Don't use retain flag on HOLD messages (1)",
|
|
|
|
"(Power) Don't scan relay power state at restart (1)",
|
|
|
|
"(JSON) Enable '_' (1) instead of '-' (0) as sensor index separator",
|
|
|
|
"(QPC) Disable (1) fast power cycle detection for device reset",
|
|
|
|
"(Tuya) Enable (1) TuyaMcuReceived messages over Mqtt",
|
|
|
|
"(Buzzer) Enable (1) buzzer when available",
|
|
|
|
"(Light) Enable multi-channels PWM (1) instead of Color PWM (0)",
|
2024-08-23 10:22:26 +01:00
|
|
|
"(Serial) Invert Serial receive on SerialBridge (1)",
|
2020-11-29 14:59:40 +00:00
|
|
|
"(Energy) Enable Weekend Energy Tariff",
|
|
|
|
"(DDS2382) Select different Modbus registers (1) for Active Energy (#6531)",
|
|
|
|
"(Energy) Enable (1) hardware energy total counter as reference (#6561)",
|
|
|
|
"(Button) Detach buttons from relays (1) and enable MQTT action state for multipress",
|
|
|
|
"(DS18x20) Enable internal pullup (1) for single DS18x20 sensor",
|
|
|
|
"(MQTT) GroupTopic replaces %topic% (0) or fixed topic cmnd/grouptopic (1)",
|
|
|
|
"(Deepsleep) Enable incrementing bootcount (1) when deepsleep is enabled",
|
|
|
|
"(Light) Do not power off (1) if slider moved to far left",
|
|
|
|
"(not used) Disable OTA compatibility check",
|
|
|
|
"(Counter) Enable resetting of counters (1) after telemetry was sent",
|
|
|
|
"(Shutter) Enable shutter support (1)",
|
|
|
|
"(PCF8574) Invert all ports on PCF8574 devices (1)"
|
2019-10-31 11:12:48 +00:00
|
|
|
],[
|
2020-11-29 14:59:40 +00:00
|
|
|
"(Alexa) Reduced CT range for Alexa (1)",
|
|
|
|
"(Zigbee) Use FriendlyNames (1) instead of ShortAddresses (0) when possible",
|
|
|
|
"(AWS IoT) publish MQTT state to a device shadow (1)",
|
|
|
|
"(DevGroups) Enable Device Groups (1)",
|
|
|
|
"(PWM Dimmer) Turn brightness LED's off (1) 5 seconds after last change",
|
|
|
|
"(PWM Dimmer) Turn red LED on (1) when powered off",
|
|
|
|
"(DevGroups) Enable relays in separate device groups/PWM Dimmer Buttons control remote devices (1)",
|
|
|
|
"(MQTT, Zigbee) Distinct MQTT topics per device for Zigbee (1) (#7835)",
|
|
|
|
"(MQTT) Disable non-json MQTT response (1)",
|
|
|
|
"(Light) Enable light fading at start/power on (1)",
|
|
|
|
"(Light) Set PWM Mode from regular PWM (0) to ColorTemp (1) control (Xiaomi Philips ...)",
|
|
|
|
"(Compress) Keep uncompressed rules in memory to avoid CPU load of uncompressing at each tick (1)",
|
|
|
|
"(MAXxxx) Implement simpler MAX6675 protocol (1) instead of MAX31855 (0)",
|
|
|
|
"(Wifi) Enable Wifi",
|
|
|
|
"(Eth) Enable Ethernet (ESP32)",
|
|
|
|
"(Tuya) Set Baud rate for TuyaMCU serial communication to 9600 (0) or 115200 (1)",
|
|
|
|
"(Rotary) Use rules (1) instead of light control (0)",
|
|
|
|
"(PWM Dimmer) Enable zerocross dimmer (1)",
|
|
|
|
"(Zigbee) Remove ZbReceived form JSON message (1)",
|
|
|
|
"(Zigbee) Add the source endpoint as suffix to attributes, ex `Power3` (1) instead of `Power` (0) if sent from endpoint 3",
|
|
|
|
"(Teleinfo) Set Baud rate for Teleinfo communication to 1200 (0) or 9600 (1)",
|
|
|
|
"(MQTT TLS) Enable TLS mode (1) (requires TLS version)",
|
|
|
|
"(MQTT) No Retain (1) - disable all MQTT retained messages, some brokers don't support it: AWS IoT, Losant",
|
|
|
|
"(Light) White Blend Mode (1) - used to be `RGBWWTable` last value `0`, now deprecated in favor of this option",
|
|
|
|
"(Light) Virtual CT (1) - Creates a virtual White ColorTemp for RGBW lights",
|
|
|
|
"(Light) Virtual CT Channel (1) - signals whether the hardware white is cold CW (true) or warm WW (false)",
|
|
|
|
"(Teleinfo) Enable Teleinfo + Tasmota Energy device (0) or Teleinfo raw data only (1)",
|
|
|
|
"(Alexa) Gen1 mode (1) - if you only have Echo Dot 2nd gen devices",
|
|
|
|
"(Zigbee) Disable auto-config (1) when pairing new devices",
|
|
|
|
"(Buzzer) Use frequency output (1) for buzzer pin instead of on/off signal (0)",
|
|
|
|
"(Zigbee) Use friendly name in zigbee topic (1) (use with SetOption89)",
|
|
|
|
"(Rotary) Set dimmer low on rotary dial after power off (1)"
|
2020-08-13 15:59:51 +01:00
|
|
|
],[
|
2020-11-29 14:59:40 +00:00
|
|
|
"(Switch) Detach Switches from relays and enable MQTT action state for all the SwitchModes (1)",
|
|
|
|
"(ESP32 BLE) Enable ESP32 MI32 BLE (1)",
|
|
|
|
"(Zigbee) Disable auto-query of zigbee lights and devices (1)",
|
2021-01-03 16:04:14 +00:00
|
|
|
"(Light) run fading at fixed duration instead of fixed slew rate",
|
|
|
|
"(Zigbee) Move ZbReceived from JSON message and into the subtopic replacing SENSOR default",
|
|
|
|
"(Zigbee) Remove the device addr from json payload, can be used with zb_topic_fname where the addr is already known from the topic",
|
2021-02-22 12:59:45 +00:00
|
|
|
"(Zigbee) Append endpoint number to topic if device dependent (use with SetOption89)",
|
|
|
|
"(MQTT) Retain on State",
|
|
|
|
"(MQTT) Retain on Info",
|
2021-03-23 11:57:56 +00:00
|
|
|
"(Wiegand) switch tag number output to hex format (1)",
|
|
|
|
"(Wiegand) send key pad stroke as single char (0) or one tag (ending char #) (1)",
|
|
|
|
"(Zigbee) Hide bridge topic from zigbee topic (use with SetOption89) (1)",
|
2021-04-02 10:43:31 +01:00
|
|
|
"(DS18x20) Enable arithmetic mean over teleperiod for JSON temperature (1)",
|
2021-07-05 13:50:33 +01:00
|
|
|
"(Wifi) Keep wifi in no-sleep mode, prevents some occasional unresponsiveness",
|
2021-10-08 12:59:11 +01:00
|
|
|
"(Web) Allow access without referer check",
|
|
|
|
"(Energy) Show phase information",
|
|
|
|
"(Debug) Show heap with logging timestamp",
|
2021-11-30 15:03:57 +00:00
|
|
|
"(Tuya) Allow save dimmer = 0 receved by MCU",
|
2021-12-05 13:49:49 +00:00
|
|
|
"(TLS) Use fingerprint validation instead of CA based",
|
|
|
|
"(Shift595) Invert outputs of 74x595 shift registers",
|
2022-03-25 15:27:57 +00:00
|
|
|
"(PWM) force PWM lights to start at same phase, default is to spread phases to minimze overlap (also needed for H-bridge)",
|
|
|
|
"(Display & LVGL) force disabling default splash screen",
|
|
|
|
"(TuyaSNS) When ON disable publish single SNS value on Tuya Receive (keep Teleperiod)",
|
2022-04-02 10:43:29 +01:00
|
|
|
"(Tuya) When Set, avoid the (mqtt-) publish of Tuya MCU Heartbeat response if SetOption66 is active",
|
2022-04-19 13:45:26 +01:00
|
|
|
"(GUI) Align (energy) table values left (0) or right (1)",
|
|
|
|
"(Pressure) Switch between mmHg (0) or inHg (1) when SO24 1",
|
2022-05-04 14:34:26 +01:00
|
|
|
"(MQTT) MQTT clean session (0 = default) or persistent session (1)",
|
2022-05-29 14:49:57 +01:00
|
|
|
"(GUI) Disable display of GUI module name (1)",
|
2022-06-10 13:49:35 +01:00
|
|
|
"(Wifi) Wait 1 second for wifi connection solving some FRITZ!Box modem issues (1)",
|
2022-08-05 14:52:53 +01:00
|
|
|
"(Zigbee) Disable Battery auto-probe and using auto-binding",
|
2022-08-11 13:47:31 +01:00
|
|
|
"(Zigbee) Include time in `ZbReceived` messages like other sensors",
|
2022-08-19 13:24:55 +01:00
|
|
|
"(MQTT) Retain on Status"
|
2022-05-29 14:49:57 +01:00
|
|
|
],[
|
2022-09-02 10:24:47 +01:00
|
|
|
"(ESP32) Show ESP32 internal temperature sensor",
|
2022-09-24 15:53:11 +01:00
|
|
|
"(MQTT) Disable publish SSerialReceived MQTT messages, you must use event trigger rules instead",
|
2023-01-01 13:29:41 +00:00
|
|
|
"(Light) start DMX ArtNet at boot, listen to UDP port as soon as network is up",
|
|
|
|
"(Wifi) prefer IPv6 DNS resolution to IPv4 address when available. Requires `#define USE_IPV6`",
|
2023-01-31 21:30:50 +00:00
|
|
|
"(Energy) Force no voltage/frequency common",
|
2023-02-05 13:29:42 +00:00
|
|
|
"(Matter) Enable Matter protocol over Wifi",
|
2023-04-18 16:16:29 +01:00
|
|
|
"(Power) Switch between two (0) or one (1) pin bistable relay control",
|
2023-05-25 16:13:31 +01:00
|
|
|
"(Berry) Disable autoexec.be on restart (1)",
|
2023-07-09 13:03:18 +01:00
|
|
|
"(Berry) Handle berry led using RMT0 as additional WS2812 scheme",
|
2023-07-08 16:37:12 +01:00
|
|
|
"(ZCDimmer) Enable rare falling Edge dimmer instead of leading edge",
|
2023-08-26 15:20:46 +01:00
|
|
|
"(Sen5x) Run in passive mode when there is another I2C master (e.g. Ikea Vindstyrka), i.e. do not set up Sen5x sensor, higher polling interval",
|
2023-11-09 13:25:24 +00:00
|
|
|
"(NeoPool) Output sensitive data (1)",
|
2024-02-14 10:22:41 +00:00
|
|
|
"(MQTT) Disable publish ModbusReceived MQTT messages (1), you must use event trigger rules instead",
|
|
|
|
"(Counter) Enable counting on both rising and falling edge (1)",
|
2024-10-25 16:27:39 +01:00
|
|
|
"(LD2410) Disable generate moving event by sensor report - use LD2410 out pin for events (1)",
|
|
|
|
"",
|
2022-05-29 14:49:57 +01:00
|
|
|
"","","","",
|
|
|
|
"","","","",
|
|
|
|
"","","","",
|
2020-08-13 15:59:51 +01:00
|
|
|
"","","",""
|
2018-07-25 11:42:53 +01:00
|
|
|
]]
|
2018-05-19 16:31:55 +01:00
|
|
|
|
|
|
|
a_features = [[
|
2019-08-01 14:42:58 +01:00
|
|
|
"USE_ENERGY_MARGIN_DETECTION","USE_LIGHT","USE_I2C","USE_SPI",
|
2018-05-19 16:31:55 +01:00
|
|
|
"USE_DISCOVERY","USE_ARDUINO_OTA","USE_MQTT_TLS","USE_WEBSERVER",
|
2019-05-20 14:09:42 +01:00
|
|
|
"WEBSERVER_ADVERTISE","USE_EMULATION_HUE","MQTT_PUBSUBCLIENT","MQTT_TASMOTAMQTT",
|
2022-07-20 09:41:02 +01:00
|
|
|
"USE_MODBUS_BRIDGE","MQTT_HOST_DISCOVERY","USE_ARILUX_RF","USE_WS2812",
|
2018-05-19 16:31:55 +01:00
|
|
|
"USE_WS2812_DMA","USE_IR_REMOTE","USE_IR_HVAC","USE_IR_RECEIVE",
|
|
|
|
"USE_DOMOTICZ","USE_DISPLAY","USE_HOME_ASSISTANT","USE_SERIAL_BRIDGE",
|
|
|
|
"USE_TIMERS","USE_SUNRISE","USE_TIMERS_WEB","USE_RULES",
|
2019-08-01 14:42:58 +01:00
|
|
|
"USE_KNX","USE_WPS","USE_SMARTCONFIG","USE_ENERGY_POWER_LIMIT"
|
2018-06-26 10:38:30 +01:00
|
|
|
],[
|
2019-02-08 13:55:45 +00:00
|
|
|
"USE_CONFIG_OVERRIDE","FIRMWARE_MINIMAL","FIRMWARE_SENSORS","FIRMWARE_CLASSIC",
|
|
|
|
"FIRMWARE_KNX_NO_EMULATION","USE_DISPLAY_MODES1TO5","USE_DISPLAY_GRAPH","USE_DISPLAY_LCD",
|
2022-01-13 20:38:56 +00:00
|
|
|
"USE_DISPLAY_SSD1306","USE_DISPLAY_MATRIX","USE_DISPLAY_ILI9341","USE_DISPLAY_EPAPER_29",
|
|
|
|
"USE_DISPLAY_SH1106","USE_MP3_PLAYER","USE_PCA9685","USE_TUYA_MCU",
|
2019-05-20 14:09:42 +01:00
|
|
|
"USE_RC_SWITCH","USE_ARMTRONIX_DIMMERS","USE_SM16716","USE_SCRIPT",
|
2019-08-10 16:52:26 +01:00
|
|
|
"USE_EMULATION_WEMO","USE_SONOFF_IFAN","USE_ZIGBEE","NO_EXTRA_4K_HEAP",
|
2018-09-09 13:31:40 +01:00
|
|
|
"VTABLES_IN_IRAM","VTABLES_IN_DRAM","VTABLES_IN_FLASH","PIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH",
|
2018-06-26 10:38:30 +01:00
|
|
|
"PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY","PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH","DEBUG_THEO","USE_DEBUG_DRIVER"
|
|
|
|
],[
|
2019-08-01 14:42:58 +01:00
|
|
|
"USE_COUNTER","USE_ADC_VCC","USE_ENERGY_SENSOR","USE_PZEM004T",
|
2018-05-19 16:31:55 +01:00
|
|
|
"USE_DS18B20","USE_DS18x20_LEGACY","USE_DS18x20","USE_DHT",
|
2022-01-19 16:05:39 +00:00
|
|
|
"USE_SHT","USE_HTU","USE_BMP","USE_BME68X",
|
2018-05-19 16:31:55 +01:00
|
|
|
"USE_BH1750","USE_VEML6070","USE_ADS1115_I2CDEV","USE_ADS1115",
|
|
|
|
"USE_INA219","USE_SHT3X","USE_MHZ19","USE_TSL2561",
|
|
|
|
"USE_SENSEAIR","USE_PMS5003","USE_MGS","USE_NOVA_SDS",
|
2022-08-26 15:07:57 +01:00
|
|
|
"USE_SGP30","USE_SR04","USE_SDM120","USE_SI1145",
|
2018-06-29 10:15:27 +01:00
|
|
|
"USE_SDM630","USE_LM75AD","USE_APDS9960","USE_TM1638"
|
2018-06-26 10:38:30 +01:00
|
|
|
],[
|
2018-07-31 10:49:23 +01:00
|
|
|
"USE_MCP230xx","USE_MPR121","USE_CCS811","USE_MPU6050",
|
2018-09-06 17:08:10 +01:00
|
|
|
"USE_MCP230xx_OUTPUT","USE_MCP230xx_DISPLAYOUTPUT","USE_HLW8012","USE_CSE7766",
|
2018-10-17 11:27:05 +01:00
|
|
|
"USE_MCP39F501","USE_PZEM_AC","USE_DS3231","USE_HX711",
|
2018-12-11 13:24:52 +00:00
|
|
|
"USE_PZEM_DC","USE_TX20_WIND_SENSOR","USE_MGC3130","USE_RF_SENSOR",
|
2019-01-01 12:45:44 +00:00
|
|
|
"USE_THEO_V2","USE_ALECTO_V2","USE_AZ7798","USE_MAX31855",
|
2022-01-13 20:38:56 +00:00
|
|
|
"USE_PN532_HSU","USE_MAX44009","USE_SCD30","USE_HRE",
|
2019-08-01 14:42:58 +01:00
|
|
|
"USE_ADE7953","USE_SPS30","USE_VL53L0X","USE_MLX90614",
|
2019-08-19 10:47:59 +01:00
|
|
|
"USE_MAX31865","USE_CHIRP","USE_SOLAX_X1","USE_PAJ7620"
|
2019-08-10 16:52:26 +01:00
|
|
|
],[
|
2019-09-08 10:26:54 +01:00
|
|
|
"USE_BUZZER","USE_RDM6300","USE_IBEACON","USE_SML_M",
|
2019-10-17 14:28:46 +01:00
|
|
|
"USE_INA226","USE_A4988_STEPPER","USE_DDS2382","USE_SM2135",
|
2019-10-14 16:01:24 +01:00
|
|
|
"USE_SHUTTER","USE_PCF8574","USE_DDSU666","USE_DEEPSLEEP",
|
2019-10-18 16:29:19 +01:00
|
|
|
"USE_SONOFF_SC","USE_SONOFF_RF","USE_SONOFF_L1","USE_EXS_DIMMER",
|
2022-01-13 20:38:56 +00:00
|
|
|
"USE_TASMOTA_CLIENT","USE_HIH6","USE_HPMA","USE_TSL2591",
|
2019-12-30 13:24:00 +00:00
|
|
|
"USE_DHT12","USE_DS1624","USE_GPS","USE_HOTPLUG",
|
2020-02-10 14:18:11 +00:00
|
|
|
"USE_NRF24","USE_MIBLE","USE_HM10","USE_LE01MR",
|
2020-02-27 14:10:42 +00:00
|
|
|
"USE_AHT1x","USE_WEMOS_MOTOR_V1","USE_DEVICE_GROUPS","USE_PWM_DIMMER"
|
2020-02-10 14:18:11 +00:00
|
|
|
],[
|
2020-03-14 11:43:02 +00:00
|
|
|
"USE_KEELOQ","USE_HRXL","USE_SONOFF_D1","USE_HDC1080",
|
2020-04-11 13:51:08 +01:00
|
|
|
"USE_IAQ","USE_DISPLAY_SEVENSEG","USE_AS3935","USE_PING",
|
2020-05-22 14:16:01 +01:00
|
|
|
"USE_WINDMETER","USE_OPENTHERM","USE_THERMOSTAT","USE_VEML6075",
|
2021-09-21 17:25:52 +01:00
|
|
|
"USE_VEML7700","USE_MCP9808","USE_BL09XX","USE_TELEGRAM",
|
2020-06-17 16:22:41 +01:00
|
|
|
"USE_HP303B","USE_TCP_BRIDGE","USE_TELEINFO","USE_LMT01",
|
2020-09-06 17:41:39 +01:00
|
|
|
"USE_PROMETHEUS","USE_IEM3000","USE_DYP","USE_I2S_AUDIO",
|
2020-10-02 15:37:43 +01:00
|
|
|
"USE_MLX90640","USE_VL53L1X","USE_MIEL_HVAC","USE_WE517",
|
2020-10-18 14:36:17 +01:00
|
|
|
"USE_EZOPH","USE_TTGO_WATCH","USE_ETHERNET","USE_WEBCAM"
|
2020-08-17 15:25:24 +01:00
|
|
|
],[
|
2020-10-24 11:41:08 +01:00
|
|
|
"USE_EZOORP","USE_EZORTD","USE_EZOHUM","USE_EZOEC",
|
2020-11-01 14:15:10 +00:00
|
|
|
"USE_EZOCO2","USE_EZOO2","USE_EZOPRS","USE_EZOFLO",
|
2020-11-10 14:04:45 +00:00
|
|
|
"USE_EZODO","USE_EZORGB","USE_EZOPMP","USE_AS608",
|
2021-01-01 14:05:58 +00:00
|
|
|
"USE_SHELLY_DIMMER","USE_RC522","USE_FTC532","USE_DISPLAY_EPAPER_42",
|
|
|
|
"USE_DISPLAY_ILI9488","USE_DISPLAY_SSD1351","USE_DISPLAY_RA8876","USE_DISPLAY_ST7789",
|
2021-01-07 14:12:07 +00:00
|
|
|
"USE_DISPLAY_SSD1331","USE_UFILESYS","USE_TIMEPROP","USE_PID",
|
2021-01-20 14:06:27 +00:00
|
|
|
"USE_BS814A2","USE_SEESAW_SOIL","USE_WIEGAND","USE_NEOPOOL",
|
2021-02-27 21:28:29 +00:00
|
|
|
"USE_TOF10120","USE_SDM72","USE_DISPLAY_TM1637","USE_PROJECTOR_CTRL"
|
2021-01-22 16:15:58 +00:00
|
|
|
],[
|
2021-06-27 12:53:19 +01:00
|
|
|
"USE_MPU_ACCEL","USE_TFMINIPLUS","USE_CSE7761","USE_BERRY",
|
2021-07-13 10:40:13 +01:00
|
|
|
"USE_BM8563","USE_ENERGY_DUMMY","USE_AM2320","USE_T67XX",
|
2021-08-12 21:43:53 +01:00
|
|
|
"USE_MCP2515","USE_TASMESH","USE_WIFI_RANGE_EXTENDER","USE_INFLUXDB",
|
2021-10-08 12:59:11 +01:00
|
|
|
"USE_HRG15","USE_VINDRIKTNING","USE_SCD40","USE_HM330X",
|
2021-12-05 13:49:49 +00:00
|
|
|
"USE_HDC2010","USE_LSC_MCSL","USE_SONOFF_SPM","USE_SHIFT595",
|
2022-03-11 15:54:57 +00:00
|
|
|
"USE_SDM230","USE_CM110x","USE_BL6523","USE_ADE7880",
|
2022-05-04 14:34:26 +01:00
|
|
|
"USE_PCF85363","USE_DS3502","USE_IMPROV","USE_FLOWRATEMETER",
|
2022-07-06 15:58:27 +01:00
|
|
|
"USE_BP5758D","USE_HYT","USE_SM2335","USE_DISPLAY_TM1621_SONOFF"
|
2022-05-29 14:49:57 +01:00
|
|
|
],[
|
2022-10-05 14:00:03 +01:00
|
|
|
"USE_SGP40","USE_LUXV30B","USE_CANSNIFFER","USE_QMC5883L",
|
2022-11-07 10:06:17 +00:00
|
|
|
"USE_MODBUS_ENERGY","USE_SHELLY_PRO","USE_DALI","USE_BP1658CJ",
|
2022-12-14 10:52:26 +00:00
|
|
|
"USE_DINGTIAN_RELAY","USE_HMC5883L","USE_LD2410","USE_ME007",
|
2023-01-29 07:06:25 +00:00
|
|
|
"USE_DISPLAY_TM1650","USE_PCA9632","USE_TUYAMCUBR","USE_SEN5X",
|
2023-04-06 08:52:15 +01:00
|
|
|
"USE_BIOPDU","USE_MCP23XXX_DRV","USE_PMSA003I","USE_LOX_O2",
|
2023-05-14 14:08:09 +01:00
|
|
|
"USE_GDK101","USE_GM861","USE_TC74","USE_PCA9557",
|
2023-09-24 17:30:15 +01:00
|
|
|
"USE_SGP4X","USE_MAX17043","USE_ENS16x","USE_ENS210",
|
2023-11-09 14:32:43 +00:00
|
|
|
"USE_HC8","USE_HDMI_CEC","USE_BLE_ESP32","USE_MATTER_DEVICE"
|
2023-11-09 13:25:24 +00:00
|
|
|
],[
|
2024-02-27 13:16:13 +00:00
|
|
|
"USE_MAGIC_SWITCH","USE_PIPSOLAR","USE_GPIO_VIEWER","USE_AMSX915",
|
2024-07-17 11:25:44 +01:00
|
|
|
"USE_SPI_LORA","USE_SPL06_007","USE_QMP6988","USE_WOOLIIS",
|
2024-09-13 12:53:01 +01:00
|
|
|
"USE_HX711_M5SCALES","USE_RX8010","","",
|
2023-11-09 13:25:24 +00:00
|
|
|
"","","","",
|
|
|
|
"","","","",
|
|
|
|
"","","","",
|
|
|
|
"","","","",
|
|
|
|
"","","",""
|
2019-08-10 16:52:26 +01:00
|
|
|
]]
|
2018-05-19 16:31:55 +01:00
|
|
|
|
|
|
|
usage = "usage: decode-status {-d | -f} arg"
|
|
|
|
parser = OptionParser(usage)
|
|
|
|
parser.add_option("-d", "--dev", action="store", type="string",
|
|
|
|
dest="device", help="device to retrieve status from")
|
2018-09-14 15:39:06 +01:00
|
|
|
parser.add_option("-u", "--username", action="store", type="string",
|
|
|
|
dest="username", help="username for login", default="admin")
|
|
|
|
parser.add_option("-p", "--password", action="store", type="string",
|
|
|
|
dest="password", help="password for login", default=None)
|
2018-05-19 16:31:55 +01:00
|
|
|
parser.add_option("-f", "--file", metavar="FILE",
|
|
|
|
dest="jsonfile", default="status.json", help="status json file (default: status.json)")
|
|
|
|
(options, args) = parser.parse_args()
|
|
|
|
|
|
|
|
if (options.device):
|
2018-09-14 15:39:06 +01:00
|
|
|
loginstr = ""
|
|
|
|
if options.password is not None:
|
2020-07-04 16:39:56 +01:00
|
|
|
loginstr = "user={}&password={}&".format(urllib.parse.quote(options.username), urllib.parse.quote(options.password))
|
2018-09-14 15:39:06 +01:00
|
|
|
url = str("http://{}/cm?{}cmnd=status%200".format(options.device, loginstr))
|
2020-07-04 16:39:56 +01:00
|
|
|
res = requests.get(url)
|
|
|
|
obj = json.loads(res.content)
|
2018-05-19 16:31:55 +01:00
|
|
|
else:
|
|
|
|
jsonfile = options.jsonfile
|
2019-02-04 10:41:51 +00:00
|
|
|
with open(jsonfile, "r") as fp:
|
2019-02-04 00:04:42 +00:00
|
|
|
obj = json.load(fp)
|
2018-05-19 16:31:55 +01:00
|
|
|
|
|
|
|
def StartDecode():
|
2024-10-25 16:27:39 +01:00
|
|
|
print ("\n*** decode-status.py v14.3.0.2 by Theo Arends and Jacek Ziolkowski ***")
|
2018-07-25 11:42:53 +01:00
|
|
|
|
2018-05-19 16:31:55 +01:00
|
|
|
# print("Decoding\n{}".format(obj))
|
|
|
|
|
2019-02-04 00:04:42 +00:00
|
|
|
if "StatusSNS" in obj:
|
|
|
|
if "Time" in obj["StatusSNS"]:
|
2018-07-17 15:07:03 +01:00
|
|
|
time = str(" from status report taken at {}".format(obj["StatusSNS"]["Time"]))
|
|
|
|
|
2019-02-04 00:04:42 +00:00
|
|
|
if "Status" in obj:
|
|
|
|
if "FriendlyName" in obj["Status"]:
|
2018-07-25 11:42:53 +01:00
|
|
|
print("Decoding information for device {}{}".format(obj["Status"]["FriendlyName"][0], time))
|
2018-07-17 15:07:03 +01:00
|
|
|
|
2019-02-04 00:04:42 +00:00
|
|
|
if "StatusLOG" in obj:
|
|
|
|
if "SetOption" in obj["StatusLOG"]:
|
2018-07-17 15:07:03 +01:00
|
|
|
options = []
|
2019-02-04 10:41:51 +00:00
|
|
|
|
2019-02-04 00:04:42 +00:00
|
|
|
i = 0
|
2019-02-04 10:41:51 +00:00
|
|
|
for r,opt_group in enumerate(a_setoption):
|
2019-02-04 00:04:42 +00:00
|
|
|
register = obj["StatusLOG"]["SetOption"][r]
|
2019-02-04 10:41:51 +00:00
|
|
|
|
2019-02-04 00:04:42 +00:00
|
|
|
if r > 0 and len(obj["StatusLOG"]["SetOption"]) == 2: # old firmware: array consisted only of SetOptions 0..31 and resolution
|
2019-02-04 10:41:51 +00:00
|
|
|
break
|
|
|
|
|
2019-02-04 00:04:42 +00:00
|
|
|
if r == 1:
|
|
|
|
if len(register) == 8: # pre 6.1.1.14: array consisted of SetOptions 0..31, resolution, and SetOptions 50..81
|
|
|
|
i += 18 # adjust option index and skip 2nd register
|
|
|
|
continue
|
2019-02-04 10:41:51 +00:00
|
|
|
|
|
|
|
elif len(register) == 36: # 6.1.1.14: array consists of SetOptions 0..31, SetOptions 32..49, and SetOptions 50..81
|
2020-08-13 15:59:51 +01:00
|
|
|
# 8.4.0.2: adds another SetOptions 114..145
|
2019-02-04 00:04:42 +00:00
|
|
|
split_register = [int(register[opt*2:opt*2+2],16) for opt in range(18)] # split register into 18 values
|
2019-02-04 10:41:51 +00:00
|
|
|
|
2019-02-04 00:04:42 +00:00
|
|
|
for opt_idx, option in enumerate(opt_group):
|
2020-11-29 14:59:40 +00:00
|
|
|
options.append(str("{0:3d} ({1:3d}) {2}".format(i, split_register[opt_idx], option)))
|
2019-02-04 00:04:42 +00:00
|
|
|
i += 1
|
2019-02-04 10:41:51 +00:00
|
|
|
|
2022-05-29 14:49:57 +01:00
|
|
|
if r in (0, 2, 3, 4, 5): # register 1 holds binary values
|
2019-02-04 00:04:42 +00:00
|
|
|
for opt_idx, option in enumerate(opt_group):
|
2022-05-29 14:49:57 +01:00
|
|
|
if len(option) == 0:
|
|
|
|
continue # Skip empty line
|
2019-02-04 00:04:42 +00:00
|
|
|
i_register = int(register,16)
|
|
|
|
state = (i_register >> opt_idx) & 1
|
2020-11-29 14:59:40 +00:00
|
|
|
options.append(str("{0:3d} ({1}) {2}".format(i, a_on_off[state], option)))
|
2019-02-04 00:04:42 +00:00
|
|
|
i += 1
|
2019-02-04 10:41:51 +00:00
|
|
|
|
2022-05-29 14:49:57 +01:00
|
|
|
if r >= len(obj["StatusLOG"]["SetOption"]) -1:
|
|
|
|
break # Versions before 11.1.0.3 hold SO until 145
|
|
|
|
|
2018-07-17 15:07:03 +01:00
|
|
|
print("\nOptions")
|
2019-02-04 00:04:42 +00:00
|
|
|
for o in options:
|
|
|
|
print(" {}".format(o))
|
2018-07-17 15:07:03 +01:00
|
|
|
|
2019-02-04 00:04:42 +00:00
|
|
|
if "StatusMEM" in obj:
|
|
|
|
if "Features" in obj["StatusMEM"]:
|
2018-07-17 15:07:03 +01:00
|
|
|
features = []
|
2021-05-12 22:20:16 +01:00
|
|
|
maxfeatures = len(obj["StatusMEM"]["Features"]) - 1
|
2021-05-12 17:44:13 +01:00
|
|
|
if maxfeatures > len(a_features):
|
|
|
|
print("decode-status.py too old, does not support all feature bits")
|
|
|
|
maxfeatures = min(maxfeatures, len(a_features))
|
|
|
|
for f in range(maxfeatures + 1):
|
2018-07-17 15:07:03 +01:00
|
|
|
feature = obj["StatusMEM"]["Features"][f]
|
|
|
|
i_feature = int(feature,16)
|
2019-02-04 00:04:42 +00:00
|
|
|
if f == 0:
|
2018-07-17 15:07:03 +01:00
|
|
|
features.append(str("Language LCID = {}".format(i_feature & 0xFFFF)))
|
|
|
|
else:
|
|
|
|
for i in range(len(a_features[f -1])):
|
2019-02-04 00:04:42 +00:00
|
|
|
if (i_feature >> i) & 1:
|
2018-07-17 15:07:03 +01:00
|
|
|
features.append(a_features[f -1][i])
|
|
|
|
|
|
|
|
features.sort()
|
|
|
|
print("\nFeatures")
|
2019-02-04 00:04:42 +00:00
|
|
|
for f in features:
|
|
|
|
print(" {}".format(f))
|
2018-05-19 16:31:55 +01:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
try:
|
|
|
|
StartDecode()
|
|
|
|
except Exception as e:
|
2018-09-14 15:39:06 +01:00
|
|
|
print("E: {}".format(e))
|