Is it possible to write the value of an entity only if another entity is on?
I have a watersensor which measure the temperature of water the whole time. So if the waterpump is off the temperature is falling because it stands still in the tube. When the pump goes on again the value of the sensor is correct after about 1 Minute. How can I snip out these points when the pump is off so that my history only shows valid data?
You can’t snip something out of the other sensor, but you could set up a number input helper (and give it the same unit of measure as the “real” sensor) and then setup an automation that would set the number input helper when the temperature changes and the pump is on. Maybe something like this:
description: ""
mode: single
triggers:
- trigger: numeric_state
entity_id:
- sensor.water_temperature
conditions:
- condition: state
entity_id: binary_sensor.pump
state: "on"
actions:
- action: number.set_value
metadata: {}
data:
value: "{{ sensor.water_temperature }}"
target:
entity_id: input_number.tracked_water_temperature
Alternatively, you should be able to create a template sensor that is triggered when the state of the other temperature sensor changes:
- triggers:
- trigger: numeric_state
entity_id: sensor.water_temperature
conditions:
- condition: state
entity_id: binary_sensor.pump
state: "on"
sensor:
- name: Tracked Water Temperature
unique_id: 0a7476cc-d6c1-40ba-8ae1-606518c3497a
state: "{{ states('sensor.water_temperature') }}"
unit_of_measurement: °F
I’m less sure I got the syntax right on this one though.
Thats very logical inputs… Thanks.
I try to figure it out… Its not that easy for me.