summaryrefslogtreecommitdiffstats
path: root/custom/template.yaml
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2023-06-23 04:44:16 +0400
committerSuren A. Chilingaryan <csa@suren.me>2023-06-23 04:44:16 +0400
commit2674a5226e13a68b1ee570aef552e78b7a7337b8 (patch)
treecaf3b55045249cd124717109a652506576ff2cfc /custom/template.yaml
parent756a33999df9255deb1c08a443a5621d94da0126 (diff)
downloadhass-2674a5226e13a68b1ee570aef552e78b7a7337b8.tar.gz
hass-2674a5226e13a68b1ee570aef552e78b7a7337b8.tar.bz2
hass-2674a5226e13a68b1ee570aef552e78b7a7337b8.tar.xz
hass-2674a5226e13a68b1ee570aef552e78b7a7337b8.zip
Massive update: Few fixes, more new integrations & extensions
Diffstat (limited to 'custom/template.yaml')
-rw-r--r--custom/template.yaml27
1 files changed, 18 insertions, 9 deletions
diff --git a/custom/template.yaml b/custom/template.yaml
index 710b936..f5c7c99 100644
--- a/custom/template.yaml
+++ b/custom/template.yaml
@@ -12,14 +12,6 @@
{{ is_state("switch.bedroom_bedsidelampsocket", "on") and ((states("sensor.bedroom_bedsidelampsocket_power") | float) > 1) }}
- sensor:
- - name: "Power SmartPI"
- unit_of_measurement: "W"
- state: >
- {% set readings = [ states('sensor.living_office_power'),
- states('sensor.office_shelftop_power') | float(0), states('sensor.office_shelfbottom_power') | float(0),
- states('sensor.office_table_power') | float(0), states('sensor.office_aircon_power') | float(0) ] %}
- {{ 'unavailable' if readings[0] == 'unavailable' else readings[0] | float - readings[1] - readings[2] - readings[3] - readings[4] }}
-
- name: "Power Office"
unit_of_measurement: "W"
state: >
@@ -27,12 +19,29 @@
| map('regex_replace','^switch(.*)$','sensor\\1_power') | map('expand') | map(attribute=0) | select("defined")
| selectattr('state','is_number') | map(attribute='state') | map('float') | list | sum }}
+
+# - name: "Power SmartPI"
+# unit_of_measurement: "W"
+# state: >
+# {% set readings = [ states('sensor.living_office_power'),
+# states('sensor.office_shelftop_power') | float(0), states('sensor.office_shelfbottom_power') | float(0),
+# states('sensor.office_table_power') | float(0), states('sensor.office_aircon_power') | float(0) ] %}
+# {{ 'unavailable' if readings[0] == 'unavailable' else readings[0] | float - readings[1] - readings[2] - readings[3] - readings[4] }}
+
+# - name: "Power Infrastructure"
+# unit_of_measurement: "W"
+# state: >
+# {{ states('sensor.power_smartpi') | float + expand(states.switch.power_infrastructure) | selectattr('state') | map(attribute='entity_id')
+# | map('regex_replace','^switch(.*)$','sensor\\1_power') | map('expand') | map(attribute=0) | select("defined")
+# | selectattr('state','is_number') | map(attribute='state') | map('float') | list | sum }}
+
- name: "Power Infrastructure"
unit_of_measurement: "W"
state: >
- {{ states('sensor.power_smartpi') | float + expand(states.switch.power_infrastructure) | selectattr('state') | map(attribute='entity_id')
+ {{ expand(states.switch.power_infrastructure) | selectattr('state') | map(attribute='entity_id')
| map('regex_replace','^switch(.*)$','sensor\\1_power') | map('expand') | map(attribute=0) | select("defined")
| selectattr('state','is_number') | map(attribute='state') | map('float') | list | sum }}
+
- name: "Power Kitchen"
unit_of_measurement: "W"
state: >