summaryrefslogtreecommitdiffstats
path: root/custom
diff options
context:
space:
mode:
Diffstat (limited to 'custom')
-rw-r--r--custom/scripts/play-playlist.yaml39
-rw-r--r--custom/scripts/sleep-and-wake.yaml16
-rw-r--r--custom/shell.yaml14
-rw-r--r--custom/template.yaml27
4 files changed, 70 insertions, 26 deletions
diff --git a/custom/scripts/play-playlist.yaml b/custom/scripts/play-playlist.yaml
index 719958c..0823878 100644
--- a/custom/scripts/play-playlist.yaml
+++ b/custom/scripts/play-playlist.yaml
@@ -91,6 +91,15 @@ play_playlist:
target:
entity_id: '{{ current }}'
+ - service: media_player.shuffle_set
+ data:
+ shuffle: true
+ entity_id: '{{ media_player }}'
+# - service: media_player.repeat_set
+# data:
+# repeat: all
+# entity_id: '{{ media_player }}'
+
- conditions:
- condition: template
value_template: '{{ list == "asgard" }}'
@@ -105,6 +114,15 @@ play_playlist:
enqueue: play
media_content_id: "upnp://4d696e69-444c-164e-9d41-3c7c3f4af5b0/64%240%246%243/"
+ - service: media_player.shuffle_set
+ data:
+ shuffle: true
+ entity_id: '{{ media_player }}'
+# - service: media_player.repeat_set
+# data:
+# repeat: all
+# entity_id: '{{ media_player }}'
+
- conditions:
- condition: template
value_template: '{{ list == "download" }}'
@@ -119,6 +137,15 @@ play_playlist:
enqueue: play
media_content_id: "upnp://4d696e69-444c-164e-9d41-3c7c3f4af5b0/64%240%241%240/"
+ - service: media_player.shuffle_set
+ data:
+ shuffle: false
+ entity_id: '{{ media_player }}'
+# - service: media_player.repeat_set
+# data:
+# repeat: off
+# entity_id: '{{ media_player }}'
+
- conditions:
- condition: template
value_template: '{{ list == "custom" }}'
@@ -130,15 +157,3 @@ play_playlist:
- '{{ media_player }}'
data: '{{ custom }}'
-
- - service: media_player.shuffle_set
- data:
- shuffle: true
- target:
- entity_id: '{{ media_player }}'
-
- - service: media_player.repeat_set
- data:
- repeat: true
- target:
- entity_id: '{{ media_player }}'
diff --git a/custom/scripts/sleep-and-wake.yaml b/custom/scripts/sleep-and-wake.yaml
index c8e180d..0fe478d 100644
--- a/custom/scripts/sleep-and-wake.yaml
+++ b/custom/scripts/sleep-and-wake.yaml
@@ -36,9 +36,12 @@ sleep_and_wake:
value_template: '{{ mode == "sleep" }}'
sequence:
- parallel:
+ - service: scene.turn_on
+ target:
+ entity_id: scene.lg_aircon_power_off
- service: switch.turn_off
target:
- entity_id: switch.smart_power_strip_pro_socket_1
+ entity_id: switch.smart_power_strip_pro_socket_2
- service: switch.turn_off
target:
entity_id: switch.living_lights_right
@@ -60,7 +63,7 @@ sleep_and_wake:
# entity_id: switch.plugs_office
- service: switch.turn_off
target:
- entity_id: switch.smart_power_strip_pro_socket_1
+ entity_id: switch.smart_power_strip_pro_socket_2
- service: switch.turn_off
target:
entity_id: switch.living_lights_right
@@ -104,6 +107,13 @@ sleep_and_wake:
value_template: '{{ mode == "sleep" }}'
sequence:
- parallel:
+ - service: script.bedroom_aircon_off
+# - service: scene.turn_on
+# target:
+# entity_id: scene.hyundai_aircon2_off
+ - service: scene.turn_on
+ target:
+ entity_id: scene.lg_aircon_power_off
# Wait until we fix both sleep and WOL on laptop
# - service: switch.turn_off
# target:
@@ -113,7 +123,7 @@ sleep_and_wake:
entity_id: media_player.smartpi
- service: switch.turn_off
target:
- entity_id: switch.smart_power_strip_pro_socket_1
+ entity_id: switch.smart_power_strip_pro_socket_2
- service: switch.turn_off
target:
entity_id: switch.lights_all
diff --git a/custom/shell.yaml b/custom/shell.yaml
index 6c05d1b..a890c80 100644
--- a/custom/shell.yaml
+++ b/custom/shell.yaml
@@ -1,2 +1,12 @@
-sound_combined: 'ssh -i /config/keys/id_rsa csa@localhost pacmd set-default-sink combined'
-sound_living: 'ssh -i /config/keys/id_rsa csa@localhost pacmd set-default-sink 0'
+sound_kitchen_on: "ssh -i /config/keys/id_rsa csa@localhost /opt/scripts/multiroom.sh kitchen on"
+sound_kitchen_off: "ssh -i /config/keys/id_rsa csa@localhost /opt/scripts/multiroom.sh kitchen off"
+sound_kitchen_switch: "ssh -i /config/keys/id_rsa csa@localhost /opt/scripts/multiroom.sh kitchen switch"
+sound_bedroom_on: "ssh -i /config/keys/id_rsa csa@localhost /opt/scripts/multiroom.sh bedroom on"
+sound_bedroom_off: "ssh -i /config/keys/id_rsa csa@localhost /opt/scripts/multiroom.sh bedroom off"
+sound_bedroom_switch: "ssh -i /config/keys/id_rsa csa@localhost /opt/scripts/multiroom.sh bedroom switch"
+sound_living: "ssh -i /config/keys/id_rsa csa@localhost /opt/scripts/multiroom.sh living on"
+
+
+#sound_combined: "ssh -i /config/keys/id_rsa csa@localhost '(pacmd set-default-sink combined; pacmd set-card-profile alsa_card.usb-0a12_Avantree_DG60_ABCDEF0123456789-00 output:iec958-stereo)'"
+#sound_living: "ssh -i /config/keys/id_rsa csa@localhost pacmd set-card-profile alsa_card.usb-0a12_Avantree_DG60_ABCDEF0123456789-00 off"
+#sound_living: 'ssh -i /config/keys/id_rsa csa@localhost pacmd set-default-sink 0'
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: >