Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenHab and publishing status #12

Open
bradcurtis opened this issue Feb 1, 2018 · 6 comments
Open

OpenHab and publishing status #12

bradcurtis opened this issue Feb 1, 2018 · 6 comments

Comments

@bradcurtis
Copy link

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;
}
}
}

@marthoc
Copy link
Owner

marthoc commented Feb 1, 2018

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?

@bradcurtis
Copy link
Author

bradcurtis commented Feb 1, 2018 via email

@marthoc
Copy link
Owner

marthoc commented Feb 2, 2018

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
Copy link
Owner

marthoc commented Feb 2, 2018

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?

@bradcurtis
Copy link
Author

bradcurtis commented Feb 2, 2018 via email

@gusl79
Copy link

gusl79 commented Oct 8, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants