mirror of
https://github.com/GeorgeSG/sarah.git
synced 2026-06-17 01:52:58 +00:00
Use iif
This commit is contained in:
@@ -48,13 +48,7 @@ automation:
|
|||||||
- service: light.turn_on
|
- service: light.turn_on
|
||||||
data_template:
|
data_template:
|
||||||
entity_id: light.master_bedroom_main
|
entity_id: light.master_bedroom_main
|
||||||
brightness_pct: >-
|
brightness_pct: "{{ is_state('input_select.bedroom_mode', 'day') | iif(100, 40) }}"
|
||||||
|
|
||||||
{% if not is_state('input_select.bedroom_mode', 'day') %}
|
|
||||||
40
|
|
||||||
{% else %}
|
|
||||||
100
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
button_1_triple:
|
button_1_triple:
|
||||||
- service: light.turn_off
|
- service: light.turn_off
|
||||||
@@ -68,13 +62,7 @@ automation:
|
|||||||
entity_id:
|
entity_id:
|
||||||
- light.bedside
|
- light.bedside
|
||||||
- light.bed_led
|
- light.bed_led
|
||||||
brightness_pct: >-
|
brightness_pct: "{{ is_state('input_select.bedroom_mode', 'day') | iif(100, 40) }}"
|
||||||
|
|
||||||
{% if not is_state('input_select.bedroom_mode', 'day') %}
|
|
||||||
40
|
|
||||||
{% else %}
|
|
||||||
100
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
button_3_single:
|
button_3_single:
|
||||||
- service: media_player.media_play_pause
|
- service: media_player.media_play_pause
|
||||||
|
|||||||
@@ -30,13 +30,11 @@ automation:
|
|||||||
{% elif is_state('input_select.bedroom_mode', 'bed') %}
|
{% elif is_state('input_select.bedroom_mode', 'bed') %}
|
||||||
light.bedside
|
light.bedside
|
||||||
{% endif %}
|
{% endif %}
|
||||||
brightness_pct: >-
|
brightness_pct: "{{ is_state('input_select.bedroom_mode', 'night') | iif(40, 100)}}"
|
||||||
{% if is_state('input_select.bedroom_mode', 'night') %} 40 {% else %} 100 {% endif %}
|
|
||||||
|
|
||||||
- service: script.bed_led_toggle
|
- service: script.bed_led_toggle
|
||||||
data_template:
|
data_template:
|
||||||
brightness_pct: >-
|
brightness_pct: "{{ is_state('input_select.bedroom_mode', 'night') | iif(40, 100)}}"
|
||||||
{% if is_state('input_select.bedroom_mode', 'night') %} 40 {% else %} 100 {% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
double_click:
|
double_click:
|
||||||
@@ -46,8 +44,7 @@ automation:
|
|||||||
brightness_pct: 100
|
brightness_pct: 100
|
||||||
- service: script.bed_led_toggle
|
- service: script.bed_led_toggle
|
||||||
data_template:
|
data_template:
|
||||||
brightness_pct: >-
|
brightness_pct: "{{ is_state('input_select.bedroom_mode', 'night') | iif(40, 100)}}"
|
||||||
{% if is_state('input_select.bedroom_mode', 'night') %} 40 {% else %} 100 {% endif %}
|
|
||||||
|
|
||||||
hold:
|
hold:
|
||||||
- service: input_select.select_next
|
- service: input_select.select_next
|
||||||
|
|||||||
@@ -79,11 +79,7 @@ sensor:
|
|||||||
friendly_name: Function
|
friendly_name: Function
|
||||||
value_template: "{{ state_attr('fan.philips_airpurifier', 'function') }}"
|
value_template: "{{ state_attr('fan.philips_airpurifier', 'function') }}"
|
||||||
icon_template: >-
|
icon_template: >-
|
||||||
{% if state_attr('fan.philips_airpurifier', 'function') == 'Purification' %}
|
{{ state_attr('fan.philips_airpurifier', 'function') == 'Purification' | iif('mdi:air-purifier', 'mdi:air-humidifier') }}
|
||||||
{{ 'mdi:air-purifier' }}
|
|
||||||
{% else %}
|
|
||||||
{{ 'mdi:air-humidifier' }}
|
|
||||||
{% endif %}
|
|
||||||
purifier_pre_filter:
|
purifier_pre_filter:
|
||||||
friendly_name: Pre-filter
|
friendly_name: Pre-filter
|
||||||
unit_of_measurement: "Hrs"
|
unit_of_measurement: "Hrs"
|
||||||
@@ -160,11 +156,7 @@ script:
|
|||||||
entity_id: fan.philips_airpurifier
|
entity_id: fan.philips_airpurifier
|
||||||
data_template:
|
data_template:
|
||||||
function: >-
|
function: >-
|
||||||
{% if state_attr('fan.philips_airpurifier', 'function') == 'Purification' %}
|
{{ state_attr('fan.philips_airpurifier', 'function') == 'Purification' | iif('Purification & Humidification', 'Purification') }}
|
||||||
{{ 'Purification & Humidification' }}
|
|
||||||
{% else %}
|
|
||||||
{{ 'Purification' }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
automation:
|
automation:
|
||||||
- alias: Purifier · On start · Sync and update state
|
- alias: Purifier · On start · Sync and update state
|
||||||
|
|||||||
@@ -25,25 +25,13 @@ automation:
|
|||||||
- service: light.toggle
|
- service: light.toggle
|
||||||
data_template:
|
data_template:
|
||||||
entity_id: light.living_room_main
|
entity_id: light.living_room_main
|
||||||
brightness_pct: >-
|
brightness_pct: "{{ is_state('sensor.house_mode', 'night') | iif(40, 100) }}"
|
||||||
|
|
||||||
{% if is_state('sensor.house_mode', 'night') %}
|
|
||||||
40
|
|
||||||
{% else %}
|
|
||||||
100
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
double_click:
|
double_click:
|
||||||
- service: light.toggle
|
- service: light.toggle
|
||||||
data_template:
|
data_template:
|
||||||
entity_id: light.living_room_ambient
|
entity_id: light.living_room_ambient
|
||||||
brightness_pct: >-
|
brightness_pct: "{{ is_state('sensor.house_mode', 'night') | iif(40, 100) }}"
|
||||||
|
|
||||||
{% if is_state('sensor.house_mode', 'night') %}
|
|
||||||
40
|
|
||||||
{% else %}
|
|
||||||
100
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
hold:
|
hold:
|
||||||
- service: media_player.media_play_pause
|
- service: media_player.media_play_pause
|
||||||
|
|||||||
@@ -12,11 +12,7 @@ binary_sensor:
|
|||||||
value_template: >-
|
value_template: >-
|
||||||
{{ is_state("binary_sensor.titanium_ping", "on") }}
|
{{ is_state("binary_sensor.titanium_ping", "on") }}
|
||||||
icon_template: >-
|
icon_template: >-
|
||||||
{% if is_state("binary_sensor.titanium_ping", "on") %}
|
{{ is_state("binary_sensor.titanium_ping", "on") | iif(' mdi:desktop-mac-dashboard', 'mdi:desktop-mac') }}
|
||||||
mdi:desktop-mac-dashboard
|
|
||||||
{% else %}
|
|
||||||
mdi:desktop-mac
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
- platform: mqtt
|
- platform: mqtt
|
||||||
name: "Titanium playing"
|
name: "Titanium playing"
|
||||||
@@ -163,12 +159,7 @@ switch:
|
|||||||
turn_off:
|
turn_off:
|
||||||
service: script.titanium_shutdown
|
service: script.titanium_shutdown
|
||||||
icon_template: >-
|
icon_template: >-
|
||||||
|
{{ is_state('binary_sensor.titanium', 'on') | iif('mdi:monitor-dashboard', 'mdi:monitor-off') }}
|
||||||
{% if is_state('binary_sensor.titanium', 'on') %}
|
|
||||||
mdi:monitor-dashboard
|
|
||||||
{% else %}
|
|
||||||
mdi:monitor-off
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
titanium_start:
|
titanium_start:
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ script:
|
|||||||
sequence:
|
sequence:
|
||||||
- condition: and
|
- condition: and
|
||||||
conditions:
|
conditions:
|
||||||
- condition: "{{ states('sensor.multisensor_6_temperature')|float > states('input_number.toshiba_trigger_temp')|float }}"
|
- "{{ states('sensor.multisensor_6_temperature')|float > states('input_number.toshiba_trigger_temp')|float }}"
|
||||||
- condition: numeric_state
|
- condition: numeric_state
|
||||||
entity_id: sensor.dark_sky_apparent_temperature
|
entity_id: sensor.dark_sky_apparent_temperature
|
||||||
above: 23
|
above: 23
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ binary_sensor:
|
|||||||
friendly_name: Milena Preferences
|
friendly_name: Milena Preferences
|
||||||
value_template: "{{ is_state('device_tracker.iphone_de_yovcheva', 'home') }}"
|
value_template: "{{ is_state('device_tracker.iphone_de_yovcheva', 'home') }}"
|
||||||
icon_template: >
|
icon_template: >
|
||||||
{% if is_state('device_tracker.iphone_de_yovcheva', 'home') %} mdi:star-settings
|
{{
|
||||||
{% else %} mdi:star-settings-outline
|
is_state('device_tracker.iphone_de_yovcheva', 'home')
|
||||||
{% endif %}
|
| iif('mdi:star-settings', 'mdi:star-settings-outline')
|
||||||
|
}}
|
||||||
|
|
||||||
automation:
|
automation:
|
||||||
- alias: Preferences · Milena · Enable
|
- alias: Preferences · Milena · Enable
|
||||||
|
|||||||
Reference in New Issue
Block a user