jamesleesaunders / PyAlertMe

Python Hive Hub
MIT License
15 stars 3 forks source link

Contact sensor data error #51

Open andydvsn opened 7 years ago

andydvsn commented 7 years ago

Once paired, when the device transmits the following error is logged:

2017-10-27 00:54:38,839 CRITICAL zbnode 418 XBee Error: need more than 2 values to unpack

I've paired it with my AlertMe Hub and I'm in the process of checking / updating the firmware to see if that is the issue. I'll report back.

andydvsn commented 7 years ago

No update; v2.2r1 is the latest from AlertMe.

andydvsn commented 6 years ago

Update found on British Gas Safe & Secure system; now running v2.3r0. Will retest with the script shortly.

andydvsn commented 6 years ago

No change. It's obviously not reporting one of manufacturer, type or version - though I have to say, I'm suspicious of the version information. I've seen that change without any firmware changes happening.

jamesleesaunders commented 6 years ago

If it is the response to the version information request you believe to be causing the above error we need to understand what (if any) the offending response is.

Have you tried increasing the logging level to see all the sending and receiving frames: In hub-example.py change:

# Create console handler and set level to info
sh = logging.StreamHandler()
sh.setLevel(logging.INFO)
sh.setFormatter(formatter)
logger.addHandler(sh)

to:

# Create console handler and set level to info
sh = logging.StreamHandler()
sh.setLevel(logging.DEBUG)
sh.setFormatter(formatter)
logger.addHandler(sh)

which will then spew all lots of logs to the screen of al the frames whizzing though (or if you prefer look in the debug.log file which your hub should already be writing to).

You are looking for something akin to:

2017-07-23 22:02:46,553 DEBUG zbnode 447 Sending Message: {'profile': '\xc2\x16', 'dest_addr_long': '\x00\x13\xa2\x00@\xa2;\t', 'dest_endpoint': '\x02', 'src_endpoint': '\x02', 'cluster': '\x00\xf6', 'dest_addr': 'RK', 'data': '\x11\x00\xfc'} 2017-07-23 22:02:46,632 DEBUG zbnode 486 Received Message: {'profile': '\xc2\x16', 'source_addr': '\xf9\xab', 'dest_endpoint': '\x02', 'rf_data': '\tq\xfe\xab\xf9\xf8\xb9\xbb\x03\x00o\r\x009\x10\x07\x00\x00)\x00\x01\x0bAlertMe.com\tSmartPlug\n2013-09-26', 'source_endpoint': '\x02', 'options': '\x01', 'source_addr_long': '\x00\ro\x00\x03\xbb\xb9\xf8', 'cluster': '\x00\xf6', 'id': 'rx_explicit'} 2017-07-23 22:02:46,633 DEBUG zbnode 596 Received AlertMe Specific Profile Packet 2017-07-23 22:02:46,633 DEBUG zbnode 661 Received Version Information 2017-07-23 22:02:46,633 DEBUG node 119 Attribute Update [NodeID: 00:0d:6f:00:03:bb:b9:f8 Field: manu Value: AlertMe.com] 2017-07-23 22:02:46,633 DEBUG node 119 Attribute Update [NodeID: 00:0d:6f:00:03:bb:b9:f8 Field: type Value: SmartPlug] 2017-07-23 22:02:46,633 DEBUG node 119 Attribute Update [NodeID: 00:0d:6f:00:03:bb:b9:f8 Field: version Value: 63915] 2017-07-23 22:02:46,633 DEBUG node 119 Attribute Update [NodeID: 00:0d:6f:00:03:bb:b9:f8 Field: manu_date Value: 2013-09-26]

Also see tests https://github.com/jamesleesaunders/PyAlertMe/blob/4b3517232d4910c9059d6168df532e4dd6ee69a7/tests/test_zbnode.py#L290 for more examples.

Once you have captured what your Safe&Secure is reporting, and if it looks similar to the above it may be that node_obj.parse_version_info_update() needs modifying to cater for slightly different frame? This should also be added to the tests above to check it parses OK.