atmurray / aiopulse

Python asyncio implementation Rollease Acmeda Automate Pulse hub protocol implementation
Apache License 2.0
8 stars 4 forks source link

listed closed percentage with multiple blinds incorrect #10

Closed mdrileynyc closed 1 year ago

mdrileynyc commented 2 years ago

Using the latest aiopulse version and my rollease pulse hub v1, I see the wrong closed percentages among my 8 shades. Some are correct and some have an incorrect value that matches other blinds. For example, right now the demo.py 'list' command returns:

Hub 1: ID: XBBSESTJCG Host: 192.168.1.10 MAC: F0FE6BE325EE Firmware: 00000039 WiFi: 00HFLPB1 Roller 1: Name: Left Rear Bedroom Shade ID: 1101895819430 Serial: 112001 Room: Bedroom Type: 4 Closed %: 44 Battery %: 56 Flags: 00000000 Roller 2: Name: Left Front Bedroom Shade ID: 1101689784005 Serial: 112002 Room: Bedroom Type: 4 Closed %: 44 Battery %: 54 Flags: 00000000 Roller 3: Name: Right Front Bedroom Shade ID: 1100070751807 Serial: 112003 Room: Bedroom Type: 4 Closed %: 44 Battery %: 48 Flags: 00000000 Roller 4: Name: Right Rear Bedroom Shade ID: 1103116774878 Serial: 112004 Room: Bedroom Type: 4 Closed %: 44 Battery %: 52 Flags: 00000000 Roller 5: Name: Right Rear Livingroom Shade ID: 1103463721847 Serial: 112006 Room: Living Room Type: 4 Closed %: 44 Battery %: 55 Flags: 00000000 Roller 6: Name: Right Front Livingroom Shade ID: 1103208738123 Serial: 112005 Room: Living Room Type: 4 Closed %: 44 Battery %: 77 Flags: 00000000 Roller 7: Name: Left Front Livingroom Shade ID: 1101760510461 Serial: 112007 Room: Living Room Type: 4 Closed %: 44 Battery %: 78 Flags: 00000000 Roller 8: Name: Left Rear Livingroom Shade ID: 1103714650673 Serial: 112008 Room: Living Room Type: 4 Closed %: 44 Battery %: 53 Flags: 00000000 Room 1: Name: Living Room ID: b'a58d' Icon: 1 Room 2: Name: Bedroom ID: b'a58d' Icon: 4

In fact, only roller 6 and 7 are at 44% while the roller 3 and 4 are at 100% and the rest are at 0%. Operating the shades works correctly. Changing the positions gives a different scrambled percentage listing.

The Rollease Android App correctly shows the right closed percentages - suggesting the hub is OK. However, I looked at the aiopulse python code, esp the response_rollerlist function and it looks correct. Got me stumped, so asking the author to PTAL. As is, it makes my home assistant and Google home integrations look/speak screwy.

Thanks for doing this package!

atmurray commented 2 years ago

Hi @mdrileynyc, thanks for doing some troubleshooting - as you may have worked out I wrote this package by reverse-engineering the traffic between the smartphone app and the hub so its been a bit of trial and error to get it to work.

Could you turn on debug logging in the demo program using the command log debug and re-running the list command? This should spit out the received payload from the hub and help me work out what is going on.

mdrileynyc commented 2 years ago

Thanks for taking a look! I attach the debug output below. The true current state of the shades is:

Roller 1: Left Rear Bedroom Shade Closed: 0% Roller 2: Left Front Bedroom Shade: Closed: 100% Roller 3: Right Front Bedroom Shade Closed: 100% Roller 4: Right Rear Bedroom Shade ID Closed: 0% Roller 5: Right Rear Livingroom Shade Closed: 0% Roller 6: Right Front Livingroom Shade Closed: 70% Roller 7: Left Front Livingroom Shade Closed: 70% Roller 8: Left Rear Livingroom Shade Closed: 0%

In the output below, the closed positions are again scrambled. Conditions: latest aiopulse version, python3.9 and ubuntu 20.04 O/S.

Note 'log debug' doesn't work (_LOGGER undefined). I instead temp changed the logging.basicConfig to debug level.

-m riley

$ python3 ~/src/aiopulse/demo.py DEBUG:asyncio:Using selector: EpollSelector

