maufl / pymaxcul

Python library to talk to eq-3 MAX! devices through a CUL stick

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add support for 'eco' switch and window sensor

gretel opened this issue Β· comments

@maufl as you asked for at home-assistant/core#11454 (comment) here's the issue πŸ˜„

Thanks! Sorry for keeping you waiting. Unfortunately I don't know to which existing messages the echo switch corresponds, but I added handling of shutter contact messages. Can you maybe try the add-support-for-shutter-contact branch with your CUL stick and your devices? To see whether the shutter contact messages work and to find out which messages are sent by the eco switch. I added a sample file test.py you should be able to use for that. Meanwhile I'm going to rewrite the Homeassistant component.

using this CUL with a "credit-friendly" firmware.

here's the log of

  • pushing the pairing button on the eco switch
  • pushing the "eco" button
  • pushing the "auto" button
INFO:maxcul._communication:Enable pairing for 3600 seconds
DEBUG:maxcul._io:Writing command V
DEBUG:maxcul._io:CUL reported version V 1.66_nocredits nanoCUL868
DEBUG:maxcul._io:Writing command X21
DEBUG:maxcul._io:Writing command Zr
DEBUG:maxcul._io:Writing command T01
DEBUG:maxcul._io:Got unhandled response from CUL: '0000'
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z179F04000007771234560012050F494551303137333535322E
DEBUG:maxcul._communication:Received message <PairPingMessage counter:9f flag:4 sender:777 receiver:123456 group:0 > (46)
DEBUG:maxcul._communication:Sending message <PairPongMessage counter:1 flag:0 sender:123456 receiver:777 group:0 >
ERROR:maxcul._communication:Exception <name 'ATTR_FIRMWARE_VERSION' is not defined> was raised while parsing message 'Z179F04000007771234560012050F494551303137333535322E'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Writing command Zs0B0100011234560007770000
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0C0102020007771234560001401D
DEBUG:maxcul._communication:Received message <AckMessage counter:1 flag:0 sender:777 receiver:123456 group:0 > (29)
thermostat_update {'device_id': 1911, 'measured_temperature': None, 'desired_temperature': None, 'mode': None, 'battery_low': None}
DEBUG:maxcul._io:Received new moritz message: Z0CA0025000077712345600100121
ERROR:maxcul._communication:Exception <unsupported operand type(s) for &: 'str' and 'int'> was raised while parsing message 'Z0CA0025000077712345600100121'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Received new moritz message: Z0CA002500007771234560050011E
ERROR:maxcul._communication:Exception <unsupported operand type(s) for &: 'str' and 'int'> was raised while parsing message 'Z0CA002500007771234560050011E'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Received new moritz message: Z0CA002500007771234560050011E
ERROR:maxcul._communication:Exception <unsupported operand type(s) for &: 'str' and 'int'> was raised while parsing message 'Z0CA002500007771234560050011E'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Received new moritz message: Z0CA102500007771234560010001E
ERROR:maxcul._communication:Exception <unsupported operand type(s) for &: 'str' and 'int'> was raised while parsing message 'Z0CA102500007771234560010001E'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Received new moritz message: Z0CA102500007771234560050001E
ERROR:maxcul._communication:Exception <unsupported operand type(s) for &: 'str' and 'int'> was raised while parsing message 'Z0CA102500007771234560050001E'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Received new moritz message: Z0CA102500007771234560050001F
ERROR:maxcul._communication:Exception <unsupported operand type(s) for &: 'str' and 'int'> was raised while parsing message 'Z0CA102500007771234560050001F'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Received new moritz message: Z0CA1025000077712345600500020
ERROR:maxcul._communication:Exception <unsupported operand type(s) for &: 'str' and 'int'> was raised while parsing message 'Z0CA1025000077712345600500020'. Please consider reporting this as a bug.
^CException ignored in: <module 'threading' from '/usr/lib/python3.6/threading.py'>
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 1294, in _shutdown
    t.join()
  File "/usr/lib/python3.6/threading.py", line 1056, in join
    self._wait_for_tstate_lock()
  File "/usr/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
    elif lock.acquire(block, timeout):
