GarHAge icon indicating copy to clipboard operation
GarHAge copied to clipboard

OpenHab and publishing status

Open bradcurtis opened this issue 6 years ago • 6 comments

Hi, I have your system working on openhab. I was wondering what your thoughts were around not publishing status messages every minute or so. Most of the other openhab implementations continuously publish the status of sensors.

I am using MQTT.fx. I can see the status messages during open/close events, but I cannot see them running in a loop

Also, if you want I can write up what I did to get openhab working. I had to translate some of your messages to work with the switch and contact items

garage/door/1/status closed

void check_door1_status() { int currentStatusValue = digitalRead(door1_statusPin); if (currentStatusValue != door1_lastStatusValue) { unsigned int currentTime = millis(); if (currentTime - door1_lastSwitchTime >= debounceTime) { publish_door1_status(); door1_lastStatusValue = currentStatusValue; door1_lastSwitchTime = currentTime; } } }

bradcurtis avatar Feb 01 '18 22:02 bradcurtis

Yes it was a deliberate choice not to have the door status messages on a repeating loop because it’s not really necessary. The messages are published with the retain flag set, so any time your client (OpenHAB) connects to the broker it will get the latest status. If it’s not changing, then what’s the point of continually publishing it?

marthoc avatar Feb 01 '18 22:02 marthoc

On Thu, Feb 1, 2018 at 4:40 PM Mark Coombes [email protected] wrote:

Yes it was a deliberate choice not to have the door status messages on a repeating loop because it’s not really necessary. The messages are published with the retain flag set, so any time your client (OpenHAB) connects to the broker it will get the latest status. If it’s not changing, then what’s the point of continually publishing it?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/marthoc/GarHAge/issues/12#issuecomment-362426235, or mute the thread https://github.com/notifications/unsubscribe-auth/AK6WcfAXCTmeIlojTvaiT2LSQbECClBFks5tQj1NgaJpZM4R2ZJS .

The one thing I noticed is that my nodemcu is not transmitting the messages all the time. It almost seems like it goes to sleep after long periods

I was just wondering if that was why tasmota and easy esp send status updates every few minutes

bradcurtis avatar Feb 01 '18 23:02 bradcurtis

Then I think there’s something wrong with your NodeMCU - maybe power supply issue? Or wireless dropping out? Because mine has been running GarHAge in my own garage for months now without a power cycle and it works every time. (That’s not a brag, btw, but it is a fact).

marthoc avatar Feb 02 '18 00:02 marthoc

And all that being said, it’s trivial to add this feature so I will put it in the next update and make it a configurable option. Sound good?

marthoc avatar Feb 02 '18 00:02 marthoc

Mark,

No worries, I was more curious on the pattern that some people use and why they do it.

Thanks again for the hard work

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Thu, Feb 1, 2018 at 6:17 PM, Mark Coombes [email protected] wrote:

And all that being said, it’s trivial to add this feature so I will put it in the next update and make it a configurable option. Sound good?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/marthoc/GarHAge/issues/12#issuecomment-362445459, or mute the thread https://github.com/notifications/unsubscribe-auth/AK6WcUBfsueHXmqCFaZUBhAQenHTVa7qks5tQlQqgaJpZM4R2ZJS .

bradcurtis avatar Feb 02 '18 02:02 bradcurtis

Hi Mark,

Just wondering if you would be able to share your Openhab setup with Garhage. I've managed to get Garhage working with MQTT.fx but can't seem to get Openahb to trigger my NodeMCU.

I presume it has to do with the translation you had to perform.

I'd be interested to see how you configured your items

gusl79 avatar Oct 08 '18 07:10 gusl79