discover Starting hub discovery DEBUG:aiopulse.transport:Connection established DEBUG:aiopulse.transport:UDP datagram received INFO:aiopulse.hub:192.168.1.10: Discovered hub on port 12414 DEBUG:aiopulse.transport:Connection established DEBUG:aiopulse.transport:UDP datagram received INFO:aiopulse.hub:192.168.1.10: Handshake complete DEBUG:aiopulse.hub:192.168.1.10: Disconnecting DEBUG:aiopulse.transport:Socket closed DEBUG:aiopulse.transport:192.168.1.10: TCP buffer cleared. DEBUG:aiopulse.transport:192.168.1.10: TCP connection closed. INFO:aiopulse.hub:192.168.1.10: Disconnected Hub added to prompt connect INFO:aiopulse.hub:192.168.1.10: Connecting DEBUG:aiopulse.transport:Connection established INFO:aiopulse.hub:192.168.1.10: Handshake complete DEBUG:aiopulse.hub:Sending buffer b'000000031e00009005536d6172745f4964315f793a0c00f0000400000000000000fff3' DEBUG:aiopulse.hub:192.168.1.10: Hub update command sent DEBUG:aiopulse.hub:192.168.1.10: Starting response parser DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'\x06Smart_Id1_y:P\x00\x16\x00\x03\x00\x00\x00\x00\x00\x00\x00S\x02\x08\x0000000039T\x02\x08\x0004020013U\x02\x08\x0000HFLPB1V\x02\x0c\x00F0FE6BE325EEW\x02\x0c\x00192.168.1.10\xffG' INFO:aiopulse.hub:192.168.1.10: Parsing hub info Hub info updated DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'' DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'\x06Smart_Id1_y:M\x00\x01\x01\x05\x00\x00\x00\x00\x00\x00\x00\x10\x00\x01\x00\x02\x00\x02\x08\x00a58d\xc3S\t\x9d\x0f\x00\x01\x00\x01\x0e\x00\x0b\x00Living Room\x00\x02\x08\x00a58d\x9d\xc1\xca\xa0\x0f\x00\x01\x00\x04\x0e\x00\x07\x00Bedroom\xffV' INFO:aiopulse.hub:192.168.1.10: Parsing room list Hub rooms updated INFO:aiopulse.hub:Discovery complete DEBUG:aiopulse.transport:UDP connection closed DEBUG:aiopulse.transport:Socket closed DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'\x06Smart_Id1_y:\xb5\x02!\x01\x06\x00\x00\x00\x00\x00\x00\x00\x10\x00\x01\x00\x08\x01\x01\x06\x00\xa6\xe0\x1b\x8e\x00\x01\x00\x02\x08\x00a58d\x9d\xc1\xca\xa0\x0f\x00\x01\x00\x04\x0e\x00\x17\x00Left Rear Bedroom Shade\x02\x01\x02\x001\x02x\x02\x06\x00112001\x03\x01\x01\x00\x19\x04\x01\x03\x00\x03\x00\x00\x01\x01\x06\x00\xc5\x06\xd4\x81\x00\x01\x00\x02\x08\x00a58d\x9d\xc1\xca\xa0\x0f\x00\x01\x00\x04\x0e\x00\x18\x00Left Front Bedroom Shade\x02\x01\x02\x001\x02x\x02\x06\x00112002\x03\x01\x01\x00\x12\x04\x01\x03\x00\x01F\x00\x01\x01\x06\x00?\x8eS!\x00\x01\x00\x02\x08\x00a58d\x9d\xc1\xca\xa0\x0f\x00\x01\x00\x04\x0e\x00\x19\x00Right Front Bedroom Shade\x02\x01\x02\x001\x02x\x02\x06\x00112003\x03\x01\x01\x00\x12\x04\x01\x03\x00\x01F\x00\x01\x01\x06\x00\xde-\xe2\xd6\x00\x01\x00\x02\x08\x00a58d\x9d\xc1\xca\xa0\x0f\x00\x01\x00\x04\x0e\x00\x18\x00Right Rear Bedroom Shade\x02\x01\x02\x001\x02x\x02\x06\x00112004\x03\x01\x01\x00\x10\x04\x01\x03\x00\x01,\x00\x01\x01\x06\x00w+\x90\xeb\x00\x01\x00\x02\x08\x00a58d\xc3S\t\x9d\x0f\x00\x01\x00\x04\x0e\x00\x1b\x00Right Rear Livingroom Shade\x02\x01\x02\x001\x02x\x02\x06\x00112006\x03\x01\x01\x00\x19\x04\x01\x03\x00\x03\x00\x00\x01\x01\x06\x00Km]\xdc\x00\x01\x00\x02\x08\x00a58d\xc3S\t\x9d\x0f\x00\x01\x00\x04\x0e\x00\x1c\x00Right Front Livingroom Shade\x02\x01\x02\x001\x02x\x02\x06\x00112005\x03\x01\x01\x00\x19\x04\x01\x03\x00\x03F\xb4\x01\x01\x06\x00\xfd9\x0b\x86\x00\x01\x00\x02\x08\x00a58d\xc3S\t\x9d\x0f\x00\x01\x00\x04\x0e\x00\x1b\x00Left Front Livingroom Shade\x02\x01\x02\x001\x02x\x02\x06\x00112007\x03\x01\x01\x00\x19\x04\x01\x03\x00\x03F\xb4\x01\x01\x06\x001\n\x85\xfa\x00\x01\x00\x02\x08\x00a58d\xc3S\t\x9d\x0f\x00\x01\x00\x04\x0e\x00\x1a\x00Left Rear Livingroom Shade\x02\x01\x02\x001\x02x\x02\x06\x00112008\x03\x01\x01\x00\x19\x04\x01\x03\x00\x03\x00\x00\xffa' INFO:aiopulse.hub:192.168.1.10: Parsing roller list DEBUG:aiopulse.hub:b'01010600a6e01b8e000100020800613538649dc1caa00f000100040e0017004c656674205265617220426564726f6f6d20536861646502010200310278020600313132303031030101001904010300030000' DEBUG:aiopulse.hub:b'01010600c506d481000100020800613538649dc1caa00f000100040e0018004c6566742046726f6e7420426564726f6f6d20536861646502010200310278020600313132303032030101001204010300014600' DEBUG:aiopulse.hub:b'010106003f8e5321000100020800613538649dc1caa00f000100040e00190052696768742046726f6e7420426564726f6f6d20536861646502010200310278020600313132303033030101001204010300014600' DEBUG:aiopulse.hub:b'01010600de2de2d6000100020800613538649dc1caa00f000100040e0018005269676874205265617220426564726f6f6d20536861646502010200310278020600313132303034030101001004010300012c00' DEBUG:aiopulse.hub:b'01010600772b90eb00010002080061353864c353099d0f000100040e001b0052696768742052656172204c6976696e67726f6f6d20536861646502010200310278020600313132303036030101001904010300030000' DEBUG:aiopulse.hub:b'010106004b6d5ddc00010002080061353864c353099d0f000100040e001c0052696768742046726f6e74204c6976696e67726f6f6d205368616465020102003102780206003131323030350301010019040103000346b4' DEBUG:aiopulse.hub:b'01010600fd390b8600010002080061353864c353099d0f000100040e001b004c6566742046726f6e74204c6976696e67726f6f6d205368616465020102003102780206003131323030370301010019040103000346b4' DEBUG:aiopulse.hub:b'01010600310a85fa00010002080061353864c353099d0f000100040e001a004c6566742052656172204c6976696e67726f6f6d20536861646502010200310278020600313132303038030101001904010300030000' DEBUG:aiopulse.hub:Sending buffer b'000000033200009005536d6172745f4964315f793a20002a01060000000000000001010600a6e01b8e0001410201000e4202010004ff03' Hub rollers updated DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'\x06Smart_Id1_y:\x11\x003\x01\n\x00\x00\x00\x00\x00\x00\x00\x10\x00\x01\x00\x00\xffN' INFO:aiopulse.hub:192.168.1.10: Parsing scene list Hub scenes updated DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'\x06Smart_Id1_y:\x11\x00A\x01\x0f\x00\x00\x00\x00\x00\x00\x00\x10\x00\x01\x00\x00\xffa' INFO:aiopulse.hub:192.168.1.10: Parsing timer list Hub timers updated DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'' DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'\x06Smart_Id1_y:2\x00+\x01\x07\x00\x00\x00\x00\x00\x00\x00\x01\x01\x06\x00\xa6\xe0\x1b\x8e\x00\x01A\x02\x01\x00\x0eB\x02\x01\x00\x04C\x02\x0e\x00\x00\x00\x00\x0c\x0b\x10\x01\x00\x00\x00\x00D\tD\xff\x11' INFO:aiopulse.hub:192.168.1.10: Parsing roller health DEBUG:aiopulse.hub:b'410201000e' DEBUG:aiopulse.hub:b'4202010004' DEBUG:aiopulse.hub:b'43020e0000' DEBUG:aiopulse.hub:b'00000c' DEBUG:aiopulse.hub:Battery: 11.0625 55 DEBUG:aiopulse.hub:b'0100000000440944' DEBUG:aiopulse.hub:Sending buffer b'000000033200009005536d6172745f4964315f793a20002a01080000000000000001010600c506d4810001410201000e4202010004fff6' DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'' DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'\x06Smart_Id1_y:2\x00+\x01\t\x00\x00\x00\x00\x00\x00\x00\x01\x01\x06\x00\xc5\x06\xd4\x81\x00\x01A\x02\x01\x00\x0eB\x02\x01\x00\x04C\x02\x0e\x00d\xb4\x00\x13\x0b\x04\x01\x00\x00\x00\x00C\tD\xff\x16' INFO:aiopulse.hub:192.168.1.10: Parsing roller health DEBUG:aiopulse.hub:b'410201000e' DEBUG:aiopulse.hub:b'4202010004' DEBUG:aiopulse.hub:b'43020e0064' DEBUG:aiopulse.hub:b'b40013' DEBUG:aiopulse.hub:Battery: 11.015625 54 DEBUG:aiopulse.hub:b'0100000000430944' DEBUG:aiopulse.hub:Sending buffer b'000000033200009005536d6172745f4964315f793a20002a010a00000000000000010106003f8e53210001410201000e4202010004ff19' DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'' DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'\x06Smart_Id1_y:2\x00+\x01\x0b\x00\x00\x00\x00\x00\x00\x00\x01\x01\x06\x00?\x8eS!\x00\x01A\x02\x01\x00\x0eB\x02\x01\x00\x04C\x02\x0e\x00d\xb4\x00\x0b\n\xd6\x01\x00\x00\x00\x00>\tD\xff\xfd' INFO:aiopulse.hub:192.168.1.10: Parsing roller health DEBUG:aiopulse.hub:b'410201000e' DEBUG:aiopulse.hub:b'4202010004' DEBUG:aiopulse.hub:b'43020e0064' DEBUG:aiopulse.hub:b'b4000b' DEBUG:aiopulse.hub:Battery: 10.8359375 47 DEBUG:aiopulse.hub:b'01000000003e0944' DEBUG:aiopulse.hub:Sending buffer b'000000033200009005536d6172745f4964315f793a20002a010c0000000000000001010600de2de2d60001410201000e4202010004ff9d' DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'' DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'\x06Smart_Id1_y:2\x00+\x01\r\x00\x00\x00\x00\x00\x00\x00\x01\x01\x06\x00\xde-\xe2\xd6\x00\x01A\x02\x01\x00\x0eB\x02\x01\x00\x04C\x02\x0e\x00\x00\x00\x00\x0c\n\xf5\x01\x00\x00\x00\x00B\tD\xff\x8d' INFO:aiopulse.hub:192.168.1.10: Parsing roller health DEBUG:aiopulse.hub:b'410201000e' DEBUG:aiopulse.hub:b'4202010004' DEBUG:aiopulse.hub:b'43020e0000' DEBUG:aiopulse.hub:b'00000c' DEBUG:aiopulse.hub:Battery: 10.95703125 52 DEBUG:aiopulse.hub:b'0100000000420944' DEBUG:aiopulse.hub:Sending buffer b'000000033200009005536d6172745f4964315f793a20002a010e0000000000000001010600772b90eb0001410201000e4202010004fff9' DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'' DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'\x06Smart_Id1_y:2\x00+\x01\x0f\x00\x00\x00\x00\x00\x00\x00\x01\x01\x06\x00w+\x90\xeb\x00\x01A\x02\x01\x00\x0eB\x02\x01\x00\x04C\x02\x0e\x00\x00\x00\x00\x0c\x0b\x08\x01\x00\x00\x00\x00C\tD\xff\xfe' INFO:aiopulse.hub:192.168.1.10: Parsing roller health DEBUG:aiopulse.hub:b'410201000e' DEBUG:aiopulse.hub:b'4202010004' DEBUG:aiopulse.hub:b'43020e0000' DEBUG:aiopulse.hub:b'00000c' DEBUG:aiopulse.hub:Battery: 11.03125 54 DEBUG:aiopulse.hub:b'0100000000430944' DEBUG:aiopulse.hub:Sending buffer b'000000033200009005536d6172745f4964315f793a20002a011000000000000000010106004b6d5ddc0001410201000e4202010004ffcf' WARNING:aiopulse.hub:192.168.1.10: Health-check timed out. DEBUG:aiopulse.hub:Sending buffer b'000000033200009005536d6172745f4964315f793a20002a01120000000000000001010600fd390b860001410201000e4202010004ffa7' DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'' DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'\x06Smart_Id1_y:2\x00+\x01\x11\x00\x00\x00\x00\x00\x00\x00\x01\x01\x06\x00Km]\xdc\x00\x01A\x02\x01\x00\x0eB\x02\x01\x00\x04C\x02\x0e\x00F\xb4\x00\x0c\x0b\xaf\x01\x00\x00\x00\x00U\tD\xff\x87' INFO:aiopulse.hub:192.168.1.10: Parsing roller health DEBUG:aiopulse.hub:b'410201000e' DEBUG:aiopulse.hub:b'4202010004' DEBUG:aiopulse.hub:b'43020e0046' DEBUG:aiopulse.hub:b'b4000c' DEBUG:aiopulse.hub:Battery: 11.68359375 76 DEBUG:aiopulse.hub:b'0100000000550944' DEBUG:aiopulse.hub:Sending buffer b'000000033200009005536d6172745f4964315f793a20002a01140000000000000001010600310a85fa0001410201000e4202010004ff9c' DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'' WARNING:aiopulse.hub:192.168.1.10: Health-check timed out. DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'\x06Smart_Id1_y:2\x00+\x01\x13\x00\x00\x00\x00\x00\x00\x00\x01\x01\x06\x00\xfd9\x0b\x86\x00\x01A\x02\x01\x00\x0eB\x02\x01\x00\x04C\x02\x0e\x00F\xb4\x00\x0c\x0b\xb8\x01\x00\x00\x00\x00V\tD\xffi' INFO:aiopulse.hub:192.168.1.10: Parsing roller health DEBUG:aiopulse.hub:b'410201000e' DEBUG:aiopulse.hub:b'4202010004' DEBUG:aiopulse.hub:b'43020e0046' DEBUG:aiopulse.hub:b'b4000c' DEBUG:aiopulse.hub:Battery: 11.71875 78 DEBUG:aiopulse.hub:b'0100000000560944' DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'' DEBUG:aiopulse.hub:192.168.1.10: Received response: 145 message content: b'\x06Smart_Id1_y:2\x00+\x01\x15\x00\x00\x00\x00\x00\x00\x00\x01\x01\x06\x001\n\x85\xfa\x00\x01A\x02\x01\x00\x0eB\x02\x01\x00\x04C\x02\x0e\x00\x00\x00\x00\x0c\n\xf3\x01\x00\x00\x00\x00A\tD\xff\x89' INFO:aiopulse.hub:192.168.1.10: Parsing roller health DEBUG:aiopulse.hub:b'410201000e' DEBUG:aiopulse.hub:b'4202010004' DEBUG:aiopulse.hub:b'43020e0000' DEBUG:aiopulse.hub:b'00000c' DEBUG:aiopulse.hub:Battery: 10.94921875 51 DEBUG:aiopulse.hub:b'0100000000410944' list Listing hubs... Hub 1: ID: XBBSESTJCG Host: 192.168.1.10 MAC: F0FE6BE325EE Firmware: 00000039 WiFi: 00HFLPB1 Roller 1: Name: Left Rear Bedroom Shade ID: 1101895819430 Serial: 112001 Room: Bedroom Type: 4 Closed %: 0 Battery %: 55 Flags: 00000000 Roller 2: Name: Left Front Bedroom Shade ID: 1101689784005 Serial: 112002 Room: Bedroom Type: 4 Closed %: 70 Battery %: 54 Flags: 00000000 Roller 3: Name: Right Front Bedroom Shade ID: 1100070751807 Serial: 112003 Room: Bedroom Type: 4 Closed %: 70 Battery %: 47 Flags: 00000000 Roller 4: Name: Right Rear Bedroom Shade ID: 1103116774878 Serial: 112004 Room: Bedroom Type: 4 Closed %: 44 Battery %: 52 Flags: 00000000 Roller 5: Name: Right Rear Livingroom Shade ID: 1103463721847 Serial: 112006 Room: Living Room Type: 4 Closed %: 0 Battery %: 54 Flags: 00000000 Roller 6: Name: Right Front Livingroom Shade ID: 1103208738123 Serial: 112005 Room: Living Room Type: 4 Closed %: 70 Battery %: 76 Flags: 10110100 Roller 7: Name: Left Front Livingroom Shade ID: 1101760510461 Serial: 112007 Room: Living Room Type: 4 Closed %: 70 Battery %: 78 Flags: 10110100 Roller 8: Name: Left Rear Livingroom Shade ID: 1103714650673 Serial: 112008 Room: Living Room Type: 4 Closed %: 0 Battery %: 51 Flags: 00000000 Room 1: Name: Living Room ID: b'a58d' Icon: 1 Room 2: Name: Bedroom ID: b'a58d' Icon: 4 DEBUG:aiopulse.hub:192.168.1.10: Receive timeout, sending ping keepalive DEBUG:aiopulse.hub:192.168.1.10: Received response: 22 ping content: b'' DEBUG:aiopulse.hub:192.168.1.10: Received hub ping response