KeyboardInterrupt

and for the window sensor:

  • pushing it's pairing button
  • and a couple of triggers
INFO:maxcul._communication:Enable pairing for 3600 seconds
DEBUG:maxcul._io:Writing command V
DEBUG:maxcul._io:CUL reported version V 1.66_nocredits nanoCUL868
DEBUG:maxcul._io:Writing command X21
DEBUG:maxcul._io:Writing command Zr
DEBUG:maxcul._io:Writing command T01
DEBUG:maxcul._io:Got unhandled response from CUL: '0000'
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z170000000199770000000013040F4A4551303332303131322B
DEBUG:maxcul._communication:Received message <PairPingMessage counter:0 flag:0 sender:19977 receiver:0 group:0 > (43)
DEBUG:maxcul._communication:Sending message <PairPongMessage counter:1 flag:0 sender:123456 receiver:19977 group:0 >
ERROR:maxcul._communication:Exception <name 'ATTR_FIRMWARE_VERSION' is not defined> was raised while parsing message 'Z170000000199770000000013040F4A4551303332303131322B'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Writing command Zs0B0100011234560199770000
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0B010030019977000000000041
DEBUG:maxcul._communication:Received message <ShutterContactStateMessage counter:1 flag:0 sender:19977 receiver:0 group:0 > (65)
DEBUG:maxcul._communication:Sending message <AckMessage counter:1 flag:0 sender:123456 receiver:19977 group:0 >
ERROR:maxcul._communication:Exception <name 'ATTR_STATE' is not defined> was raised while parsing message 'Z0B010030019977000000000041'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Writing command Zs0A01000212345601997700
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z170000000199770000000013040F4A45513033323031313237
DEBUG:maxcul._communication:Received message <PairPingMessage counter:0 flag:0 sender:19977 receiver:0 group:0 > (55)
DEBUG:maxcul._communication:Sending message <PairPongMessage counter:2 flag:0 sender:123456 receiver:19977 group:0 >
ERROR:maxcul._communication:Exception <name 'ATTR_FIRMWARE_VERSION' is not defined> was raised while parsing message 'Z170000000199770000000013040F4A45513033323031313237'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Writing command Zs0B0200011234560199770000
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0B01003001997700000000021C
DEBUG:maxcul._communication:Received message <ShutterContactStateMessage counter:1 flag:0 sender:19977 receiver:0 group:0 > (28)
DEBUG:maxcul._communication:Sending message <AckMessage counter:1 flag:0 sender:123456 receiver:19977 group:0 >
ERROR:maxcul._communication:Exception <name 'ATTR_STATE' is not defined> was raised while parsing message 'Z0B01003001997700000000021C'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Writing command Zs0A01000212345601997700
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0B020030019977000000000036
DEBUG:maxcul._communication:Received message <ShutterContactStateMessage counter:2 flag:0 sender:19977 receiver:0 group:0 > (54)
DEBUG:maxcul._communication:Sending message <AckMessage counter:2 flag:0 sender:123456 receiver:19977 group:0 >
ERROR:maxcul._communication:Exception <name 'ATTR_STATE' is not defined> was raised while parsing message 'Z0B020030019977000000000036'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Writing command Zs0A02000212345601997700
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
^CException ignored in: <module 'threading' from '/usr/lib/python3.6/threading.py'>
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 1294, in _shutdown
    t.join()
  File "/usr/lib/python3.6/threading.py", line 1056, in join
    self._wait_for_tstate_lock()
  File "/usr/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
    elif lock.acquire(block, timeout):
KeyboardInterrupt

Thank you very much! I fixed the errors, can you please try again? Some of them where unnecessary mistakes, I'll start linting my files.

sure, for the 'eco switch':

