summaryrefslogtreecommitdiffstats
path: root/custom
diff options
context:
space:
mode:
Diffstat (limited to 'custom')
-rw-r--r--custom/binary_sensor.yaml1
-rw-r--r--custom/group.yaml10
-rw-r--r--custom/input_number.yaml37
-rw-r--r--custom/scripts/sleep-and-wake.yaml129
-rw-r--r--custom/template.yaml54
5 files changed, 231 insertions, 0 deletions
diff --git a/custom/binary_sensor.yaml b/custom/binary_sensor.yaml
new file mode 100644
index 0000000..350a40f
--- /dev/null
+++ b/custom/binary_sensor.yaml
@@ -0,0 +1 @@
+#binary_sensor:
diff --git a/custom/group.yaml b/custom/group.yaml
new file mode 100644
index 0000000..7815cce
--- /dev/null
+++ b/custom/group.yaml
@@ -0,0 +1,10 @@
+ master_phones:
+ name: "master_phones"
+ entities:
+ - device_tracker.legion8
+ - device_tracker.lm_g810
+
+ master_laptops:
+ name: "master_laptops"
+ entities:
+ - device_tracker.nyx
diff --git a/custom/input_number.yaml b/custom/input_number.yaml
new file mode 100644
index 0000000..0fd1307
--- /dev/null
+++ b/custom/input_number.yaml
@@ -0,0 +1,37 @@
+# Parameters for Bulbs
+#- input_number:
+ knob_office_current:
+ min: 0.0
+ max: 10.0
+ step: 1.0
+ initial: 0.0
+ knob_office_brightness0:
+ min: 0.0
+ max: 255.0
+ step: 25.0
+ initial: 255.0
+ knob_office_temperature0:
+ min: 2000.0
+ max: 6500.0
+ step: 500.0
+ initial: 6500.0
+ knob_office_hue0:
+ min: 0.0
+ max: 360.0
+ step: 20.0
+ initial: 0.0
+ knob_office_brightness1:
+ min: 0.0
+ max: 255.0
+ step: 25.0
+ initial: 255.0
+ knob_office_temperature1:
+ min: 2000.0
+ max: 6500.0
+ step: 500.0
+ initial: 6500.0
+ knob_office_hue1:
+ min: 0.0
+ max: 360.0
+ step: 20.0
+ initial: 0.0
diff --git a/custom/scripts/sleep-and-wake.yaml b/custom/scripts/sleep-and-wake.yaml
new file mode 100644
index 0000000..b737e8d
--- /dev/null
+++ b/custom/scripts/sleep-and-wake.yaml
@@ -0,0 +1,129 @@
+sleep_and_wake:
+ alias: "Sleep and Wake"
+ description: "Sleep, Hibernate, and Wake actions for Office and Complete House"
+ fields:
+ mode:
+ name: Mode
+ description: "Operation mode: Sleep is non-intrusive action while Hibernate aimed on maximum power-savings and security"
+ required: true
+ selector:
+ select:
+ options:
+ - hibernate
+ - sleep
+ - wake
+ target:
+ name: Target
+ description: "Area: Office or complete House (more areas might be added in future)"
+ required: true
+ selector:
+ select:
+ options:
+ - office
+ - house
+
+ mode: single
+
+ sequence:
+ - choose:
+ - conditions:
+ - condition: template
+ value_template: '{{ target == "office" }}'
+ sequence:
+ - choose:
+ - conditions:
+ - condition: template
+ value_template: '{{ mode == "sleep" }}'
+ sequence:
+ - parallel:
+ - service: switch.turn_off
+ target:
+ entity_id: switch.smart_power_strip_pro_socket_1
+ - service: switch.turn_off
+ target:
+ entity_id: switch.living_lights_right
+
+ - conditions:
+ - condition: template
+ value_template: '{{ mode == "hibernate" }}'
+ sequence:
+ - parallel:
+ - service: media_player.media_stop
+ target:
+ entity_id: media_player.smartpi
+# Wait until we fix both sleep and WOL on laptop
+# - service: switch.turn_off
+# target:
+# entity_id: switch.plugs_office
+ - service: switch.turn_off
+ target:
+ entity_id: switch.smart_power_strip_pro_socket_1
+ - service: switch.turn_off
+ target:
+ entity_id: switch.living_lights_right
+
+ - conditions:
+ - condition: template
+ value_template: '{{ mode == "wake" }}'
+ sequence:
+ - parallel:
+ - service: switch.turn_on
+ target:
+ entity_id: switch.plugs_office
+ - service: wake_on_lan.send_magic_packet
+ data:
+ mac: "e8:6a:64:7b:5d:0a"
+ - delay:
+ seconds: 2
+ - service: wake_on_lan.send_magic_packet
+ data:
+ mac: "e8:6a:64:7b:5d:0a"
+
+ - conditions:
+ - condition: template
+ value_template: '{{ target == "house" }}'
+ sequence:
+ - choose:
+ - conditions:
+ - condition: template
+ value_template: '{{ mode == "sleep" }}'
+ sequence:
+ - parallel:
+# Wait until we fix both sleep and WOL on laptop
+# - service: switch.turn_off
+# target:
+# entity_id: switch.plugs_office
+ - service: switch.turn_off
+ target:
+ entity_id: switch.smart_power_strip_pro_socket_1
+ - service: switch.turn_off
+ target:
+ entity_id: switch.lights_all
+ # Thats a better way to allow some time for leaving
+ - service: switch.turn_on
+ target:
+ entity_id: switch.hall_lights_right
+
+ - conditions:
+ - condition: template
+ value_template: '{{ mode == "hibernate" }}'
+ sequence:
+ - service: switch.turn_off
+ target:
+ entity_id:
+ - switch.lights_all
+ - switch.plugs_manual
+ - switch.plugs_controlled
+ - service: switch.turn_on
+ target:
+ entity_id: switch.hall_lights_right
+
+ - conditions:
+ - condition: template
+ value_template: '{{ mode == "wake" }}'
+ sequence:
+ - service: switch.turn_on
+ target:
+ entity_id:
+ - switch.plugs_kitchen
+ - switch.bedroom_bedsidelampsocket
diff --git a/custom/template.yaml b/custom/template.yaml
new file mode 100644
index 0000000..710b936
--- /dev/null
+++ b/custom/template.yaml
@@ -0,0 +1,54 @@
+# Manual lights
+
+- trigger:
+ - platform: state
+ entity_id: "switch.bedroom_bedsidelampsocket"
+ - platform: state
+ entity_id: "sensor.bedroom_bedsidelampsocket_power"
+ binary_sensor:
+ - name: "Bedroom/BedsideLamp"
+ device_class: light
+ state: >
+ {{ 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: >
+ {{ expand(states.switch.power_office) | 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')
+ | 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: >
+ {{ expand(states.switch.power_kitchen) | 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 Climate"
+ unit_of_measurement: "W"
+ state: >
+ {{ expand(states.switch.power_climate) | 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 Lights"
+ unit_of_measurement: "W"
+ state: >
+ {{ expand(states.switch.power_lights) | 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 }}
+