atmurray commented 2 years ago

I've decoded the resposne from your Hub and it lines up with the decoded values in the hub. It looks like for blinds 2, 3, and 4 the encoding is different.

Decoding your response:

INFO:aiopulse.hub:None: Parsing roller list INFO:aiopulse.hub:(b'\x03\x01\x01\x00\x19', 88) INFO:aiopulse.hub:(b'\x04\x01\x03\x00\x03', 93) INFO:aiopulse.hub:0 INFO:aiopulse.hub:Name: Left Rear Bedroom Shade ID: 1101895819430 Serial: 112001 Room: None Type: 4 Closed %: 0 Battery %: None Flags: 00000000 INFO:aiopulse.hub:(b'\x03\x01\x01\x00\x12', 171) INFO:aiopulse.hub:(b'\x04\x01\x03\x00\x01', 176) INFO:aiopulse.hub:70 INFO:aiopulse.hub:Name: Left Front Bedroom Shade ID: 1101689784005 Serial: 112002 Room: None Type: 4 Closed %: 70 Battery %: None Flags: 00000000 INFO:aiopulse.hub:(b'\x03\x01\x01\x00\x12', 255) INFO:aiopulse.hub:(b'\x04\x01\x03\x00\x01', 260) INFO:aiopulse.hub:70 INFO:aiopulse.hub:Name: Right Front Bedroom Shade ID: 1100070751807 Serial: 112003 Room: None Type: 4 Closed %: 70 Battery %: None Flags: 00000000 INFO:aiopulse.hub:(b'\x03\x01\x01\x00\x10', 338) INFO:aiopulse.hub:(b'\x04\x01\x03\x00\x01', 343) INFO:aiopulse.hub:44 INFO:aiopulse.hub:Name: Right Rear Bedroom Shade ID: 1103116774878 Serial: 112004 Room: None Type: 4 Closed %: 44 Battery %: None Flags: 00000000 INFO:aiopulse.hub:(b'\x03\x01\x01\x00\x19', 424) INFO:aiopulse.hub:(b'\x04\x01\x03\x00\x03', 429) INFO:aiopulse.hub:0 INFO:aiopulse.hub:Name: Right Rear Livingroom Shade ID: 1103463721847 Serial: 112006 Room: None Type: 4 Closed %: 0 Battery %: None Flags: 00000000 INFO:aiopulse.hub:(b'\x03\x01\x01\x00\x19', 511) INFO:aiopulse.hub:(b'\x04\x01\x03\x00\x03', 516) INFO:aiopulse.hub:70 INFO:aiopulse.hub:Name: Right Front Livingroom Shade ID: 1103208738123 Serial: 112005 Room: None Type: 4 Closed %: 70 Battery %: None Flags: 10110100 INFO:aiopulse.hub:(b'\x03\x01\x01\x00\x19', 597) INFO:aiopulse.hub:(b'\x04\x01\x03\x00\x03', 602) INFO:aiopulse.hub:70 INFO:aiopulse.hub:Name: Left Front Livingroom Shade ID: 1101760510461 Serial: 112007 Room: None Type: 4 Closed %: 70 Battery %: None Flags: 10110100 INFO:aiopulse.hub:(b'\x03\x01\x01\x00\x19', 682) INFO:aiopulse.hub:(b'\x04\x01\x03\x00\x03', 687) INFO:aiopulse.hub:0 INFO:aiopulse.hub:Name: Left Rear Livingroom Shade ID: 1103714650673 Serial: 112008 Room: None Type: 4 Closed %: 0 Battery %: None Flags: 00000000

