#Return Unavailable or 0 when a sensor in a helper is offline

1 messages · Page 1 of 1 (latest)

mellow basalt
#

During power outages, my emporia integration (esphome) goes offline and the helper I made that includes it will report the last known value instead of showing 0. How can I make it show 0 or otherwise unavailable in the helper if it's offline?

mellow basalt
#

Also when the power comes back on, it counts everything all at once. I know how to fix that if it's a helper sensor but this is direct from esphome

wind locust
#

You need to be clear what you're doing. I don't know what entities you're using, what helpers you're using, how they are configured, etc.

keen juniper
mellow basalt
mellow basalt
keen juniper
mellow basalt
keen juniper
#

then there's nothing you can do

mellow basalt
#

welp

keen juniper
#

ok well you could take the power sensor and add your own left riemann integral sensor

mellow basalt
boreal orchid
#

Is there some method by which HA can detect the Emporia is actually offline? f.e. by checking if the emporia's ip is online or something? If so, you can use that information in a template sensor that normally returns the value from the emporia, but when the emporia is offline, the template sensor becomes unavailable.

keen juniper
mellow basalt
boreal orchid
#

Yes, for a template sensor you decide what value it should return: if the emporia is online: return the value from the emporia, if it is offline, make the sensor unavailable. Then, from that point on, in your automations, dashboards, etc. use the template sensor's value instead of the emporia's value.

mellow basalt
boreal orchid
#
  • Settings -> Helpers
  • Click the "+ Create helper" button
  • Select "Template" -> "Sensor"
  • Enter some name into the Name field
  • Enter into State field: {{ states('sensor.your_emporia_sensor_id_here') }}
  • Select the same unit of measurement that your emporia sensor has
  • Select same Device class that your emporia sensor has
  • Select same State Class that your emporia sensor has
  • Select your Emporia Device
  • Open Advanced options
  • Enter into the Availability template field: {{ is_state('sensor.your_emporia_deviceOnline_sensor_id', 'on') }}
  • Click the Submit button

You will have to provide the proper entity_ids for your setup.

mellow basalt
#

I''ll try