YvaAfk
(Yva Afk)
October 25, 2024, 7:41am
1
Hi everyone,
I’m completely new to home assistant and using yaml.
I struggle with not being able to use “if, then, else”
Currently working on a dashboard.
I have the Tado thermostat valves installed which are able to detect open windows. In the dashboard I’ve set up the thermostat views and in the background I’ve got an automation which turns off a thermostat in a room for 15 minutes after an open window has been detected.
In that case the dashboard thermostat will show it’s been turned off but an off state automatically feeds into the panic mode of something’s not working I rather would like to show the open window information.
Currently for me, the only way to set this up would mean creating various cards for each possible combination, which is nuts.
You guys have any idea on how to do this smarter?
WallyR
(Wally)
October 25, 2024, 7:42am
2
The YAML code would be a big help
YvaAfk
(Yva Afk)
October 25, 2024, 7:54am
3
Of course frustration was too high to think of sending the code. Sorry about that.
The dashboard code is a mess as I started with the workaround of creating a card for each possibility. I also mostly used the visual editor so far, again completely new to yaml but eager to understand it.
The automations:
alias: "Window Open Bathroom "
description: ""
triggers:
- entity_id: binary_sensor.bathroom_window
from: "off"
to: "on"
trigger: state
conditions: []
actions:
- device_id: e7384cc3a3dada08bba7123c38f5f496
domain: climate
entity_id: 3f12b9905bbac26497d6ad1c235ce689
type: set_hvac_mode
hvac_mode: "off"
- delay:
hours: 0
minutes: 15
seconds: 0
milliseconds: 0
- device_id: e7384cc3a3dada08bba7123c38f5f496
domain: climate
entity_id: 3f12b9905bbac26497d6ad1c235ce689
type: set_hvac_mode
hvac_mode: auto
mode: single
alias: Window Open Bedroom
description: ""
triggers:
- entity_id: binary_sensor.bedroom_window
from: "off"
to: "on"
trigger: state
actions:
- device_id: 536bdd75f1e234e1d350c6ada0d5dae4
domain: climate
entity_id: 4bada1ead7a8964d288680e867e20177
type: set_hvac_mode
hvac_mode: "off"
- delay:
hours: 0
minutes: 15
seconds: 0
milliseconds: 0
- device_id: 536bdd75f1e234e1d350c6ada0d5dae4
domain: climate
entity_id: 4bada1ead7a8964d288680e867e20177
type: set_hvac_mode
hvac_mode: auto
mode: single
alias: Window Open Living Room
description: ""
triggers:
- entity_id:
- binary_sensor.living_room_window
from: "off"
to: "on"
trigger: state
conditions: []
actions:
- device_id: 7ae6c76fac30d2472db7c31e8129be42
domain: climate
entity_id: 8ac47d97feddec757d29fbfaf6b5496c
type: set_hvac_mode
hvac_mode: "off"
- delay:
hours: 0
minutes: 15
seconds: 0
milliseconds: 0
- device_id: 7ae6c76fac30d2472db7c31e8129be42
domain: climate
entity_id: 8ac47d97feddec757d29fbfaf6b5496c
type: set_hvac_mode
hvac_mode: auto
mode: single
The dashboard:
views:
- title: Home
badges: []
cards:
- square: true
type: grid
cards:
- type: thermostat
entity: climate.bathroom
show_current_as_primary: true
features:
- type: climate-hvac-modes
- type: thermostat
entity: climate.bedroom
show_current_as_primary: true
features:
- type: climate-hvac-modes
- type: thermostat
entity: climate.living_room
show_current_as_primary: true
features:
- type: climate-hvac-modes
- type: conditional
conditions:
- condition: state
entity: binary_sensor.bathroom_window
state: 'on'
card:
type: grid
cards:
- type: entity
entity: binary_sensor.bathroom_window
state_color: false
- type: thermostat
entity: climate.bedroom
features:
- type: climate-hvac-modes
- type: thermostat
entity: climate.living_room
features:
- type: climate-hvac-modes
- type: thermostat
entity: climate.office
show_current_as_primary: true
features:
- type: climate-hvac-modes
WallyR
(Wally)
October 25, 2024, 9:01am
4
You could try a markdown card, which is very versatile.
Below is an example:
And MDI icons can be found here:
https://pictogrammers.github.io/@mdi/font/5.4.55/
- type: markdown
content: >
<center>Bathroom:
{%- if (states('binary_sensor.bathroom_window') == 'on') -%}
<font color="red"><ha-icon icon="mdi:window-open-variant">
{%- if (states('binary_sensor.bathroom_window') == 'off') -%}
<font color="green"><ha-icon icon="mdi:window-closed-variant">
{%- else -%}
<font color="yellow">What is happening here???
{%- endif -%}
</ha-icon></font>
</center>