My hub response: INFO:aiopulse.hub:10.0.0.23: Parsing roller list INFO:aiopulse.hub:(b'\x03\x01\x01\x00\x19', 72) INFO:aiopulse.hub:(b'\x04\x01\x03\x00\x03', 77) INFO:aiopulse.hub:97 INFO:aiopulse.hub:Name: Blind 1 ID: 1099620088117 Serial: 562002 Room: All Blinds Type: 3 Closed %: 97 Battery %: None Flags: 00000000 INFO:aiopulse.hub:(b'\x03\x01\x01\x00\x19', 138) INFO:aiopulse.hub:(b'\x04\x01\x03\x00\x03', 143) INFO:aiopulse.hub:0 INFO:aiopulse.hub:Name: Blind 2 ID: 1100280357912 Serial: 562001 Room: All Blinds Type: 3 Closed %: 0 Battery %: None Flags: 10110100 INFO:aiopulse.hub:(b'\x03\x01\x01\x00\x19', 204) INFO:aiopulse.hub:(b'\x04\x01\x03\x00\x03', 209) INFO:aiopulse.hub:5 INFO:aiopulse.hub:Name: Blind 3 ID: 1100178112792 Serial: 562002 Room: All Blinds Type: 3 Closed %: 5 Battery %: None Flags: 10110100 INFO:aiopulse.hub:(b'\x03\x01\x01\x00\x19', 270) INFO:aiopulse.hub:(b'\x04\x01\x03\x00\x03', 275) INFO:aiopulse.hub:97 INFO:aiopulse.hub:Name: Blind 4 ID: 1100638693048 Serial: 562003 Room: All Blinds Type: 3 Closed %: 97 Battery %: None Flags: 10110100