INFO:maxcul._communication:Enable pairing for 3600 seconds
DEBUG:maxcul._io:Writing command V
DEBUG:maxcul._io:CUL reported version V 1.66_nocredits nanoCUL868
DEBUG:maxcul._io:Writing command X21
DEBUG:maxcul._io:Writing command Zr
DEBUG:maxcul._io:Writing command T01
DEBUG:maxcul._io:Got unhandled response from CUL: '0000'
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z17A204000007771234560012050F494551303137333535323A
DEBUG:maxcul._communication:Received message <PairPingMessage counter:a2 flag:4 group_id:0 sender_id:777 receiver_id:123456 firmware_version:V1.2 device_type:PushButton selftest_result:f device_serial:IEQ0173552> (58)
DEBUG:maxcul._communication:Sending message <PairPongMessage counter:1 sender_id:123456 receiver_id:777 group_id:0 devicetype:Cube>
device_repaired {'device_id': 1911, 'device_type': 'PushButton', 'device_serial': 'IEQ0173552', 'firmware_version': 'V1.2'}
DEBUG:maxcul._io:Writing command Zs0B0100011234560007770000
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0C01020200077712345600014034
DEBUG:maxcul._communication:Received message <AckMessage counter:1 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:ok> (52)
thermostat_update {'device_id': 1911, 'measured_temperature': None, 'desired_temperature': None, 'mode': None, 'battery_low': None}
DEBUG:maxcul._io:Received new moritz message: Z0CA3025000077712345600100023
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:a3 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:0 rferror:0 battery_low:0 is_retransmission:1> (35)
ERROR:maxcul._communication:Exception <'MaxConnection' object has no attribute 'send_ack'> was raised while parsing message 'Z0CA3025000077712345600100023'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Received new moritz message: Z0CA302500007771234560050002B
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:a3 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:0 rferror:0 battery_low:1 is_retransmission:1> (43)
ERROR:maxcul._communication:Exception <'MaxConnection' object has no attribute 'send_ack'> was raised while parsing message 'Z0CA302500007771234560050002B'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Received new moritz message: Z0CA4025000077712345600100129
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:a4 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:1 rferror:0 battery_low:0 is_retransmission:1> (41)
ERROR:maxcul._communication:Exception <'MaxConnection' object has no attribute 'send_ack'> was raised while parsing message 'Z0CA4025000077712345600100129'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Received new moritz message: Z0CA402500007771234560050012D
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:a4 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:1 rferror:0 battery_low:1 is_retransmission:1> (45)
ERROR:maxcul._communication:Exception <'MaxConnection' object has no attribute 'send_ack'> was raised while parsing message 'Z0CA402500007771234560050012D'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Received new moritz message: Z0CA4025000077712345600500130
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:a4 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:1 rferror:0 battery_low:1 is_retransmission:1> (48)
ERROR:maxcul._communication:Exception <'MaxConnection' object has no attribute 'send_ack'> was raised while parsing message 'Z0CA4025000077712345600500130'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Received new moritz message: Z0CA4025000077712345600500130
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:a4 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:1 rferror:0 battery_low:1 is_retransmission:1> (48)
ERROR:maxcul._communication:Exception <'MaxConnection' object has no attribute 'send_ack'> was raised while parsing message 'Z0CA4025000077712345600500130'. Please consider reporting this as a bug.

do you need log of the shutter for now, too?

@maufl spring time is ahead... 🌸

Sorry, I was quite busy. Also I think the parsing of the status bits was wrong. I took a look at the FHEM code and tried to understand Perl, I think the parsing should be correct now. Could you try again with the latest code? Meanwhile I will continue implementing the switch component in Home Assistant.

sure! same procedure as before:

