Trust
1
Hello people,
I am currently testing Home Assistant on a Raspberry. This is really fun.
Unfortunately I already have a problem with my second sensor.
One sensor compares the outside temperature with the inside temperature. This works.
The second sensor should simply round the decimal places. Unfortunately, this does not work. The sensor does not show me.
Unfortunately, I can not find my mistake.
# Loads default set of integrations. Do not remove.
default_config:
my: 192.168.179.3:8123
frontend:
themes: !include_dir_merge_named themes
# Text to speech
tts:
- platform: google_translate
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
home_connect:
client_id: XXXXX
client_secret: xxxxx
template:
- sensor:
- name: "Govee Wohnzimmer"
unit_of_measurement: "°C"
state: >-
{{ ( states('sensor.govee_wohnzimmer_temperature')|float(0) )|round(2) }}
template:
- sensor:
- name: "Temperature Difference"
unit_of_measurement: "°C"
state: >-
{{ ( states('sensor.openweathermap_temperature')|float(0) - states('sensor.govee_wohnzimmer_temperature')|float(0) )|round(2) }}
I hope you can help me
nickrout
(Nick Rout)
2
Don’t put template: twice
Trust
3
i understand. thank you!
With “template” I define a complete section.
Does it only apply to sensors or can I proceed directly with switches?
Does it have to look like this?
template:
- sensor:
- name: "Govee Wohnzimmer"
unit_of_measurement: "°C"
state: >-
{{ ( states('sensor.govee_wohnzimmer_temperature')|float(0) )|round(2) }}
- sensor:
- name: "Temperature Difference"
unit_of_measurement: "°C"
state: >-
{{ ( states('sensor.openweathermap_temperature')|float(0) - states('sensor.govee_wohnzimmer_temperature')|float(0) )|round(2) }}
switch:
- platform: template
switches:
blind:
friendly_name: "Blind"
value_template: "{{ is_state_attr('switch.blind_toggle', 'sensor_state', 'on') }}"
turn_on:
service: switch.toggle
target:
entity_id: switch.blind_toggle
turn_off:
service: switch.toggle
target:
entity_id: switch.blind_toggle
tom_l
4
No, like this:
template:
- sensor:
- name: "Govee Wohnzimmer"
unit_of_measurement: "°C"
state: >-
{{ ( states('sensor.govee_wohnzimmer_temperature')|float(0) )|round(2) }}
- name: "Temperature Difference"
unit_of_measurement: "°C"
state: >-
{{ ( states('sensor.openweathermap_temperature')|float(0) - states('sensor.govee_wohnzimmer_temperature')|float(0) )|round(2) }
Trust
5
Ok perfect. Thank you very much.
I will test it this afternoon