Hello,
I want to setup a “virtual” sensor that is the difference between two measured temperatures that I would use for controlling a circulation pump in my heating system.
What I would like to do is ad sensor A that presents a temperature that is sensor X – sensor Y as an example.
Believe it or not I have tried to search for an answer but haven’t been able to find it.
Could someone point me in the right direction?
Kind regards,
Fredrik Mörner
m0wlheld
(Christoph Dahlen)
December 28, 2021, 12:06pm
2
Template Sensor , there is even an easily adoptable example on the page.
myle
(StePhan McKillen (Other kiwi Here))
December 28, 2021, 12:14pm
3
here
- platform: template
sensors:
lounge_factor:
friendly_name: Lounge Factor
value_template: >-
{%set temp_indoor = states.sensor.bt_lounge_temperature.state | float %}
{%set temp_fan = state_attr("climate.lounge_fan","temperature") %}
{% set factor = (temp_indoor - temp_fan) | int %}
{% if ((factor ) <= 0) %}
0
{% else %}
{{factor }}
{% endif %}
think of like this
{% = want to do some logic testing or some maths %}
{{ print the outcome}}
I use the above sensor
- id: b12c44a8-d707-4892-9f75-c84c6927dab4
alias: Lounge Fan Control
initial_state: true
trigger:
- entity_id: sensor.lounge_fact
platform: state
action:
- data_template:
entity_id: script.lounge_fan_{{ trigger.to_state.state }} #< run script base on temp diff
service: script.turn_on
then I have these scripts
lounge_fan_3:
alias: lounge fan Speed 3
sequence:
- service: mqtt.publish
data:
topic: cmnd/RF_Bridge_raw/Backlog
payload:
RFRAW AA B0 1E 03 08 017C 02E4 2620 28090909181818180909090909090909180909090909
55 RFRAW 0
- service: mqtt.publish
data:
topic: home/lounge-fan
payload: "3"
- service: mqtt.publish
data:
topic: home/lounge/fan/cmnd/FanSpeed
payload: "on"
mode: single
lounge_fan_2:
alias: lounge fan Speed 2
sequence:
- service: mqtt.publish
data:
topic: cmnd/RF_Bridge_raw/Backlog
payload:
RFRAW AA B0 1E 03 08 0172 02E4 2620 28090909181818180909090909090918090909090918
55 RFRAW 0
- service: mqtt.publish
data:
topic: home/lounge-fan
payload: "2"
- service: mqtt.publish
data:
topic: home/lounge/fan/cmnd/FanSpeed
payload: "on"
mode: single
lounge_fan_1:
alias: lounge fan Speed 1
sequence:
- service: mqtt.publish
data:
topic: cmnd/RF_Bridge_raw/Backlog
payload:
RFRAW AA B0 1E 03 08 0172 02E4 2620 28090909181818180909090909090918180909091809
55 RFRAW 0
- service: mqtt.publish
data:
topic: home/lounge-fan
payload: "1"
- service: mqtt.publish
data:
topic: home/lounge/fan/cmnd/FanSpeed
payload: "on"
mode: single
lounge_fan_0:
alias: lounge fan Speed 0
sequence:
- service: mqtt.publish
data:
topic: cmnd/RF_Bridge_raw/Backlog
payload:
RFRAW AA B0 1E 03 08 017C 02E4 2620 28090909181818180909090909090909090918181818
55 RFRAW 0
- service: mqtt.publish
data:
topic: home/lounge-fan
payload: "0"
- service: mqtt.publish
data:
topic: home/lounge/fan/cmnd/FanSpeed
payload: "off"
mode: single
Thanks and a happy new year!
1 Like