As you can see, for blinds 2, 3, and 4 of yours the 10 bytes prior to the blind position is different to your other blinds and from mine. I'm not sure why that but I suspect it indicates that the format of the blind position in the following byte needs to be interpreted differently.

Is there anything different about these blinds that you can think of?

I've fixed the log level setting in the demo app and added this additional information to the "info" level output, you can download this version here: https://github.com/atmurray/aiopulse/tree/develop

atmurray commented 2 years ago

Could you download the development release and once connected using the demo app, set the log level to info. Then, use you android app to move the blinds 2, 3, and 4 to 0% 25% 75% and 100% noting the output. The demo app should automatically report the blind position after each time the blind stops.

mdrileynyc commented 2 years ago

The shade motors are all Rollease 5V Motor Zero Li-ion EQ 1.1 and were ordered from the same vendor within a few weeks of each other. They all seemed identically packaged when I installed them and same procedures were used for everything.

I'll run your expt soon. Thanks!

mdrileynyc commented 2 years ago

BTW, in the initial output I sent, all rollers are reported '44%' closed Note only rollers 6 and 7 are EVER set to 44%. So in the first example, 6 rollers not only have the wrong setting but they have the setting of another roller never used for them. Doesn't that suggest the problem isn't specific to rollers 2,3,4 and there is some cross-blind issue (ugh)?

More generally rollers 6 and 7 are often set to 44% or 70%. All other shade positions of all blinds are either 0% or 100%. An observation is that in the scrambled settings, other blinds some times show 44% or 70%. In your code, I was looking for something that would make this possible and I sure didn't see it - each blind info looks separately unpacked and all values are updated for each blind. But I couldn't blame the hub, since the app looks correct. Weird. Anyway, I'll run your expt as suggested, just adding some background.

mdrileynyc commented 2 years ago

One thing occurs to me. I have a manual control (Paradigm 15 ch), which is how I originally programmed the blinds. I set up not only for individual blinds but with groups of 2 (front living, back living,..) and groups of 4 (front all, back all). I set up the hub by using the 'Copy from remote' feature (one shade at a time). I copied only the individual shades and set up no groups in the hub proper in any way. The android app doesn't show the remote-defined groupings but perhaps some additional info is transmitted by the hub for the individual shades and could explain some cross-blind interaction? Grasping at straws :)

mdrileynyc commented 2 years ago

I believe I tried what you suggested but got the error:

ERROR:root:192.168.1.10: Exception raised when parsing response: b'' Traceback (most recent call last): File "/home/mriley/src/aiopulse/aiopulse-develop/aiopulse/hub.py", line 604, in response_parse Hub.respmap[mtype].execute(self, message) File "/home/mriley/src/aiopulse/aiopulse-develop/aiopulse/hub.py", line 512, in execute self.function(target, message) File "/home/mriley/src/aiopulse/aiopulse-develop/aiopulse/hub.py", line 557, in rec_message self.msgmap[mtype].execute(self, message[ptr:]) File "/home/mriley/src/aiopulse/aiopulse-develop/aiopulse/hub.py", line 512, in execute self.function(target, message) File "/home/mriley/src/aiopulse/aiopulse-develop/aiopulse/hub.py", line 454, in response_position _LOGGER.info(utils.unpack_bytes(message, ptr, 1).hex()) AttributeError: 'tuple' object has no attribute 'hex'