INFO:maxcul._communication:Enable pairing for 3600 seconds
DEBUG:maxcul._io:Writing command V
DEBUG:maxcul._io:CUL reported version V 1.66_nocredits nanoCUL868
DEBUG:maxcul._io:Writing command X21
DEBUG:maxcul._io:Writing command Zr
DEBUG:maxcul._io:Writing command T01
DEBUG:maxcul._io:Got unhandled response from CUL: '0000'
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0CA9025000077712345600500036
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:a9 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:0 is_paired:1 rferror:1 battery_low:0> (54)
DEBUG:maxcul._communication:Sending message <AckMessage counter:a9 sender_id:123456 receiver_id:777 group_id:0>
push_button_update {'battery_low': False, 'state': False}
DEBUG:maxcul._io:Writing command Zs0AA9000212345600077700
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Received new moritz message: ZERR30D
DEBUG:maxcul._io:Got pending budget: 9000ms
ERROR:maxcul._communication:Exception <invalid literal for int() with base 16: 'ER'> was raised while parsing message 'ZERR30D'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Received new moritz message: Z0CAA025000077712345600100020
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:aa flag:2 group_id:0 sender_id:777 receiver_id:123456 state:0 is_paired:1 rferror:0 battery_low:0> (32)
DEBUG:maxcul._communication:Sending message <AckMessage counter:aa sender_id:123456 receiver_id:777 group_id:0>
push_button_update {'battery_low': False, 'state': False}
DEBUG:maxcul._io:Writing command Zs0AAA000212345600077700
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Received new moritz message: ZERR30D
DEBUG:maxcul._io:Got pending budget: 9000ms
ERROR:maxcul._communication:Exception <invalid literal for int() with base 16: 'ER'> was raised while parsing message 'ZERR30D'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Received new moritz message: Z0CAA02500007771234560050002C
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:aa flag:2 group_id:0 sender_id:777 receiver_id:123456 state:0 is_paired:1 rferror:1 battery_low:0> (44)
DEBUG:maxcul._communication:Sending message <AckMessage counter:aa sender_id:123456 receiver_id:777 group_id:0>
push_button_update {'battery_low': False, 'state': False}
DEBUG:maxcul._io:Writing command Zs0AAA000212345600077700
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Received new moritz message: ZERR30D
DEBUG:maxcul._io:Got pending budget: 9000ms
ERROR:maxcul._communication:Exception <invalid literal for int() with base 16: 'ER'> was raised while parsing message 'ZERR30D'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Received new moritz message: Z0CAB02500007771234560010012A
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:ab flag:2 group_id:0 sender_id:777 receiver_id:123456 state:1 is_paired:1 rferror:0 battery_low:0> (42)
DEBUG:maxcul._communication:Sending message <AckMessage counter:ab sender_id:123456 receiver_id:777 group_id:0>
push_button_update {'battery_low': False, 'state': True}
DEBUG:maxcul._io:Writing command Zs0AAB000212345600077700
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Received new moritz message: ZERR30D
ERROR:maxcul._communication:Exception <invalid literal for int() with base 16: 'ER'> was raised while parsing message 'ZERR30D'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0CAB02500007771234560050011F
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:ab flag:2 group_id:0 sender_id:777 receiver_id:123456 state:1 is_paired:1 rferror:1 battery_low:0> (31)
DEBUG:maxcul._communication:Sending message <AckMessage counter:ab sender_id:123456 receiver_id:777 group_id:0>
push_button_update {'battery_low': False, 'state': True}
DEBUG:maxcul._io:Writing command Zs0AAB000212345600077700
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Received new moritz message: ZERR30D
ERROR:maxcul._communication:Exception <invalid literal for int() with base 16: 'ER'> was raised while parsing message 'ZERR30D'. Please consider reporting this as a bug.
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0CAB02500007771234560050011F
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:ab flag:2 group_id:0 sender_id:777 receiver_id:123456 state:1 is_paired:1 rferror:1 battery_low:0> (31)
DEBUG:maxcul._communication:Sending message <AckMessage counter:ab sender_id:123456 receiver_id:777 group_id:0>
push_button_update {'battery_low': False, 'state': True}
DEBUG:maxcul._io:Writing command Zs0AAB000212345600077700
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Received new moritz message: ZERR30D
DEBUG:maxcul._io:Got pending budget: 9000ms
ERROR:maxcul._communication:Exception <invalid literal for int() with base 16: 'ER'> was raised while parsing message 'ZERR30D'. Please consider reporting this as a bug.

i was using https://github.com/fbeek/pimatic-maxcul before - personally, i can read js better than perl πŸ˜„

This is strange, I don't know what ZERR30D exactly means. I found this post and it sounds like the CUL stick might not switch into receive mode as fast as expected, but I'm not sure. Maybe a firmware update would help? I suppress this error message in my latest commits. Can you at least confirm that the reported state matches your expectation?

