kukulich / home-assistant-jablotron100

Home Assistant custom component for JABLOTRON 100+ alarm system
MIT License
65 stars 24 forks source link

Motion sensors connected via JA-116H sometimes yield DEVICE_PACKET_TYPE_BATTERY packets #48

Closed leo-b closed 1 year ago

leo-b commented 2 years ago

My (non-bus) motion sensors that are connected via JA-116H yield packets of type DEVICE_PACKET_TYPE_BATTERY when motion is detected:

2022-07-05 08:54:29 ERROR (ThreadPoolExecutor-2_0) [custom_components.jablotron100] Unknown state packet (device 26): 5508a4d28006d0d6a838 022-07-05 08:54:38 ERROR (ThreadPoolExecutor-2_0) [custom_components.jablotron100] Unknown state packet (device 24): 5508a4ca000660d72839 2022-07-05 08:54:40 ERROR (ThreadPoolExecutor-2_0) [custom_components.jablotron100] Unknown state packet (device 25): 5508a4cc400680d74839

However, the state change is correctly registered by home assistant:

2022-07-05 09_37_50-

Analyzing the packets shows that the error is thrown here because the packet type is DEVICE_PACKET_TYPE_BATTERY:

/opt/homeassistant/bin/python3.9
>>> from jablotron100 import jablotron, const
>>> import binascii
>>> sh= '5508a4c8000640d70839'
>>> sb = binascii.unhexlify(sh)
>>> jablotron.Jablotron._convert_jablotron_device_state_to_state(sb, 24)
'on'
>>> jablotron.Jablotron._bytes_to_binary(sb[2:3])                       
'10100100'
>>> packet_state_binary = _
>>> jablotron.Jablotron.binary_to_int(packet_state_binary[5:])
4
>>> packet_type = _
>>> packet_type == const.DEVICE_PACKET_TYPE_BATTERY
True
kukulich commented 2 years ago

I’m sorry I don’t understand.

leo-b commented 2 years ago

I’m sorry I don’t understand.

Sorry. I accidently submitted the issue while still typing the description. :-) I have now updated the text.

kukulich commented 2 years ago

Do the sensors have battery or not?

leo-b commented 2 years ago

No. They are old-style wired IR sensors with 12V power and NO/NC contacts. Power and signal lines are connected to this expansion card https://www.jablotron.com/underwood/download/pdf/en/JA-116H.pdf

leo-b commented 2 years ago

/etc/homeassistant/.storage/core.device_registry

{
                "config_entries": [
                    "86c9a4785a2314ad8eab82cae3ce14af"
                ],
                "connections": [],
                "identifiers": [
                    [
                        "jablotron100",
                        "device_24"
                    ]
                ],
                "manufacturer": "Jablotron",
                "model": null,
                "name": "Motion detector (device 24)",
                "sw_version": null,
                "hw_version": null,
                "entry_type": null,
                "id": "84a03e20b2ec77cbd0a134768eb5a2d2",
                "via_device_id": "f560fe6f8f4abaa07077fef4e4e53daa",
                "area_id": null,
                "name_by_user": "Jablotron Bewegungsmelder Eingang (24)",
                "disabled_by": null,
                "configuration_url": null
            },
            {
                "config_entries": [
                    "86c9a4785a2314ad8eab82cae3ce14af"
                ],
                "connections": [],
                "identifiers": [
                    [
                        "jablotron100",
                        "/dev/hidraw_jablotron"
                    ]
                ],
                "manufacturer": "Jablotron",
                "model": "JA-107K (MD6112.05.3)",
                "name": "Jablotron 100",
                "sw_version": "MD12006",
                "hw_version": null,
                "entry_type": null,
                "id": "f560fe6f8f4abaa07077fef4e4e53daa",
                "via_device_id": null,
                "area_id": "keller",
                "name_by_user": "Jablotron Zentrale",
                "disabled_by": null,
                "configuration_url": null
            },

/etc/homeassistant/.storage/jablotron100:

                "device_24": {
                    "connection": "wired",
                    "signal_strength": null,
                    "battery": false,
                    "battery_level": null,
                    "section": 1
                },
kukulich commented 1 year ago

@leo-b Can you enable the debug and sabotage the device 24? You can try to open it or something similar. It should log packets that may help.

kukulich commented 1 year ago

Should be resolved in https://github.com/kukulich/home-assistant-jablotron100/releases/tag/3.14.0

leo-b commented 1 year ago

Should be resolved in https://github.com/kukulich/home-assistant-jablotron100/releases/tag/3.14.0

Confirmed. Thanks!