ironsheep / RPi-Reporter-MQTT2HA-Daemon

Linux service to collect and transfer Raspberry Pi data via MQTT to Home Assistant (for RPi Monitoring)
GNU General Public License v3.0
441 stars 62 forks source link

Option for setting mqtt not to retain state... #140

Open mattlward opened 4 months ago

mattlward commented 4 months ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] I would like to use your card in a conditional card, some of my pi's are not on all the time and I would like to be able to hide them from the dashboard when they are not up. I have set the conditional to be the following...

condition: state entity: sensor.rpi_ts_pi_home_rpi_monitor_ts_pi state_not: unavailable

Sorry, can't get this to format correctly...

But it never becomes unavailable as the data is retained from the last operational state. Describe the solution you'd like A clear and concise description of what you want to happen.

I would like to see the above sensor become unavailable after the duration of the polling interval is exceeded.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

I could maybe set up a ping sensor to decide when the unit is down.

Additional context Add any other context or screenshots about the feature request here.

bsimmo commented 4 months ago

Ideally you would use LWT, there is also something in the mqtt ha/entity spec that I half remember reading about to do this.

On Sun, 18 Feb 2024, 5:44 am mattlward, @.***> wrote:

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] I would like to use your card in a conditional card, some of my pi's are not on all the time and I would like to be able to hide them from the dashboard when they are not up. I have set the conditional to be the following...

condition: state entity: sensor.rpi_ts_pi_home_rpi_monitor_ts_pi state_not: unavailable

But it never becomes unavailable as the data is retained from the last operational state. Describe the solution you'd like A clear and concise description of what you want to happen.

I would like to see the above sensor become unavailable after the duration of the polling interval is exceeded.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

I could maybe set up a ping sensor to decide when the unit is down.

Additional context Add any other context or screenshots about the feature request here.

— Reply to this email directly, view it on GitHub https://github.com/ironsheep/RPi-Reporter-MQTT2HA-Daemon/issues/140, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACYAXN6MU4OMBF3HARU45U3YUGINBAVCNFSM6AAAAABDN4IHQGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE2DANZVGYYDONQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ironsheep commented 2 months ago

@bsimmo is correct. The daemon publishes .../status endpoints that contain the live up/down state [online|offline]. You should be able to condition your cards to hide if the status is not online.

The two endpoints look like this: {base_topic}/sensor/{sensor_name}/status {base_topic}/command/{sensor_name}/status