hmm, i'm using this particular firmware because it does ignore the crediting. has been working fine with pimatic-maxcul but that won't help.

new try:

INFO:maxcul._communication:Enable pairing for 3600 seconds
DEBUG:maxcul._io:Writing command V
DEBUG:maxcul._io:CUL reported version V 1.66_nocredits nanoCUL868
DEBUG:maxcul._io:Writing command X21
DEBUG:maxcul._io:Writing command Zr
DEBUG:maxcul._io:Writing command T01
DEBUG:maxcul._io:Got unhandled response from CUL: '0000'
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0CAF025000077712345600100043
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:af flag:2 group_id:0 sender_id:777 receiver_id:123456 state:0 is_paired:1 rferror:0 battery_low:0> (67)
DEBUG:maxcul._communication:Sending message <AckMessage counter:af sender_id:123456 receiver_id:777 group_id:0>
push_button_update {'device_id': 1911, 'battery_low': False, 'state': False}
DEBUG:maxcul._io:Writing command Zs0AAF000212345600077700
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0CAF02500007771234560050001C
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:af flag:2 group_id:0 sender_id:777 receiver_id:123456 state:0 is_paired:1 rferror:1 battery_low:0> (28)
DEBUG:maxcul._communication:Sending message <AckMessage counter:af sender_id:123456 receiver_id:777 group_id:0>
push_button_update {'device_id': 1911, 'battery_low': False, 'state': False}
DEBUG:maxcul._io:Writing command Zs0AAF000212345600077700
DEBUG:maxcul._io:Writing command X
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.6/logging/__init__.py", line 992, in emit
    msg = self.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 838, in format
    return fmt.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 575, in format
    record.message = record.getMessage()
  File "/usr/lib/python3.6/logging/__init__.py", line 338, in getMessage
    msg = msg % self.args
TypeError: not all arguments converted during string formatting
Call stack:
  File "/usr/lib/python3.6/threading.py", line 884, in _bootstrap
    self._bootstrap_inner()
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/home/tom/pymaxcul/maxcul/_io.py", line 57, in run
    self._loop()
  File "/home/tom/pymaxcul/maxcul/_io.py", line 65, in _loop
    self._receive_message()
  File "/home/tom/pymaxcul/maxcul/_io.py", line 85, in _receive_message
    line
Message: 'Received error message from CUL stick: {}'
Arguments: ('ZERR317',)
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0CB0025000077712345600100126
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:b0 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:1 is_paired:1 rferror:0 battery_low:0> (38)
DEBUG:maxcul._communication:Sending message <AckMessage counter:b0 sender_id:123456 receiver_id:777 group_id:0>
push_button_update {'device_id': 1911, 'battery_low': False, 'state': True}
DEBUG:maxcul._io:Writing command Zs0AB0000212345600077700
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0CB002500007771234560050011F
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:b0 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:1 is_paired:1 rferror:1 battery_low:0> (31)
DEBUG:maxcul._communication:Sending message <AckMessage counter:b0 sender_id:123456 receiver_id:777 group_id:0>
push_button_update {'device_id': 1911, 'battery_low': False, 'state': True}
DEBUG:maxcul._io:Writing command Zs0AB0000212345600077700
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0CB002500007771234560050011F
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:b0 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:1 is_paired:1 rferror:1 battery_low:0> (31)
DEBUG:maxcul._communication:Sending message <AckMessage counter:b0 sender_id:123456 receiver_id:777 group_id:0>
push_button_update {'device_id': 1911, 'battery_low': False, 'state': True}
DEBUG:maxcul._io:Writing command Zs0AB0000212345600077700
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0CB002500007771234560050011C
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:b0 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:1 is_paired:1 rferror:1 battery_low:0> (28)
DEBUG:maxcul._communication:Sending message <AckMessage counter:b0 sender_id:123456 receiver_id:777 group_id:0>
push_button_update {'device_id': 1911, 'battery_low': False, 'state': True}
DEBUG:maxcul._io:Writing command Zs0AB0000212345600077700
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms

