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

No longer receiving temperature MQTT event on subscribe #61

Open
jaythomas opened this issue Oct 11, 2020 · 4 comments
Open

No longer receiving temperature MQTT event on subscribe #61

jaythomas opened this issue Oct 11, 2020 · 4 comments

Comments

@jaythomas
Copy link
Contributor

The hestia/local/temperature event only comes across when the temperature changes, which means the UI will display "0" degrees indefinitely in certain situations, such as bringing up the UI after OpenHab2 is running, subscribing from an external device, or serving up the Vue frontend on the local network for development purposes.
I haven't noticed this bug in the past so I think it may be a regression since the v1.2 refactoring.

@gulliverrr
Copy link
Contributor

I believe this is only true when openHAB first starts. Once it starts and update is received (temperature changes) then the last value is "retain"ed on that topic so whenever afterwards someone subscribes to that topic, they will receive the latest value. @rkoshak am I wrong?

@jaythomas
Copy link
Contributor Author

To replicate it, try running the frontend locally and giving it the ip of an already-running thermostat (MQTT_SERVER=192.168.1.23 yarn serve) and when you open the network tab you will see every request come through for initial parameters except temperature. The UI will display "0". Wait so many minutes until the temperature changes and you will receive the update, but like I mentioned it could display "0" for a very long time if the temperature does not fluctuate.

@rkoshak
Copy link
Contributor

rkoshak commented Oct 27, 2020

Jay's right. The retained flag isn't set. Given how ephemeral the temperature readings are I'm not sure the solution is to set the retained flag. If something goes wrong that temperature reading can become very old and there's no way to tell. This is unfortunate as the solution would be to just toggle the retained flag.

So, if we want to publish the updates even when they are the same, we need to change all the triggers in the "Synchronize Temp Proxies" rule to use received update instead of changed.

It'll take me a few days to get to this but it is not hard if either of you want to take a shot. All you need to do is create a new rule trigger for each of the Items using "received update" instead of "changed" and then delete the "changed" triggers.

Alternatively, stop openHAB and edit /var/lib/openhab2/jsondb/automation_rules.json and change the trigger types from core.ItemStateChangeTrigger to core.ItemStateUpdateTrigger for the rule triggers on that rule. Search for "Sync" to find the "Synchronize Temp Proxies" rule and the rule triggers will be in the JSON section above that.

All of the Temp proxy Items should change but I don't know about the setpoint Item triggers. Perhaps they can be kept as is.

@jaythomas
Copy link
Contributor Author

My hands are tied for the next 3 weeks unfortunately. I wouldn't say this is any rush either though. Outside of development it only becomes an issue when you want to set up a remote control for the thermostat (a touchscreen in another room running the ui). I haven't seen any other community members trying this yet.

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