roth-m / miioclient-mqtt

MI miio_client replacement with MQTT support
47 stars 18 forks source link

Error after start python script #1

Closed pavelkonir closed 4 years ago

pavelkonir commented 5 years ago

I have started modified miioclient

root@Aqara_Hub-9489:~# killall miio_client root@Aqara_Hub-9489:~# ./miio_client Local client connected Received from local client: {"method":"_internal.hello"} got _internal.hello Requesting device id. sending: {"method":"_internal.request_dinfo","params":"/mnt/data/miio/"} local client internal disconnected. Local client connected Received from local client: {"method":"_internal.response_dinfo","params":{}} Reading _internal message Device id wasn't a number. Device id received Local client disconnected. Local client connected Received from local client: {"method":"_internal.hello"} got _internal.hello Local client connected

When I starting python script on another device then show error:

('connecting to broker ', '127.0.0.1') Sending: {"method": "internal.PING"} {"method": "internal.PONG", "result": ["online"]} Bad JSON received Traceback (most recent call last): File "miioclient_mqtt.py", line 254, in <module> handle_miio_reply(req[0],miio_msg_decode(UDPClientSocket.recvfrom(miio_len_max)[0]), req[2]) File "miioclient_mqtt.py", line 67, in handle_miio_reply if state_update == True and miio_msg.get("result"): AttributeError: 'set' object has no attribute 'get'

pavelkonir commented 5 years ago

And when received miioclient data from temperature and humidity senzor then show on miio_client error: Received from local client: {"id":70,"method":"props","model":"lumi.sensor_ht.v1","params":{"from.humidity":"0,,,0.trg=0","humidity":6871},"sid":"lumi.158d00033b409f"} sending reply: {"id":70,"result":"ok"} Couldn't forward local client package: Invalid argument Received from local client: {"id":71,"sid":"lumi.158d00033b409f","model":"lumi.sensor_ht.v1","method":"props","params":{"device_log":"[1570730792,[\"prop.humidity\",[6871]]]"}} sending reply: {"id":71,"result":"ok"} Couldn't forward local client package: Invalid argument

pavelkonir commented 5 years ago

And now after 20th try start complette stack is python connected.

('connecting to broker ', '127.0.0.1') Sending: {"method": "internal.PING"} No reply! Sending: {"id": 1, "method": "get_arming"} No reply! Sending: {"params": [30], "id": 3, "method": "set_arming_time"} No reply! Sending: {"params": {"alarm_time_len": 1200, "sid": "lumi.0"}, "id": 5, "method": "set_device_prop"} No reply! Sending: {"params": [90], "id": 7, "method": "set_alarming_volume"} No reply! Sending: {"params": [0, "2"], "id": 9, "method": "set_alarming_sound"} No reply! Sending: {"params": [25], "id": 11, "method": "set_doorbell_volume"} No reply! Sending: {"params": [1, "11"], "id": 13, "method": "set_doorbell_sound"} {"id":82,"method":"props","model":"lumi.gateway.aqhm01","params":{"alarm_value":0,"alarm_volume":90,"gateway_lang":"us","gateway_volume":38,"light":"off","rgb":0}} Publish on /home/xiaomigatewayalarm_volume/state value:90 Publish on /home/xiaomigatewaygateway_lang/state value:us Publish on /home/xiaomigatewayalarm_value/state value:0 Publish on /home/xiaomigatewaylight/state value:off Publish on /home/xiaomigatewaygateway_volume/state value:38 Publish on /home/xiaomigatewayrgb/state value:0 Sending: {"params": ["off"], "id": 15, "method": "set_sound_playing"} {"result":["ok"],"code":0,"id":16}

But write errors:

{"id":105,"sid":"lumi.158d00033b409f","model":"lumi.sensor_ht.v1","method":"props","params":{"device_log":"[1570730994,[\"prop.humidity\",[5918]]]"}} Bad JSON received

roth-m commented 5 years ago

It looks like the old client is running after you killed it. You must launched the modified version straight after killing it otherwise it is relaunched.

Do: killall miio_client && ./miio_client