I fixed the error with the logging string. But I still don't understand why the ACKs are not accepted. Do you know how pimatic-maxcul did ACK the PushButtonStateMessages?

@maufl unfortunately not and i also lost all the logs.. i suggest marking the shutter support as experimental. guess i could test "better" when some integration with homeassistant is done.

new try:

INFO:maxcul._communication:Enable pairing for 3600 seconds
DEBUG:maxcul._io:Writing command V
DEBUG:maxcul._io:CUL reported version V 1.66_nocredits nanoCUL868
DEBUG:maxcul._io:Writing command X21
DEBUG:maxcul._io:Writing command Zr
DEBUG:maxcul._io:Writing command T01
DEBUG:maxcul._io:Got unhandled response from CUL: '0000'
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0CB102500007771234560010012A
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:b1 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:1 is_paired:1 rferror:0 battery_low:0> (42)
DEBUG:maxcul._communication:Sending message <AckMessage counter:b1 sender_id:123456 receiver_id:777 group_id:0>
push_button_update {'device_id': 1911, 'battery_low': False, 'state': True}
DEBUG:maxcul._io:Writing command Zs0AB1000212345600077700
DEBUG:maxcul._io:Writing command X
WARNING:maxcul._io:Received error message from CUL stick: 'ZERR30D'
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0CB102500007771234560050012E
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:b1 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:1 is_paired:1 rferror:1 battery_low:0> (46)
DEBUG:maxcul._communication:Sending message <AckMessage counter:b1 sender_id:123456 receiver_id:777 group_id:0>
push_button_update {'device_id': 1911, 'battery_low': False, 'state': True}
DEBUG:maxcul._io:Writing command Zs0AB1000212345600077700
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0CB1025000077712345600500129
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:b1 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:1 is_paired:1 rferror:1 battery_low:0> (41)
DEBUG:maxcul._communication:Sending message <AckMessage counter:b1 sender_id:123456 receiver_id:777 group_id:0>
push_button_update {'device_id': 1911, 'battery_low': False, 'state': True}
DEBUG:maxcul._io:Writing command Zs0AB1000212345600077700
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0CB1025000077712345600500129
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:b1 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:1 is_paired:1 rferror:1 battery_low:0> (41)
DEBUG:maxcul._communication:Sending message <AckMessage counter:b1 sender_id:123456 receiver_id:777 group_id:0>
push_button_update {'device_id': 1911, 'battery_low': False, 'state': True}
DEBUG:maxcul._io:Writing command Zs0AB1000212345600077700
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0CB202500007771234560010012C
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:b2 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:1 is_paired:1 rferror:0 battery_low:0> (44)
DEBUG:maxcul._communication:Sending message <AckMessage counter:b2 sender_id:123456 receiver_id:777 group_id:0>
push_button_update {'device_id': 1911, 'battery_low': False, 'state': True}
DEBUG:maxcul._io:Writing command Zs0AB2000212345600077700
DEBUG:maxcul._io:Writing command X
WARNING:maxcul._io:Received error message from CUL stick: 'ZERR30D'
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0CB2025000077712345600500134
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:b2 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:1 is_paired:1 rferror:1 battery_low:0> (52)
DEBUG:maxcul._communication:Sending message <AckMessage counter:b2 sender_id:123456 receiver_id:777 group_id:0>
push_button_update {'device_id': 1911, 'battery_low': False, 'state': True}
DEBUG:maxcul._io:Writing command Zs0AB2000212345600077700
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms
DEBUG:maxcul._io:Received new moritz message: Z0CB2025000077712345600500137
DEBUG:maxcul._communication:Received message <PushButtonStateMessage counter:b2 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:1 is_paired:1 rferror:1 battery_low:0> (55)
DEBUG:maxcul._communication:Sending message <AckMessage counter:b2 sender_id:123456 receiver_id:777 group_id:0>
push_button_update {'device_id': 1911, 'battery_low': False, 'state': True}
DEBUG:maxcul._io:Writing command Zs0AB2000212345600077700
DEBUG:maxcul._io:Writing command X
DEBUG:maxcul._io:Got pending budget: 9000ms

