Re: [mh] MQTT Not Reliable
Stephen Switzer <[email protected]> Sat, 9 Sep 2023 11:43:31 -0400
| Newsgroups | gmane.comp.misc.misterhouse.user |
|---|---|
| Message-ID | <CALSXUc2THAesGabVxrSzGeXeKkBcK8m1KH6JZ4ao4YcPuCq=tg@mail.gmail.com> |
I'm thinking of updating my MH code today and I started to look at the GIT branch on my MH server... Well!! It appears that I haven't updated anything since 2016! root@avalanche:/opt/mh# git log commit c903c9012d1b86fcd45a6cb61e21e6f88a0c40a2 (HEAD -> running, origin/running) Author: Pmatis <[email protected]> Date: Sun Sep 18 13:14:05 2016 -0400 update running code I can foresee breaking ALL kinds of things by merging in master 7 years later! Not for the faint of heart, so I have to brace myself. LOL At least it's been really stable, except for my recent MQTT woes! Steve On Wed, Aug 23, 2023 at 9:08 PM H Plato <[email protected]> wrote: > Master has been updated. > > On Aug 22, 2023, at 3:38 PM, Dave Neudoerffer <[email protected]> > wrote: > > Howard: I have submitted a pull request. It includes one fix in > particular whereby the check_for_data code for mqtt will now process all > pending mqtt messages, rather than 1 per call. I had a situation where > there were 1000s of retained messages in a large mqtt environment, and it > took MH 10-15 minutes processing these 1 at a time at startup until it > would process regular MQTT messages. I have seen no MH issues with this > mqtt message processing change, and the 1000s of messages are processed at > startup sub second. > > Stephen: mqtt_item is the original mqtt code. It lines a separate > mqtt_item object up with each mqtt message. I implemented a separate > module, mqtt_items.pm, that lines objects up with an mqtt device -- the > normal MH way to do things. I think if you try out the mqtt_RemoteItem it > will do more what you are looking for. > > Dave > > On Tue, Aug 22, 2023 at 4:56 PM <[email protected]> wrote: > >> I'll be diving into MQTT in the next month or two. From this discussion I >> gather that there is an MH-native MQTT implementation, and apparently >> another approach that Giles is using. I've seen >> https://github.com/hollie/misterhouse/wiki/Items-mqtt (though not yet >> studied it in-depth), but it doesn't apparently talk about what Giles is >> doing. >> >> Can someone please give me a very superficial explanation of the >> differences, or else point me to an article somewhere. >> >> Thanks in advance for any enlightenment. >> >> -Brian M >> >> On 8/22/23 11:08, Giles Godart-Brown wrote: >> >> I also have a lot of MQTT devices using the native MH code with no major >> issues. >> Giles >> >> On 22/08/2023 17:50, H Plato wrote: >> >> On an unrelated note, is the insteon MQTT code more reliable than the >> native MH support? Why did you switch? >> >> I don’t have 120 devices, but probably 50 or so devices and it’s pretty >> good for reliability with the odd device exception. I have a challenge with >> some keypadlincs getting them to sync. the MH code seems to give up after a >> period of time, so I end up uninstalling the KPLs from the walls and into a >> temporary plastic electrical box that I can plug into the same outlet as >> the PLM. >> >> Dave if you submit a PR I can merge it in. There’s been a bunch of >> changes over the past year or so, might be good to capture a release soon. >> Unfortunately my git skills have atrophied so every time I think about >> doing this I get frustrated with some git situation and figure I’ll do it >> later…. >> >> On Aug 20, 2023, at 1:32 PM, Stephen Switzer <[email protected]> wrote: >> >> I'm probably running an old version of MH, so if this has been fixed in >> the past 1-2 years, then please tell me to update. :) >> >> I created an integration that has MH listening to the mosquito broker for >> some light commands, and for the most part, it's working. However, it seems >> that random lights do not work when I send a MQTT command to the broker. I >> can see the command hit the broker, but it won't trigger an event in MH for >> all lights. I see no difference between the lights that work and those that >> do not. >> >> Mosquito Broker: >> insteon/living_room_lamp on >> insteon/living_room_lamp/state on >> >> insteon/living_room_fan_light on >> caddx/motion/binary_sensor.living_motion/state on >> insteon/living_room_lamp off >> caddx/motion/binary_sensor.living_motion/state off >> insteon/living_room_lamp/state off >> >> >> MH: >> 08/20/23 03:21:57 PM [MQTT_RECV] living_room_lamp: on >> 08/20/23 03:21:59 PM [LIGHTS] $ll_liv_lamp1 is 100% >> 08/20/23 03:21:59 PM [MQTT_SEND] ll_liv_lamp1: on >> >> 08/20/23 03:22:06 PM [MQTT] MQTT_living_motion: on >> 08/20/23 03:22:07 PM [MOTION] Motion sensed in Living. >> 08/20/23 03:22:10 PM [MQTT_RECV] living_room_lamp: off >> 08/20/23 03:22:12 PM [MQTT] MQTT_living_motion: off >> 08/20/23 03:22:12 PM [LIGHTS] $ll_liv_lamp1 is off >> 08/20/23 03:22:12 PM [MQTT_SEND] ll_liv_lamp1: off >> >> You can see MH is listening to the broker, sending messages >> successfully, etc. The living_room_fan_light event was not picked up from >> the broker by MH. I don't see why. Here's the code snippets: >> >> >> $MQTT_insteon = new mqtt('mqtt_1', '127.0.0.1', 1883, 'insteon/#', "", >> "", 120); >> >> $MQTT_insteon_living_room_fan_light_set = new mqtt_Item($MQTT_insteon, >> "insteon/living_room_fan_light"); >> $MQTT_insteon_living_room_fan_light_state = new mqtt_Item($MQTT_insteon, >> "insteon/living_room_fan_light/state", 1, 1); >> if(my $state = state_changed $MQTT_insteon_living_room_fan_light_set) { >> print_log("[MQTT_RECV] living_room_fan_light: $state"); >> set $living_room_fan_light $state; >> } >> if($state = state_now $fl_liv_fanlight) { >> $state = ON if $state == '100%'; >> print_log("[MQTT_SEND] fl_liv_fanlight: $state"); >> set $MQTT_insteon_living_room_fan_light_state $state; >> } >> >> $MQTT_insteon_living_room_lamp_set = new mqtt_Item($MQTT_insteon, >> "insteon/living_room_lamp"); >> $MQTT_insteon_living_room_lamp_state = new mqtt_Item($MQTT_insteon, >> "insteon/living_room_lamp/state", 1, 1); >> if(my $state = state_changed $MQTT_insteon_living_room_lamp_set) { >> print_log("[MQTT_RECV] living_room_lamp: $state"); >> set $living_room_lamp $state; >> } >> if($state = state_now $ll_liv_lamp1) { >> $state = ON if $state == '100%'; >> print_log("[MQTT_SEND] ll_liv_lamp1: $state"); >> set $MQTT_insteon_living_room_lamp_state $state; >> } >> >> >> Mind you, I have about 120 lights in my code, all listening to >> $MQTT_insteon. Could there be a memory issue? I appreciate any input with >> ideas on this. >> >> Thank you! >> >> -- >> >> Best regards, >> Steve Switzer >> >> --- >> Get world-class business I.T. services and a phone system with awesome features that won't challenge your budget!http://www.sbsROC.com <http://www.sbsroc.com/> >> >> ________________________________________________________ >> To unsubscribe from this list, go to: >> https://lists.sourceforge.net/lists/listinfo/misterhouse-users >> >> >> >> >> ________________________________________________________ >> To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users >> >> >> >> >> ________________________________________________________ >> To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users >> >> >> ________________________________________________________ >> To unsubscribe from this list, go to: >> https://lists.sourceforge.net/lists/listinfo/misterhouse-users >> >> ________________________________________________________ > To unsubscribe from this list, go to: > https://lists.sourceforge.net/lists/listinfo/misterhouse-users > > > ________________________________________________________ > To unsubscribe from this list, go to: > https://lists.sourceforge.net/lists/listinfo/misterhouse-users > > -- Best regards, Steve Switzer --- Get world-class business I.T. services and a phone system with awesome features that won't challenge your budget!http://www.sbsROC.com ________________________________________________________ To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users