maxwellhadley / node-red-contrib-rfxcom

node-RED nodes to access an RFXtrx433 transceiver
BSD 2-Clause "Simplified" License
22 stars 13 forks source link

Pi2 LightwaveRF Group Off causes connect/disconnect loop in Mosquitto #19

Closed TotallyInformation closed 6 years ago

TotallyInformation commented 6 years ago

Hi Max. Bit of an issue after installing the latest version.

When I receive a group off command from a LightwaveRF remote or receive a bell trigger from my Nexa doorbell, I am getting continuous disconnects from MQTT.

1501487616: New connection from 127.0.0.1 on port 1883.
1501487616: New client connected from 127.0.0.1 as Pi2_NR-Live (c1, k15).
1501487616: Socket error on client Pi2_NR-Live, disconnecting.
1501487631: New connection from 127.0.0.1 on port 1883.
1501487631: New client connected from 127.0.0.1 as Pi2_NR-Live (c1, k15).
1501487631: Socket error on client Pi2_NR-Live, disconnecting.
1501487646: New connection from 127.0.0.1 on port 1883.
1501487646: New client connected from 127.0.0.1 as Pi2_NR-Live (c1, k15).

I think the error is happening every time something is received by the RFX unit. Not sure if my HomeEasyEU motion sensor is also triggering the problem. This has only started since yesterday when I updated your module - though admittedly, I did update a couple of others too.

Interestingly, receiving a Mood1 input (group on, channel 16) does not cause the issue nor does using the individual channels on the remote.

I am going to try and wind back to the previous version to confirm whether this is the issue.

I'm running: Node-RED v0.17.4 Node.JS v6.11.1

TotallyInformation commented 6 years ago

OK, I've gone back 2 versions now and the problem persists. So I'm guessing it isn't your nodes. I'm going to try clearing the Mosquitto persistence db.

maxwellhadley commented 6 years ago

OK thanks. The last two releases were both to do with event listeners - not installing listeners for all the different varieties of rain event, and then being over-enthusiastic about removing them (deploying a changed rfx-in node would permanently 'silence' all other nodes of the same type).

TotallyInformation commented 6 years ago

I'm still getting the problem. As soon as I try to use the group off it disconnects from the broker and then won't reconnect. I've cleared the retain db just in case there was an odd retained msg but still the same problem. I can't work out what is causing it because it has been working fine up until yesterday. Though there might have been a Mosquitto update as well.

TotallyInformation commented 6 years ago

I had a brainwave. I've been starting to change my flows to a new MQTT topic strategy. So I'd added a second set of rfx inputs that flow out to a Homie-like topic structure. I've just created a second connection just for those outputs and that is the connection that is failing, not the original flows.

UPDATE: Getting closer. I've split the output connections again. & traced it to the latest addition.

UPDATE2: OK, I'm an idiot (ish) - I'd completely forgotten that the group off command in LightwaveRF sents a rediculous output!

{"status":{"rssi":7},"topic":"LIGHTWAVERF/0xF30F69/+","payload":"Off","_msgid":"b5a00170.23b51"}

Yes, of course, the plus symbol kills the connection though why it won't reconnect I'm not sure.

TotallyInformation commented 6 years ago

Is it worth a tweak to the lighting node to stop it outputting an invalid topic? I've raised it on Slack for Nick to look at too from the MQTT out node perspective.

TotallyInformation commented 6 years ago

I will have to add a change node to replace /+ with /16 which makes it consistent with the group on button. No idea why they thought it would be a good idea to have two buttons side-by-side that issue on different channels - all the other buttons issue on the same channel as their counterpart.

maxwellhadley commented 6 years ago

Ah OK, the topics were designed from the subscribing side, rather than the publishing side, so of course while you can subscribe to LIGHTWAVERF/0xF30F69/+ you can't publish to it! That has been there since the very earliest days. Since you can use '0' as a group address as well, for those devices that truly support group commands, I could change the topic to use a 0 in place of the +, without breaking anything (much).

I'll look at this in depth later (working at the moment)

UPDATE: But it's a bit off that just sending invalid input to the MQTT out node causes it to disconnect!

TotallyInformation commented 6 years ago

I agree, I will try to remember to raise an issue when I get some time. Been a long day of wrestling with Microsoft project and cross-workstream dependencies so I'm ready for tea and a strong drink!

maxwellhadley commented 6 years ago

Fixed in version 2.0.0