That would depend on how they are connected to Home Assistant. Are you using MQTT?
If so, simply set the LWT messages as blank.
That would depend on how they are connected to Home Assistant. Are you using MQTT?
If so, simply set the LWT messages as blank.
Dear tom,
thanks for your quick response. Currently I am not connected via MQTT since I have been playing around with the Shelly-integrated cloud features recently.
Is there also an easy solution without MQTT?
Thanks in advance and kind regards,
Roman.
Is there also an easy solution without MQTT?
I don’t use the cloud so I don’t know, sorry.
You could create a template sensor that uses the status of the original sensor to determine what it displays as the value - if the sensor status is actually working then use the actual value otherwise use the old value.
here is an example that you can modify to your needs:
- platform: template
sensors:
nws_alert_count_filtered:
friendly_name: NWS Alert Count
entity_id: sensor.nws_alert_count_raw
value_template: >
{% if is_state('sensor.nws_alert_count_raw', 'unavailable') or is_state('sensor.nws_alert_count_raw', 'unknown') %}
{{ states.sensor.nws_alert_count_filtered.state }}
{% else %}
{{ states.sensor.nws_alert_count_raw.state }}
{% endif %}
Dear finity,
thanks for the suggestion. I will try it later today.
If I understand correctly, this if statement should also work if the entity does not exist? I am asking because when the sensor is in sleep mode and thus disconnected from WiFi, HA reports “Entity is not available: shelly_flood”.
Kind regards!
Hi!
Great, thanks for pointing me to your discovery script! I have definitely try it.
Kind regards!
the template as written above won’t but you can add another clause to check if the entity isn’t defined which will return true if the entity doesn’t exist:
{% if states.sensor.your_shelly.state is not defined or is_state('sensor.your_shelly', 'unavailable') or is_state('sensor.your_shelly', 'unknown') %}
Thanks again for all the feedback! I have adjusted and tested all suggestions and they all worked flawlessly. I have not decided yet which one I will use in the long term. This decision will most likely be made based on my future Shelly purchases.
Kind regards!
Good evening!
One quick question to a related problem: I own a couple of AVM FRITZ!DECT 200 smart plugs which work fine. They comprise smart plug functionality with power monitoring and temperature sensing. The power filter attribute is called “current_power_w” as usual. Unfortunately, if the switch in the plug is turned off, this filter attribute disappears in HA yielding to an error message in a card displaying this value. Is there a trick similar to the one above posted by finity to just display the value zero when the switch is turned off?
Thanks in advance!
Dear all,
did anyone successfully integrate shelly flood without MQTT?
Could you share your experience?
Regards,
xwox
Hello,
continuing this fred…
i recently bought a Shelly and setup mqtt as following:
sensor:
- platform: mqtt
state_topic: "shellies/shellyflood-7659D2/sensor/temperature"
name: "Wassersensor Keller Temp"
unit_of_measurement: "°C"
device_class: temperature
- platform: mqtt
state_topic: "shellies/shellyflood-7659D2/sensor/battery"
name: "Wassersensor Keller Batterie"
unit_of_measurement: "%"
device_class: battery
binary_sensor:
- platform: mqtt
state_topic: "shellies/shellyflood-7659D2/sensor/flood"
name: "Wassersensor Keller"
#icon: mdi:pipe-leak
payload_on: "true"
payload_off: "false"
device_class: moisture
Note: you must adjust the state-topic, i used the following command on SSH command line to get the correct values:
mosquitto_sub -h 192.168.178.45 -u <user> -P <password> --insecure -t 'shellies/#' -v
Shelly is correctly reporting the values into mqtt. During the flodding, it sounds the speaker and during that time, the last of above values is correctly set o “true”
The only thing i am currently still struggling around is that the Push notification is not working correctly - but i am far away from beeing an expert in automations as i did only a few so far. Here’s my config, mybe s.o. can point me into right direction here?
- alias: "Water alarm"
trigger:
platform: state
entity_id:
- binary_sensor.watersensor1_shelly
from: 'Off'
to: 'On'
action:
service: notify.pushover
data_template:
title: "Alarm! Water Alarm!"
message: "Water detected!"
Thanks
/ Ralf
Thx @Ralf. I used your example of the binary_sensor to fix a bug in my configuration. I forgot to use the quotation marks in payload_on: "true"
. It worked on other sensors, but not for Shelly.
I don’t know if you got your push notification working already, but I noticed capital casing in your sensor values. Maybe from: 'off'
and to: 'on'
fixes it? And/or leave the from
out completely because you’ll miss an update from status unknown
to status on
.
Hello,
sorry for late reply.
Unfortunately i did not had time validating it. Must really do it soon.
Thanks for your note and tipps, will try it and give feedback.
/ Ralf
Sorry for the very late reply.
Thanks for your tips, helped me make it work.
For whoever is interested here my current automation:
- alias: "Water_leak"
trigger:
platform: state
entity_id:
- binary_sensor.wassersensor_keller
# from: 'off'
to: 'on'
action:
service: notify.pushover
data_template:
title: "Alarm! Water!"
message: "Water leak!"
/ Ralf
hi, i have this code to copy the temperature of my flodd into new entity
it is ok?
Thanks
It’s hard to tell since you didn’t correctly format your code by putting three back-ticks (```) on the line before and after the code block.
but it looks OK syntactically except that the “entity_id:” line needs removed because that option is deprecatated and is no longer needed.
But logically, I’m not so sure.
I can’t see how you are getting the temperature of the flood sensor.
It looks like you are just using the state of the flood sensor in the new sensor. But I would think that the state of a flood sensor would likely be “wet” or “dry” or something more binary.
If the state of the flood sensor actually is the temperature then I’m not sure why you need to create a different sensor for temperature if you already have it.
You probably would need to use an attribute of the flood sensor that reports temperature instead.
But (I seem to say “but” a lot…) I don’t have your entities so I can’t really say for sure.
Excuse me
my sensor is
sensor.shelly_shwt_1_c8b0b9_temperature
I would like to copy the last temperature detected on another sensor, just to display it in a tab.
If the sensor sleeps, I have the entity disconnected.
How can I do?
I’m using the Shelly flood via MQTT, static IP, no cloud, but for the rest it’s default settings.
I’ve found that it’s eaten through 3 batteries in 3 days?!?!
At first I thought I forgot to put it back to sleep, but nope, that wasn’t it.
Any ideas?
well, since you didn’t fix you code block formatting and based on that info then I’ll assume the following should work:
- platform: template
sensors:
shelly_flood_bagno_old:
friendly_name: Shelly Flood Bagno Filtrato
value_template: >
{% if is_state('sensor.shelly_shwt_1_c8b0b9_temperature', 'unavailable') or is_state('sensor.shelly_shwt_1_c8b0b9_temperature', 'unknown') %}
{{ states.sensor.shelly_flood_bagno_old.state }}
{% else %}
{{ states.sensor.shelly_shwt_1_c8b0b9_temperature.state }}
{% endif %}