What I did:

  1. downloaded aiopulse-develop.zip
  2. unzip aiopulse-develop.zip
  3. cd aiopulse-develop
  4. pip install -e .
  5. python3.8 ./demo.py
  6. log info
  7. discover
  8. connect
  9. used the android app to request changing roller 2 from 100% to 50%.

-m

atmurray commented 2 years ago

Hi there, could you re-download and try again?

mdrileynyc commented 2 years ago

Identical steps and identical error in:

File "/home/mriley/src/aiopulse/aiopulse-develop/aiopulse/hub.py", line 454, in response_position _LOGGER.info(utils.unpack_bytes(message, ptr, 1).hex()) AttributeError: 'tuple' object has no attribute 'hex'

ls -l aiopulse-develop/aiopulse/hub.py -rw-r--r-- 1 mriley mriley 29861 Jul 25 08:02 aiopulse-develop/aiopulse/hub.py

ls -dl aiopulse-develop* drwxr-xr-x 5 mriley mriley 4096 Jul 25 08:02 aiopulse-develop # just unzipped -rw-r--r-- 1 mriley mriley 22043 Jul 30 16:59 aiopulse-develop.zip # just downloaded

-m

mdrileynyc commented 1 year ago

I found some time to look into the roller percentage bug I was seeing and fixed it. You were on the right track - the 10 'unknown' bytes before the roller percentage hold the key. In particular, if the 5th 'unknown' byte is b'\x19' then the roller percentage bytes are correct, but if it is b'\x10' or b'\x12' then the roller is completely open or closed resp. and the roller percentage bytes are incorrect - usually containing its previous set value for any roller (and hence all the oddities I was seeing). Basically its an alternate format for all open and closed which it uses sometimes (but not always). The actual coding could be wrt the last few bits of byte 5 (0=open, 1=percent, 2=closed).

(For completeness - I see each unknown byte pos 0-4,6-9 was the same for each case, while byte 10 was '\x01' for the 'alternate' case and '\x03' for the specified-percentage case. All this held true for many positionings.)

mdrileynyc commented 1 year ago