looks good to me, except that one ZERR30D.

I'm not satisfied that the ACK message seems not to be accepted by the push button. Do you think you could record messages exchanged between pymatic-maxcul and your push button (and shutter)?

@maufl uh i was actually refering to the 'eco switch' but typed 'shutter' instead. sorry.
so far, i did post the messages in regards to the switch only - cause i can have it on my desk.

Ah, I just assumed that you meant eco switch anyway. The shutter contact is supported by my home assistant fork now, at least if there are no grave bugs. I don't know as what kind of component the eco switch / push button should be added. It is also missing from the home assistant maxcube component.

@maufl that's a good question. guess the switch can't be binary - it has two buttons (auto and eco). how about a sensor (https://home-assistant.io/components/sensor.mqtt/) for now?

@maufl getting back here from home-assistant/core#11454 πŸ‘
can resending of packets be limited.. delayed so the budget won't get used up? i imagine the case of a faulty sensor.. one only receiving data.

Sorry, I was a bit busy last week. We'll the problem isn't that we are resending many packets, there is already a limit to the number of ACKs I send and an increasing backoff. The problem is that the Eco Switch sends a message, seems to expect an ACK but does not accept our ACK and thus resends it's message two times. Do you think you could test and record the messages exchanged with another implementation like pymatic?

@maufl i got rid of all the pimatic stuff so i am afraid i won't be able to do that in time.
but, i read a bit of the a-culfw firmware code and i should actually handle budgeting by itself.
i wonder if you got the implementation right. by changing

MIN_REQUIRED_BUDGET = 0

in maxcul/_io.py i get a fine result. the firmware does not report any LOVF for now.

well, it seems to be even simpler:

if line.startswith("21  ")

but actually the CUL does not report any space characters postfixed. so changing to

if line.startswith("21")

and keeping MIN_REQUIRED_BUDGET at 1500 works just fine.

unfortunately and as you expected the eco button does still not get acked

2018-03-07 19:05:56 DEBUG (Thread-3) [maxcul._communication] Received message <PairPingMessage counter:0 flag:0 group_id:0 sender_id:777 receiver_id:123456 firmware_version:V1.2 device_type:PushButton selftest_result:f device_serial:IEQ0173552> (32)
2018-03-07 19:05:56 DEBUG (Thread-3) [maxcul._communication] Sending message <PairPongMessage counter:9 sender_id:123456 receiver_id:777 group_id:0 devicetype:Cube>
2018-03-07 19:05:56 INFO (Thread-3) [homeassistant.components.maxcul] New MAX! device paired: 1911
2018-03-07 19:05:57 DEBUG (Thread-4) [maxcul._io] Writing command Zs0B0900011234560007770000
2018-03-07 19:05:57 DEBUG (Thread-4) [maxcul._io] Writing command X
2018-03-07 19:05:58 DEBUG (Thread-3) [maxcul._communication] Repeating message <WakeUpMessage sender_id:123456 counter:2 receiver_id:1911> attempt 2
2018-03-07 19:05:58 DEBUG (Thread-4) [maxcul._io] Got pending budget: 19330ms
2018-03-07 19:05:58 DEBUG (Thread-4) [maxcul._io] Writing command Zs0A0200F112345600191100
2018-03-07 19:05:58 DEBUG (Thread-4) [maxcul._communication] Message <WakeUpMessage sender_id:123456 counter:2 receiver_id:1911> was sent, starting timeout for retry.
2018-03-07 19:05:58 DEBUG (Thread-4) [maxcul._io] Writing command X
2018-03-07 19:05:59 DEBUG (Thread-4) [maxcul._io] Got pending budget: 18260ms
2018-03-07 19:06:00 DEBUG (Thread-4) [maxcul._io] Received new moritz message: Z0C0102500007771234560010002D
2018-03-07 19:06:00 DEBUG (Thread-3) [maxcul._communication] Received message <PushButtonStateMessage counter:1 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:0 is_paired:1 rferror:0 battery_low:0> (45)
2018-03-07 19:06:00 DEBUG (Thread-3) [maxcul._communication] Repeating message <AckMessage counter:1 sender_id:123456 receiver_id:777 group_id:0> attempt 2
2018-03-07 19:06:01 DEBUG (Thread-4) [maxcul._io] Writing command Zs0A01000212345600077700
2018-03-07 19:06:01 DEBUG (Thread-4) [maxcul._communication] Message <AckMessage counter:1 sender_id:123456 receiver_id:777 group_id:0> was sent, starting timeout for retry.
2018-03-07 19:06:01 DEBUG (Thread-4) [maxcul._io] Writing command X
2018-03-07 19:06:02 DEBUG (Thread-4) [maxcul._io] Got pending budget: 17200ms
2018-03-07 19:06:03 DEBUG (Thread-4) [maxcul._io] Received new moritz message: Z0C0102500007771234560010001E
2018-03-07 19:06:03 DEBUG (Thread-3) [maxcul._communication] Received message <PushButtonStateMessage counter:1 flag:2 group_id:0 sender_id:777 receiver_id:123456 state:0 is_paired:1 rferror:0 battery_low:0> (30)
2018-03-07 19:06:03 DEBUG (Thread-3) [maxcul._communication] Repeating message <AckMessage counter:1 sender_id:123456 receiver_id:777 group_id:0> attempt 2
2018-03-07 19:06:04 DEBUG (Thread-4) [maxcul._io] Writing command Zs0A01000212345600077700
2018-03-07 19:06:04 DEBUG (Thread-4) [maxcul._communication] Message <AckMessage counter:1 sender_id:123456 receiver_id:777 group_id:0> was sent, starting timeout for retry.
2018-03-07 19:06:04 DEBUG (Thread-4) [maxcul._io] Writing command X
2018-03-07 19:06:05 DEBUG (Thread-4) [maxcul._io] Got pending budget: 16150ms
2018-03-07 19:06:06 DEBUG (Thread-4) [maxcul._io] Received new moritz message: Z0F0004600022000000000019032500C718
2018-03-07 19:06:06 DEBUG (Thread-3) [maxcul._communication] Received message <ThermostatStateMessage counter:0 flag:4 group_id:0 sender_id:2200 receiver_id:0 mode:manual dstsetting:0 langateway:1 is_locked:0 rferror:0 battery_low:0 desired_temperature:18.5 valve_position:3 measured_temperature:19.9> (24)
2018-03-07 19:06:06 DEBUG (Thread-3) [maxcul._communication] Sending message <AckMessage counter:0 sender_id:123456 receiver_id:2200 group_id:0>
2018-03-07 19:06:07 DEBUG (Thread-4) [maxcul._io] Writing command Zs0A00000212345600220000
2018-03-07 19:06:07 DEBUG (Thread-4) [maxcul._io] Writing command X
2018-03-07 19:06:08 DEBUG (Thread-4) [maxcul._io] Got pending budget: 15100ms

Hm, I took a look at the code of pimatic, but they don't seem to send ACKs.
Tomorrow I'm going to checkout their code and see whether the decoding of the messages is at least consistent with what we do. And maybe I'll take a look at FHEM, whether they send ACKs.

Btw, your budget is much higher than what I have ever seen.

@maufl the button has a LED which blinks once when pressed, and three times when pressed and not paired. i noticed that besides the 'paired' messages in the log the LED has always been blinking three times for now.
my uneducated guess is that sending an ACK might be required on pairing only?
in regards to the budget - compiling a-culfw is quite easy so i adjusted the budget a bit - as "recommended" on the FHEM forum 😏

Well, looking at pimatic did not help. I compared the decoding of all messages but I found only a difference in decoding the rferror field of PushButtonMessages, and I think this might be their mistake as I compared it again against FHEM. The last idea I have is that maybe the flag field of the ACK must match that of the message to which it responds. I added this feature to the add-support-for-shutter-contact branch, can you test it again with this branch or would it be easier if I included it in in my Homeassistant pull request?