hollie / misterhouse

Perl open source home automation program. It's fun, it's free, and it's entirely geeky.
243 stars 130 forks source link

mqtt.pm gets insufficient data #528

Open linuxha opened 9 years ago

linuxha commented 9 years ago

My code may have a bit of addition debugging since I am the author of the module and I found the issue.

Here is a sample of the error message from misterhouse

07/27/15 01:06:48 PM *** mqtt read_mqtt_msg: decode_string: insufficient data at /usr/local/share/perl/5.20.2/Net/MQTT/Message/Publish.pm line 36. ( sub _parse_remaining() )
 at /home/njc/dev/HA/git/misterhouse.add_mqtt_support/bin/mh line 31.
        main::__ANON__("decode_string: insufficient data at /usr/local/share/perl/5.2"...) called at /usr/share/perl/5.20/Carp.pm line 166
        Carp::croak("decode_string: insufficient data") called at /usr/local/share/perl/5.20.2/Net/MQTT/Constants.pm line 121
        Net::MQTT::Constants::decode_string(":01 GMT -->\x{a}\x{d}\x{a}<myId>http://alerts.weather.gov/cap/nj.atom", SCALAR(0x4551ef8)) called at /usr/local/share/perl/5.20.2/Net/MQTT/Message/Publish.pm line 36

The issue is that the sysread of the MQTT socket returns more than 1 MQTT message. The check for data will need to be rewritten to properly handle this (and probably also other problems such as handle the asyncronous nature of MQTT's other messages).

tbclark3 commented 1 year ago

I am running into this same error and curious about whether you have an unpublished fix or workaround. Thanks!

linuxha commented 1 year ago

I don't recall, I haven't used that code since it was last updated. I've switched to Node-Red and MQTT (and various gateway software for things like ZigBee and ZWave). Sorry