Here is my fix as 'diff aiopulse-master/hub.py and my/hub.py'.

 257a258,271
 >     def unpack_roller_percent(self, message, ptr):
 >         """Unpack roller close percentage."""
 >         ptr += 4
 >         roller_state, ptr = utils.unpack_bytes(message, ptr, 1)
 >         ptr += 5  # unknown field
 >         if roller_state == b'\x10':    # roller is open
 >             ptr += 1                   # unused percent field
 >             return 0, ptr
 >         elif roller_state == b'\x12':  # roller is closed
 >             ptr += 1                   # unused percent field
 >             return 100, ptr
 >         else:                          # read roller percent
 >             return utils.unpack_int(message, ptr, 1)
 >
 271,273c285
 <         ptr += 5  # unknown field
 <         ptr += 5  # unknown field
 <         roller_percent, ptr = utils.unpack_int(message, ptr, 1)
 ---
 >         roller_percent, ptr = self.unpack_roller_percent(message, ptr)
 330,332c342
 <             ptr += 5  # unknown field
 <             ptr += 5  # unknown field
 <             roller_percent, ptr = utils.unpack_int(message, ptr, 1)
 ---
 >             roller_percent, ptr = self.unpack_roller_percent(message, ptr)
 442,443c452
 <         ptr += 10
 <         roller_percent, ptr = utils.unpack_int(message, ptr, 1)
 ---
 >         roller_percent, ptr = self.unpack_roller_percent(message, ptr)
atmurray commented 1 year ago

Ah well done! I think by virtue of having fairly plain roller blinds mine don't use the alternate reporting format and so never encountered this. If you know how, could you submit a pull request for the patch? Otherwise, when I have some spare time I'll apply the patch manually. Also: do you think any of the other functions would have a similar approach to position reporting (maybe for tilting blinds)?

mdrileynyc commented 1 year ago

Thanks I'll give the pull request a try when I get a chance. Mine are the rollease 5v zero li-ion motor. Battery operated but simple. Don't know about other types.

On Mon, Mar 6, 2023, 4:44 PM Alan Murray @.***> wrote:

Ah well done! I think by virtue of having fairly plain roller blinds mine don't use the alternate reporting format and so never encountered this. If you know how, could you submit a pull request for the patch? Otherwise, when I have some spare time I'll apply the patch manually. Also: do you think any of the other functions would have a similar approach to position reporting (maybe for tilting blinds)?

— Reply to this email directly, view it on GitHub https://github.com/atmurray/aiopulse/issues/10#issuecomment-1457046419, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM5VVMY4ESX7JYLNDCZQCULW2ZLC3ANCNFSM54CEYS3Q . You are receiving this because you were mentioned.Message ID: @.***>

atmurray commented 1 year ago

I've released this as a new version of the API 0.4.4 Could you please check this out and test this with the demo app?

mdrileynyc commented 1 year ago

Thanks. Ill check this out when i have a chance.

On Sun, Mar 12, 2023, 5:34 AM Alan Murray @.***> wrote:

Closed #10 https://github.com/atmurray/aiopulse/issues/10 as completed.

— Reply to this email directly, view it on GitHub https://github.com/atmurray/aiopulse/issues/10#event-8725041742, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM5VVM27ZQZRTRXVECYXPL3W3VG4ZANCNFSM54CEYS3Q . You are receiving this because you were mentioned.Message ID: @.***>

mdrileynyc commented 1 year ago

I installed your new aiopulse (0.4.4) with my homeassistant version (2023.3.0). Seems to be working fine. I'll try it for a week and let you know if any issues crop up.

Thanks!

-m

On Tue, Mar 21, 2023 at 2:49 AM Michael Riley @.***> wrote:

Thanks. Ill check this out when i have a chance.

On Sun, Mar 12, 2023, 5:34 AM Alan Murray @.***> wrote:

Closed #10 https://github.com/atmurray/aiopulse/issues/10 as completed.

— Reply to this email directly, view it on GitHub https://github.com/atmurray/aiopulse/issues/10#event-8725041742, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM5VVM27ZQZRTRXVECYXPL3W3VG4ZANCNFSM54CEYS3Q . You are receiving this because you were mentioned.Message ID: @.***>

mdrileynyc commented 1 year ago

Everything works great. Hopefully HA will pick this up in their install.

-m

On Sat, Apr 1, 2023 at 2:28 PM Michael Riley @.***> wrote:

I installed your new aiopulse (0.4.4) with my homeassistant version (2023.3.0). Seems to be working fine. I'll try it for a week and let you know if any issues crop up.

Thanks!

-m

On Tue, Mar 21, 2023 at 2:49 AM Michael Riley @.***> wrote:

Thanks. Ill check this out when i have a chance.

On Sun, Mar 12, 2023, 5:34 AM Alan Murray @.***> wrote:

Closed #10 https://github.com/atmurray/aiopulse/issues/10 as completed.

— Reply to this email directly, view it on GitHub https://github.com/atmurray/aiopulse/issues/10#event-8725041742, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM5VVM27ZQZRTRXVECYXPL3W3VG4ZANCNFSM54CEYS3Q . You are receiving this because you were mentioned.Message ID: @.***>