Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

changing probe, state of the entity is not changing to zero or to 'unknown'. #6

Closed
rhamar opened this issue Feb 26, 2019 · 5 comments
Closed
Assignees
Labels
enhancement New feature or request

Comments

@rhamar
Copy link

rhamar commented Feb 26, 2019

Another problem I have is when changing from probe, for example from 2 tot 3. The state of the entity is not changing to zero or to 'unknown'. The last measured temp on probe 2 is still showing.

image

@souhl
Copy link

souhl commented Feb 26, 2019

My guess is that it just shows the last value received. (Wherever you display the values)
When a probe is just removed it should be the same, as only new values are shown. If the displaying entity is never receiving a „unknown“ value it won’t display it by its own. A solution might be to send one „unknown“ state message after a period of time not receiving new values from the probe.

@rhamar
Copy link
Author

rhamar commented Mar 2, 2019

So what I found is that the MQTT client will not send information to the MQTT broker when no probe is connected.

I did a little deep dive.

igrill.py, line 153:
temps[probe_num] = float(temp) if float(temp) != 63536.0 else "False"

/usr/local/lib/python2.7/dist-packages/paho/mqtt/publish.py, line 168:
payload : the payload to be published. If "" or None, a zero length payload will be published.

If you want the mqtt client to send a message with a payload with no probe connected, you should change line 153 into the following:
temps[probe_num] = float(temp) if float(temp) != 63536.0 else "None"

And that did the trick (see screenshot). Now I have to modify Home Assistent so it can handle this value.

image

To be continued

@bendikwa
Copy link
Owner

This was by design when I implemented it.
I am not using Home Assistent for this project (I am using Prometheus/Grafana), and changing this would brake my setup, but I will consider making behaviour for disconnected probes configurable in a future release.

@bendikwa bendikwa self-assigned this Aug 24, 2019
@bendikwa bendikwa added the enhancement New feature or request label Aug 24, 2019
@bendikwa
Copy link
Owner

Better late than never: ;-)

I have added a new feature for this now:
Device config now takes 2 new optional flags.

publish_missing_probes: False                    # Optional default False - Enable sending a value for non-connected probes
missing_probe_value:    'missing'                # Optional default 'missing' - Value to send if publish_missing_probes is True

-Bendik

@PaulAntonDeen
Copy link

Works wonders! Tanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants