NickWaterton / eWeLink-mqtt

Bridge to control Sonoff Devices via MQTT
MIT License
19 stars 5 forks source link

Sonoff status after command execute #5

Open Remendado opened 1 year ago

Remendado commented 1 year ago

I have Sonoff TH16 one of first versions and Basic R3. I got success with switch devices to ON and OFF over eWeLink-mqtt. And now I want to receive new switch status after command execute.

When I push On-Off button in Ewelink mobile app, I get:

[2023-01-08 15:33:02,923] INFO publishing item: ewelink/ewelink_status/1000xxxx/json: {"action": "update", "deviceid": "1000xxxxxx", "apikey": "xxxx", "userAgent": "app", "sequence": "1673181180165", "params": {"switch": "on"}} [2023-01-08 15:33:02,923]DEBUG Received data {'action': 'update', 'deviceid': '1000xxxx', 'apikey': 'xxxx', 'userAgent': 'app', 'sequence': '1673181180165', 'params': {'switch': 'on'}} [2023-01-08 15:33:02,924] INFO publishing item: ewelink/ewelink_status/1000xxxx/json: {'action': 'update', 'deviceid': '1000xxxx', 'apikey': 'xxxx', 'userAgent': 'app', 'sequence': '1673181180165', 'params': {'switch': 'on'}} ----> [2023-01-08 15:33:02,924]DEBUG Action Update: Publishing: {'switch': 'on'} ----> [2023-01-08 15:33:02,925] INFO publishing item: ewelink/ewelink_status/1000xxxx/switch: on [2023-01-08 15:33:02,925] INFO publishing item: ewelink/ewelink_status/1000xxxx/last_update: Sun Jan 8 15:33:02 2023 [2023-01-08 15:33:02,926] INFO publishing item: ewelink/ewelink_status/1000xxxx/status: OK

When I send "on" or "off" command over MQTT

mosquitto_pub -r -u "homeuser" -P "xxxx" -h 127.0.0.1 -p 1883 -t "/ewelink_command/1000xxxx/switch" -m off

i get something like this:

[2023-01-08 15:38:43,110] INFO publishing item: ewelink/ewelink_status/1000xxxx/json: {"error": 0, "deviceid": "1000xxxx", "apikey": "xxxx", "sequence": "1673181522000", "uid": "xxxxxx"} [2023-01-08 15:38:43,112]DEBUG command completed successfully [2023-01-08 15:38:43,113] INFO publishing item: ewelink/ewelink_status/1000xxxx/status: OK [2023-01-08 15:38:43,114]DEBUG Received data {'error': 0, 'deviceid': '1000xxxx', 'apikey': 'xxxx', 'sequence': '1673181522000', 'uid': 'xxxxxx'} [2023-01-08 15:38:43,115] INFO publishing item: ewelink/ewelink_status/1000xxxx/json: {'error': 0, 'deviceid': '1000xxxx', 'apikey': 'xxxx', 'sequence': '1673181522000', 'uid': 'xxxxxx'}

In both cases commands executes successfully, but in the second case I don't get new switch status.