From 7089991005c3b93284e551ddf3fed67e069ad633 Mon Sep 17 00:00:00 2001 From: zorruno Date: Tue, 11 Oct 2022 15:40:40 +1300 Subject: [PATCH] Inital Commit --- automations.yaml | 0 automations/main_viera_tv_automations.yaml | 21 +++ automations/quiet_time_settings.yaml | 10 ++ automations/random_actions_security.yaml | 26 ++++ .../weekly_battery_notifications_check.yaml | 15 ++ .../zigbee_low_battery_notifications_2.yaml | 32 +++++ configuration.yaml | 61 ++++++++ customize.yaml | 9 ++ esphome/bt-fridge-temps.yaml | 135 ++++++++++++++++++ esphome/esp-leafbat2.yaml | 133 +++++++++++++++++ esphome/esp-mainovenmonitor.yaml | 129 +++++++++++++++++ esphome/esp-netcupfan2.yaml | 94 ++++++++++++ group/basement_lights.yaml | 9 ++ group/battery_levels.yaml | 30 ++++ group/family_presence.yaml | 6 + group/foxhole_lights.yaml | 15 ++ group/simulation_lights.yaml | 21 +++ groups.yaml | 1 + packages/appliance_status.yaml | 11 ++ packages/blind_control.yaml | 24 ++++ packages/cctv_controls.yaml | 6 + packages/covid_count.yaml | 35 +++++ packages/energy_readings.yaml | 21 +++ packages/firewall_control.yaml | 10 ++ packages/gas_heater_operation.yaml | 19 +++ packages/kogan_kettle.yaml | 55 +++++++ packages/media_players.yaml | 5 + packages/office_media_buttons.yaml | 62 ++++++++ packages/pet_feeding.yaml | 21 +++ packages/piano_practice.yaml | 45 ++++++ packages/presense_sense.yaml | 25 ++++ packages/recorder.yaml | 2 + packages/room_fan_control.yaml | 69 +++++++++ packages/tts.yaml | 4 + scenes.yaml | 0 scripts.yaml | 0 scripts/cctv_detect.yaml | 8 ++ scripts/check_config.yaml | 3 + scripts/office_mediaplayer.yaml | 6 + scripts/reload_lounge_browser.yaml | 7 + scripts/turn_light_on_for_random_time.yaml | 23 +++ sensor/coronavirus.yaml | 18 +++ sensor/google_keep.yaml | 6 + sensor/grocy.yaml | 26 ++++ sensor/internet_traffic.yaml | 20 +++ sensor/low_battery_template.yaml | 19 +++ sensor/power_monitoring.yaml | 6 + sensor/tautulli.yaml | 4 + sensor/tides.yaml | 6 + themes.yaml | 0 50 files changed, 1313 insertions(+) create mode 100644 automations.yaml create mode 100644 automations/main_viera_tv_automations.yaml create mode 100644 automations/quiet_time_settings.yaml create mode 100644 automations/random_actions_security.yaml create mode 100644 automations/weekly_battery_notifications_check.yaml create mode 100644 automations/zigbee_low_battery_notifications_2.yaml create mode 100644 configuration.yaml create mode 100644 customize.yaml create mode 100644 esphome/bt-fridge-temps.yaml create mode 100644 esphome/esp-leafbat2.yaml create mode 100644 esphome/esp-mainovenmonitor.yaml create mode 100644 esphome/esp-netcupfan2.yaml create mode 100644 group/basement_lights.yaml create mode 100644 group/battery_levels.yaml create mode 100644 group/family_presence.yaml create mode 100644 group/foxhole_lights.yaml create mode 100644 group/simulation_lights.yaml create mode 100644 groups.yaml create mode 100644 packages/appliance_status.yaml create mode 100644 packages/blind_control.yaml create mode 100644 packages/cctv_controls.yaml create mode 100644 packages/covid_count.yaml create mode 100644 packages/energy_readings.yaml create mode 100644 packages/firewall_control.yaml create mode 100644 packages/gas_heater_operation.yaml create mode 100644 packages/kogan_kettle.yaml create mode 100644 packages/media_players.yaml create mode 100644 packages/office_media_buttons.yaml create mode 100644 packages/pet_feeding.yaml create mode 100644 packages/piano_practice.yaml create mode 100644 packages/presense_sense.yaml create mode 100644 packages/recorder.yaml create mode 100644 packages/room_fan_control.yaml create mode 100644 packages/tts.yaml create mode 100644 scenes.yaml create mode 100644 scripts.yaml create mode 100644 scripts/cctv_detect.yaml create mode 100644 scripts/check_config.yaml create mode 100644 scripts/office_mediaplayer.yaml create mode 100644 scripts/reload_lounge_browser.yaml create mode 100644 scripts/turn_light_on_for_random_time.yaml create mode 100644 sensor/coronavirus.yaml create mode 100644 sensor/google_keep.yaml create mode 100644 sensor/grocy.yaml create mode 100644 sensor/internet_traffic.yaml create mode 100644 sensor/low_battery_template.yaml create mode 100644 sensor/power_monitoring.yaml create mode 100644 sensor/tautulli.yaml create mode 100644 sensor/tides.yaml create mode 100644 themes.yaml diff --git a/automations.yaml b/automations.yaml new file mode 100644 index 0000000..e69de29 diff --git a/automations/main_viera_tv_automations.yaml b/automations/main_viera_tv_automations.yaml new file mode 100644 index 0000000..1e38327 --- /dev/null +++ b/automations/main_viera_tv_automations.yaml @@ -0,0 +1,21 @@ +- id: "1630652622875" + alias: Turn off Main TV + description: "" + trigger: + - platform: mqtt + topic: viewroad-commands/maintv/action + payload: "OFF" + condition: [] + action: + #- type: toggle + # device_id: d75c9f1db62bd7d599394dfcacedfa61 + # entity_id: remote.viera_gt30_series + # domain: remote + - alias: "Send remote command (Power) to TV" + service: remote.send_command + data: + command: "Power" + target: + #device_id: d75c9f1db62bd7d599394dfcacedfa61 + entity_id: remote.viera_gt30_series + mode: single diff --git a/automations/quiet_time_settings.yaml b/automations/quiet_time_settings.yaml new file mode 100644 index 0000000..1247dff --- /dev/null +++ b/automations/quiet_time_settings.yaml @@ -0,0 +1,10 @@ +- id: quiet_time_settings_to_mqtt + alias: Publish quiet time value to mqtt + trigger: + platform: state + entity_id: input_boolean.quiet_time + action: + service: mqtt.publish + data_template: + payload: "{{trigger.to_state.state}}" + topic: viewroad-status/homeassistant/quiet-time diff --git a/automations/random_actions_security.yaml b/automations/random_actions_security.yaml new file mode 100644 index 0000000..e7bbbf6 --- /dev/null +++ b/automations/random_actions_security.yaml @@ -0,0 +1,26 @@ +- id: do_random_actions_when_away + alias: Activate Random Actions for Security + mode: parallel # Enable parallel executions + trigger: + - platform: time_pattern + minutes: /5 + condition: + alias: "Away routine active, nearly sunset, and all family not home" + condition: and + conditions: + - condition: sun + after: sunset + after_offset: -00:30:00 #30 mins before + - condition: state + entity_id: input_boolean.away_occupied_routine + state: "on" + - condition: state + entity_id: group.family_away + state: "not_home" + action: + service: script.light_duration + data: + # Pass randomly selected light from "group.simulation_lights" as script variable "light" + light: "{{states.group.simulation_lights.attributes.entity_id | random}}" + # random value between 5 & 29 + duration: "00:{{ '{:02}'.format(range(5,29) | random | int) }}:00" diff --git a/automations/weekly_battery_notifications_check.yaml b/automations/weekly_battery_notifications_check.yaml new file mode 100644 index 0000000..1b60125 --- /dev/null +++ b/automations/weekly_battery_notifications_check.yaml @@ -0,0 +1,15 @@ +- id: "1635929281159" + alias: Weekly Low battery level detection + description: "" + use_blueprint: + path: sbyx/low-battery-level-detection-notification-for-all-battery-sensors.yaml + input: + day: 1 + time: "21:00:00" + actions: + - service: notify.pushover_notifications + data: + message: > + Weekly Battery Check. Low Devices: + {{sensors}} + title: View Road Sensors diff --git a/automations/zigbee_low_battery_notifications_2.yaml b/automations/zigbee_low_battery_notifications_2.yaml new file mode 100644 index 0000000..b8e6c85 --- /dev/null +++ b/automations/zigbee_low_battery_notifications_2.yaml @@ -0,0 +1,32 @@ +- id: notify_if_batteries_are_low + alias: Daily alert that zigbee batteries Are Low + initial_state: true + trigger: + - platform: time + at: "19:00:00" + condition: + - condition: or + conditions: + - condition: template + value_template: > + {% set min_battery_level = 20 -%} + {% set ns = namespace(found=false) -%} + {% for entity_id in states.group.battery_levels.attributes.entity_id -%} + {% set parts = entity_id.split('.') -%} + {% if (states(entity_id) | replace("%","") | int) < min_battery_level -%} + {% set ns.found = true -%} + {% endif -%} + {% endfor -%} + {{ ns.found }} + action: + - service: notify.pushover_notifications + data: + title: View Road Sensors + message: > + {%- set min_battery_level = 20 -%} + {%- for entity_id in states.group.battery_levels.attributes.entity_id -%} + {%- set parts = entity_id.split('.') -%} + {%- if (states(entity_id) | replace("%","") | int) < min_battery_level -%} + {{ states[parts[0]][parts[1]].name }} level is {{ states(entity_id) }}%.{{ '\n' }} + {%- endif -%} + {%- endfor -%} diff --git a/configuration.yaml b/configuration.yaml new file mode 100644 index 0000000..b69732e --- /dev/null +++ b/configuration.yaml @@ -0,0 +1,61 @@ +# Configure a default setup of Home Assistant (frontend, api, etc) +default_config: + +frontend: + themes: !include_dir_merge_named themes + +homeassistant: + customize: !include customize.yaml + packages: !include_dir_named packages + +#group: !include groups.yaml +group: !include_dir_merge_named group/ +automation: !include_dir_merge_list automations/ +automation UI: !include automations.yaml +script: !include_dir_merge_named scripts/ +#script UI: !include scripts.yaml +scene: !include scenes.yaml +#mqtt merged: !include_dir_merge_named mqtt/ +#sensor merged: !include_dir_merge_list sensor/ +sensor: !include_dir_merge_list sensor/ + +logger: + default: info + logs: + custom_components.hacs: debug + custom_components.evnex: debug + evnex: debug + +# mqtt broker +#mqtt: +# broker: !secret mqtt1_broker +# port: !secret mqtt1_port + +device_tracker: + - platform: bluetooth_le_tracker + +input_boolean: + foxhole_occupied: + name: Foxhole Guest Occupied + icon: mdi:briefcase-plus-outline + quiet_time: + name: Quiet time for no notifications + icon: mdi:shield-moon + away_occupied_routine: + name: Automation for Lights etc when away + icon: mdi:shield-lock + +rest_command: + chores1_request: + url: !secret grocy_api_uri_chore6 + method: PUT + headers: + accept: "*/*" + GROCY-API-KEY: !secret grocy_api_key + content_type: "application/json" + payload: '{ + "name" : "{{ name }}" , + "next_execution_assigned_to_user_id" : "{{ assigned_to }}" + }' + # payload: '{"name" : "{{ name }}" , "next_estimated_execution_time" : "{{ next_time }}", "next_execution_assigned_to_user_id" : "{{ assigned_to }}" }' + verify_ssl: false diff --git a/customize.yaml b/customize.yaml new file mode 100644 index 0000000..fa5d031 --- /dev/null +++ b/customize.yaml @@ -0,0 +1,9 @@ +sensor.dryer_finished: + icon: mdi:tumble-dryer-alert +sensor.washing_machine_finished: + icon: mdi:washing-machine-alert +sensor.dishwasher_finished: + icon: mdi:dishwasher-alert +sensor.pets_fed: + friendly_name: Pets Fed + icon: mdi:paw diff --git a/esphome/bt-fridge-temps.yaml b/esphome/bt-fridge-temps.yaml new file mode 100644 index 0000000..ff03970 --- /dev/null +++ b/esphome/bt-fridge-temps.yaml @@ -0,0 +1,135 @@ +############################################# +# ESPHome +############################################# +esphome: + name: bt-fridge-temps + +############################################# +# Specific board for ESPHome device +############################################# +esp32: + board: nodemcu-32s + +############################################# +# ESPHome Logging Enable +############################################# +logger: + +############################################# +# Enable the Home Assistant API +############################################# +api: + encryption: + key: !secret bt-fridge-temps_api_key + +############################################# +# Enable Over the Air Update Capability +# Safe mode will detect boot loops +############################################# +ota: + safe_mode: true + password: !secret bt-fridge-temps_ota_pass + +############################################# +# Use Wifi +############################################# +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + # Details for fallback hotspot (captive portal) + # in case wifi connection fails + ap: + ssid: "Bt-Fridge-Temps Fallback Hotspot" + password: !secret fallback_ap_password + +############################################# +# Fallback captive portal +############################################# +captive_portal: + +############################################# +# Web Portal for display and monitoring +############################################# +web_server: + port: 80 + auth: + username: !secret web_server_username + password: !secret web_server_password + +############################################# +# MQTT Monitoring +############################################# +mqtt: + broker: !secret mqtt_server + topic_prefix: esphome/bt-fridge-temps + username: !secret mqtt_username + password: !secret mqtt_password + + +############################################# +############################################# +# MAIN SENSORS +############################################# +############################################# + + +############################################# +# Bluetooth +############################################# +bluetooth_proxy: + +esp32_ble_tracker: + +################################################################################### +## Help with Mi Bluetooth Temp Sensors +## Youtube Howto https://www.youtube.com/watch?v=l5ea7lQWpMk&t=0s +## https://pvvx.github.io/ATC_MiThermometer/TelinkMiFlasher.html +## https://esphome.io/components/sensor/xiaomi_ble.html?highlight=ble#lywsd03mmc +## Tasmota Info: https://tasmota.github.io/docs/Bluetooth/ +################################################################################### + +sensor: + - platform: xiaomi_lywsd03mmc + # ATC_DE944A + mac_address: "A4:C1:38:DE:94:4A" + #dummy bindkey + bindkey: "eef418daf699a0c188f3bfd17e4565d5" + temperature: + name: "Fridge Temperature (BTT01)" + humidity: + name: "Fridge Humidity (BTT01)" + battery_level: + name: "Fridge Monitor Battery Level (BTT01)" + - platform: xiaomi_lywsd03mmc + # ATC_B32B0C + mac_address: "A4:C1:38:B3:2B:0C" + #dummy bindkey + bindkey: "eef418daf699a0c188f3bfd17e4565d8" + temperature: + name: "Freezer Temperature (BTT02)" + humidity: + name: "Freezer Humidity (BTT02)" + battery_level: + name: "Freezer Monitor Battery Level (BTT02)" + - platform: xiaomi_lywsd03mmc + # ATC_D90603 + mac_address: "A4:C1:38:D9:06:03" + #dummy bindkey + bindkey: "eef418daf699a0c188f3bfd17e4565d7" + temperature: + name: "Lower Fridge Temperature (BTT03)" + humidity: + name: "Lower Fridge Humidity (BTT03)" + battery_level: + name: "Lower Fridge Battery Level (BTT03)" + - platform: xiaomi_lywsd03mmc + # ATC_81ECB0 + mac_address: "A4:C1:38:81:EC:B0" + #dummy bindkey + bindkey: "eef418daf699a0c188f3bfd17e4565d6" + temperature: + name: "Lower Freezer Temperature (BTT04)" + humidity: + name: "Lower Freezer Humidity (BTT04)" + battery_level: + name: "Lower Freezer Monitor Battery Level (BTT04)" diff --git a/esphome/esp-leafbat2.yaml b/esphome/esp-leafbat2.yaml new file mode 100644 index 0000000..1aed838 --- /dev/null +++ b/esphome/esp-leafbat2.yaml @@ -0,0 +1,133 @@ +############################################# +# Common +############################################# +substitutions: + devicename: esp-leafbat2 + nice_devicename: "Leaf Battery Monitor 2" + + +############################################# +# ESPHome +############################################# +esphome: + name: $devicename + +######################################## +# Specific board for ESPHome device +######################################## +esp8266: + board: d1_mini + +############################################# +# ESPHome Logging Enable +############################################# +logger: + +######################################## +# Enable the Home Assistant API +######################################## +api: + encryption: + key: !secret esp-leafbat2_api_key + +######################################## +# Enable Over the Air Update Capability +# Safe mode will detect boot loops +######################################## +ota: + safe_mode: true + password: !secret esp-leafbat2_ota_pass + +######################################## +# Use Wifi +# (credentials are in secrets file) +######################################## +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + # Details for fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Esp-Leafbat2 Fallback Hotspot" + password: !secret fallback_ap_password + # Static IP (for lower power/quicker on time) + manual_ip: + static_ip: !secret esp-leafbat2_static_ip + gateway: !secret esp-leafbat2_gateway + subnet: !secret esp-leafbat2_subnet + +############################################# +# Fallback captive portal +############################################# +captive_portal: + +######################################## +# Web Portal for display and monitoring +######################################## +web_server: + port: 80 + auth: + username: !secret web_server_username + password: !secret web_server_password + +######################################## +# MQTT Monitoring +######################################## +mqtt: + broker: !secret mqtt_server + topic_prefix: esphome/esp-leafbat2 + username: !secret mqtt_username + password: !secret mqtt_password + # + # Availability Topic + #birth_message: + # topic: esphome/esp-leafbat2/availability + # payload: online + #will_message: + # topic: esphome/esp-leafbat2/availability + # payload: offline + # A way to prevent deep sleep using MQTT command + on_message: + - topic: viewroad-commands/leafbat2/deepsleepoff + payload: 'ON' + then: + - deep_sleep.prevent: deep_sleep_1 + - topic: viewroad-commands/leafbat2/deepsleepon + payload: 'ON' + then: + - deep_sleep.enter: deep_sleep_1 + +######################################## +# Deep Sleep +######################################## +deep_sleep: + run_duration: 20s + sleep_duration: 10min + id: deep_sleep_1 + +############################################# +############################################# +# MAIN SENSORS +############################################# +############################################# +sensor: + # Quality of Wifi in dBm + - platform: wifi_signal + name: "WiFi Signal" + update_interval: 20s + retain: true + # Analog sensor for voltage reading (A0) + - platform: adc + pin: A0 + name: "Battery Voltage" + update_interval: 20s + retain: true + filters: + - multiply: 18.52 # trial and error calc/measure + - calibrate_linear: + - 5.99 -> 6.0 + - 11.98 -> 11.99 + - 16.98 -> 16.98 + +#name: "Battery Voltage" +# Optional variables: +#retain: true \ No newline at end of file diff --git a/esphome/esp-mainovenmonitor.yaml b/esphome/esp-mainovenmonitor.yaml new file mode 100644 index 0000000..6a3d615 --- /dev/null +++ b/esphome/esp-mainovenmonitor.yaml @@ -0,0 +1,129 @@ +############################################# +# ESPHome +############################################# +esphome: + name: "esp-mainovenmonitor" + +############################################# +# Specific board for ESPHome device +############################################# +esp8266: + board: sonoff_basic + +############################################# +# ESPHome Logging Enable +############################################# +# NOTE: Baudrate set to 0 as we are using the UART with PZEM +logger: + baud_rate: 0 + +############################################# +# Enable the Home Assistant API +############################################# +api: + encryption: + key: !secret esp-mainovenmonitor_api_key + +############################################# +# Enable Over the Air Update Capability +# Safe mode will detect boot loops +############################################# +ota: + safe_mode: true + password: !secret esp-mainovenmonitor_ota_pass + +############################################# +# Use Wifi +############################################# +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + # Details for fallback hotspot (captive portal) + # in case wifi connection fails + ap: + ssid: "Mainovenmonitor Fallback Hotspot" + password: !secret fallback_ap_password +# manual_ip: +# static_ip: 192.168.x.x +# gateway: 192.168.X.x +# subnet: 255.255.255.0 + +############################################# +# Fallback captive portal +############################################# +captive_portal: + +############################################# +# Web Portal for display and monitoring +############################################# +web_server: + port: 80 + auth: + username: !secret web_server_username + password: !secret web_server_password + +############################################# +# MQTT Monitoring +############################################# +mqtt: + broker: !secret mqtt_server + topic_prefix: esphome/esp-mainovenmonitor + username: !secret mqtt_username + password: !secret mqtt_password + + +############################################# +############################################# +# MAIN SENSORS +############################################# +############################################# +# PEZEM4 Power Monitoring +# https://esphome.io/components/sensor/pzemac.html +############################################# + +uart: + rx_pin: GPIO3 + tx_pin: GPIO1 + #tx_pin: RX + #rx_pin: TX + baud_rate: 9600 + stop_bits: 1 + +modbus: + +sensor: + - platform: pzemac + current: + name: "Main Oven Current" + voltage: + name: "Main Oven Voltage" + energy: + name: "Main Oven Energy" + power: + name: "Main Oven Power" + frequency: + name: "Main Oven Mains Frequency" + power_factor: + name: "Main Oven Power Factor" + update_interval: 10s + +######################################## +######################################## + +# Relay Output (on sonoff basic) +switch: + - platform: gpio + name: "Main Oven Disable" + pin: GPIO12 + +#button: +# - platform: restart +# name: "Main Oven ESPHome Restart" + + +# LED Flashes on errors or warnings +# https://esphome.io/components/status_led.html +status_led: + pin: + number: GPIO13 + inverted: true \ No newline at end of file diff --git a/esphome/esp-netcupfan2.yaml b/esphome/esp-netcupfan2.yaml new file mode 100644 index 0000000..4c14c1a --- /dev/null +++ b/esphome/esp-netcupfan2.yaml @@ -0,0 +1,94 @@ +############################################# +# ESPHome +############################################# +esphome: + name: esp-netcupfan2 + +######################################## +# Specific board for ESPHome device +######################################## +esp8266: + board: d1_mini + +############################################# +# ESPHome Logging Enable +############################################# +logger: + +############################################# +# Enable the Home Assistant API +############################################# +api: + encryption: + key: !secret esp-netcupfan2_api_key + +############################################# +# Enable Over the Air Update Capability +# Safe mode will detect boot loops +############################################# +ota: + safe_mode: true + password: !secret esp-netcupfan2_ota_pass + +############################################# +# Use Wifi +############################################# +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + # Details for fallback hotspot + # in case wifi connection fails + ap: + ssid: "Netcupfan2 Fallback Hotspot" + password: !secret fallback_ap_password + +############################################# +# Fallback captive portal +############################################# +captive_portal: + +############################################# +# Web Portal for display and monitoring +############################################# +web_server: + port: 80 + auth: + username: !secret web_server_username + password: !secret web_server_password + +############################################# +# MQTT Monitoring +############################################# +mqtt: + broker: !secret mqtt_server + topic_prefix: esphome/esp-netcupfan2 + username: !secret mqtt_username + password: !secret mqtt_password + +############################################# +############################################# +# MAIN SENSORS +############################################# +############################################# + +# Relay Output on a GPIO Pin +switch: + - platform: gpio + name: "Relay_Main" + pin: GPIO15 + +# Allows a fan control point in Home Assistant +fan: + - platform: speed + output: pwm_output + name: "Net Cupboard Fan 2 Speed" + speed_count: 500 + +# PWM Fan Output on the GPIO Pin +output: + - platform: esp8266_pwm + pin: GPIO16 + frequency: 25000 Hz + id: pwm_output + + \ No newline at end of file diff --git a/group/basement_lights.yaml b/group/basement_lights.yaml new file mode 100644 index 0000000..8a9fb79 --- /dev/null +++ b/group/basement_lights.yaml @@ -0,0 +1,9 @@ +basement_lights: + name: Basement Lights + entities: + - switch.tasmo_s4chan_4231_underhouselights_a + - switch.tasmo_s4chan_4231_underhouselights_b + - switch.tasmo_ks811t_7846_officelights2_a + - switch.tasmo_ks811t_7846_officelights2_b + - switch.tasmo_sdual_7681_officelights1_a + - switch.tasmo_sdual_7681_officelights1_b diff --git a/group/battery_levels.yaml b/group/battery_levels.yaml new file mode 100644 index 0000000..09ad98d --- /dev/null +++ b/group/battery_levels.yaml @@ -0,0 +1,30 @@ +battery_levels: + name: Battery Levels + entities: + # Smoke Detectors (CR123A) + #- sensor.main_lounge_smoke_detector_zsm01_battery + #- sensor.downstairs_lounge_lounge_smoke_detector_zsm02_battery + # Leak Detection (Button cell 2032) + - sensor.main_kitchen_sink_leak_zlk01_battery + - sensor.guest_bathroom_laundry_sink_leak_zlk02_battery + - sensor.basement_laundry_floor_leak_zlk03_battery + - sensor.downstairs_kitchen_sink_leak_zlk04_battery + # Temp, Humidity Sensors (Button cell 2032) + - sensor.master_bedroom_temperature_zth01_battery + - sensor.bedroom_2_temperature_zth02_battery + - sensor.bedroom_3_temperature_zth03_battery + - sensor.main_bathroom_temperature_zth04_battery + - sensor.storage_loft_temperature_zth05_battery + - sensor.downstairs_bedroom_1_temperature_zth06_battery + # Temp, Humidity Sensors (2x AAA Batteries) + - sensor.humidor_environment_zth07_battery + - sensor.main_kitchen_fridge_temp_zth08_battery + # Multisensor Sensors (2X CR123A OR 5V MicroUSB) + #- sensor.main_kitchen_multisensor_zms01_battery + - sensor.data_cupboard_multisensor_zms02_battery + # LCD Temp, Humidity Sensors (2x AAA Batteries) + - sensor.office_lcd_temperature_ztl01_battery + - sensor.master_bedroom_lcd_temperature_ztl02_battery + - sensor.downstairs_lounge_lcd_temperature_ztl03_battery + # Sonoff PIR (CR2450) + - sensor.piano_pir_zir01_battery diff --git a/group/family_presence.yaml b/group/family_presence.yaml new file mode 100644 index 0000000..3b98ea1 --- /dev/null +++ b/group/family_presence.yaml @@ -0,0 +1,6 @@ +family_away: + name: All Family Members Away + entities: + - !secret person_1 + - !secret person_2 + - !secret person_3 diff --git a/group/foxhole_lights.yaml b/group/foxhole_lights.yaml new file mode 100644 index 0000000..2886a33 --- /dev/null +++ b/group/foxhole_lights.yaml @@ -0,0 +1,15 @@ +foxhole_lights: + name: Foxhole Lights + # Doesn't include the outdoor switch lights + entities: + - switch.tasmo_ks811t_0707_downstloun_2a # Lounge Main Lights + - switch.tasmo_ks811t_0707_downstloun_2b # Lounge Wall Lights + - switch.tasmo_ks811s_3136_downstbed2_1a # Craft Room Lights + - switch.tasmo_ks811t_3642_downstbed1_1a # Main Bedroom, Main Lights + - switch.tasmo_ks811t_3642_downstbed1_1b # Main Bedroom, Wardrobe Light + - switch.tasmo_ks811t_3642_downstbed1_1c # Main Bedroom, Bedside switch + - switch.tasmo_ks811t_2192_downstkitch_1a # Kitchen Entry Lights + - switch.tasmo_ks811t_2192_downstkitch_1b # Kitchen Main Lights + - switch.tasmo_ks811t_2192_downstkitch_1c # Kitchen (Unused, future strip lights) + - switch.tasmo_ks811t_1181_downstbath_a # Downstairs Bathroom Main Lights + - switch.tasmo_ks811t_1181_downstbath_b # Downstairs Bathroom Mirror Lights diff --git a/group/simulation_lights.yaml b/group/simulation_lights.yaml new file mode 100644 index 0000000..7d71946 --- /dev/null +++ b/group/simulation_lights.yaml @@ -0,0 +1,21 @@ +simulation_lights: + name: Simulation Lights + # Lights included in 'away from home' random patterns + entities: + - switch.tasmo_ks811d_1242_entrance_a # Entranceway Main Lights + - switch.tasmo_ks811d_0302_entrybath_a # Entranceway Guest Bathroom Lights + - switch.tasmo_ks811d_6110_kitchen_a # Main Kitchen, Main Lights + - switch.tasmo_ks811d_6110_kitchen_b # Main Kitchen, Bench Lights + - switch.tasmo_ks811s_2940_hallway_1a # Hallway Main Lights + - switch.tasmo_ks811d_1701_stairs_2a # Stairs, Lower ceiling lights + - switch.tasmo_ks811t_0702_lounge_3a # Lounge Main, South + - switch.tasmo_ks811t_0702_lounge_3b # Lounge Main, Middle + - switch.tasmo_ks811t_0702_lounge_3c # Lounge Main, North (above stairs) + - switch.tasmo_ks811t_0707_downstloun_2a # Foxhole Lounge Main Lights + - switch.tasmo_ks811t_0707_downstloun_2b # Foxhole Lounge Wall Lights + - switch.tasmo_ks811s_3136_downstbed2_1a # Foxhole Craft Room Lights + - switch.tasmo_ks811t_3642_downstbed1_1a # Foxhole Main Bedroom, Main Lights + - switch.tasmo_ks811t_2192_downstkitch_1a # Foxhole Kitchen Entry Lights + - switch.tasmo_ks811t_2192_downstkitch_1b # Foxhole Kitchen Main Lights + - switch.tasmo_ks811t_1181_downstbath_a # Foxhole Downstairs Bathroom Main Lights + - switch.tasmo_s4chan_4231_underhouselights_b # Underhouse Main Lights diff --git a/groups.yaml b/groups.yaml new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/groups.yaml @@ -0,0 +1 @@ + diff --git a/packages/appliance_status.yaml b/packages/appliance_status.yaml new file mode 100644 index 0000000..160c529 --- /dev/null +++ b/packages/appliance_status.yaml @@ -0,0 +1,11 @@ +mqtt: + sensor: + - unique_id: washing_machine_finished + name: "Washing Machine Finished" + state_topic: "viewroad-status/activityfeed/washercomplete" + - unique_id: dryer_finished + name: "Dryer Finished" + state_topic: "viewroad-status/activityfeed/dryercomplete" + - unique_id: dishwasher_finished + name: "Dishwasher Finished" + state_topic: "viewroad-status/activityfeed/dishwashercomplete" diff --git a/packages/blind_control.yaml b/packages/blind_control.yaml new file mode 100644 index 0000000..3c1dcf2 --- /dev/null +++ b/packages/blind_control.yaml @@ -0,0 +1,24 @@ +mqtt: + switch: + - unique_id: lounge_blinds_control + name: "Lounge Blinds Control" + state_topic: "viewroad-status/blinds/lounge-verticalblinds" + command_topic: "viewroad-commands/blinds/lounge-verticalblinds" + payload_off: "off" + payload_on: "on" + state_on: "on" + state_off: "off" + icon: mdi:blinds + retain: false + +automation: + - id: lounge_blinds_control_switch + alias: Publish lounge blind control to mqtt + trigger: + platform: state + entity_id: input_boolean.lounge_blinds + action: + service: mqtt.publish + data_template: + payload: "{{trigger.to_state.state}}" + topic: viewroad-status/blinds/lounge-verticalblinds diff --git a/packages/cctv_controls.yaml b/packages/cctv_controls.yaml new file mode 100644 index 0000000..ef664ee --- /dev/null +++ b/packages/cctv_controls.yaml @@ -0,0 +1,6 @@ +mqtt: + binary_sensor: + - unique_id: front_door_movement_camera_corner + name: "Front Door Movement" + state_topic: "viewroad-status/cctv/front_door_motion" + icon: mdi:exit-run diff --git a/packages/covid_count.yaml b/packages/covid_count.yaml new file mode 100644 index 0000000..8f6d69f --- /dev/null +++ b/packages/covid_count.yaml @@ -0,0 +1,35 @@ +var: + covid_daily: + friendly_name: "Daily Covid count" + initial_value: 0 + icon: mdi:virus-outline + covid_yesterday_total: + friendly_name: "Yesterdays NZ Cumulative Total Covid Cases" + initial_value: 0 + icon: mdi:virus-outline + +automation: + - id: add_covid_confirmed_stats_only_if_increases + alias: add_covid_confirmed_stats_only_if_increases + #description: + # "Check new state of sensor.new_zealand_coronavirus_confirmed and store it + # in input_number.new_zealand_coronavirus_confirmed_previous_value if it has increased" + trigger: + - platform: state + entity_id: sensor.new_zealand_coronavirus_confirmed + condition: + - condition: template + value_template: + "{{ (states('sensor.new_zealand_coronavirus_confirmed') | float + > states('var.covid_yesterday_total') | float) }}" + action: + - service: var.set + data_template: + entity_id: var.covid_daily + value: + "{{ states('sensor.new_zealand_coronavirus_confirmed') | float - states('var.covid_yesterday_total') + | float }}" + - service: var.set + data_template: + entity_id: var.covid_yesterday_total + value: "{{ states('sensor.new_zealand_coronavirus_confirmed') | float }}" diff --git a/packages/energy_readings.yaml b/packages/energy_readings.yaml new file mode 100644 index 0000000..d25e390 --- /dev/null +++ b/packages/energy_readings.yaml @@ -0,0 +1,21 @@ +mqtt: + sensor: + - unique_id: view_road_power_now + name: "Power Now" + state_topic: "viewroad-status/energy/PowerTotals" + unit_of_measurement: "kW" + - unique_id: view_road_power_now_red + name: "Power Now (Red)" + state_topic: "tele/tasmo-wemosd1-7280-powermon-1/SENSOR" + unit_of_measurement: "kW" + value_template: "{{ value_json.ENERGY.Power[0] }}" + - unique_id: view_road_power_now_white + name: "Power Now (White)" + state_topic: "tele/tasmo-wemosd1-7280-powermon-1/SENSOR" + unit_of_measurement: "kW" + value_template: "{{ value_json.ENERGY.Power[1] }}" + - unique_id: view_road_power_now_blue + name: "Power Now (Blue)" + state_topic: "tele/tasmo-wemosd1-7280-powermon-1/SENSOR" + unit_of_measurement: "kW" + value_template: "{{ value_json.ENERGY.Power[2] }}" diff --git a/packages/firewall_control.yaml b/packages/firewall_control.yaml new file mode 100644 index 0000000..fe086f7 --- /dev/null +++ b/packages/firewall_control.yaml @@ -0,0 +1,10 @@ +mqtt: + switch: + - unique_id: mollies.internet + name: "Mollie's Internet Blocking" + state_topic: "viewroad-status/firewall/block-unblock-mollie-iphone7" + command_topic: "viewroad-commands/firewall/block-unblock-mollie-devices" + payload_off: "Unblocked" + payload_on: "Blocked" + icon: mdi:web + retain: false diff --git a/packages/gas_heater_operation.yaml b/packages/gas_heater_operation.yaml new file mode 100644 index 0000000..5cfd910 --- /dev/null +++ b/packages/gas_heater_operation.yaml @@ -0,0 +1,19 @@ +mqtt: + sensor: + - unique_id: gas_heater_operating + name: "Gas Heater Operating" + state_topic: "viewroad-status/gasheater/operating" + switch: + - unique_id: gasheater_switch + name: "Gas Heater" + state_topic: "viewroad-status/gasheater/operating" + command_topic: "viewroad-commands/gasheater/onoff" + #availability: + # - topic: "home/bedroom/switch1/available" + payload_on: "ON" + payload_off: "OFF" + state_on: "ON" + state_off: "OFF" + optimistic: false + qos: 0 + # retain: true diff --git a/packages/kogan_kettle.yaml b/packages/kogan_kettle.yaml new file mode 100644 index 0000000..382c081 --- /dev/null +++ b/packages/kogan_kettle.yaml @@ -0,0 +1,55 @@ +mqtt: + sensor: + - unique_id: kettle.temp + name: "Kettle Temperature" + state_topic: "tele/tasmo-kkettle-3773-portable/RESULT" + availability_topic: "tele/tasmo-kkettle-3773-portable/LWT" + payload_available: "Online" + payload_not_available: "Offline" + value_template: > + {% if value_json.TuyaReceived['5'].DpIdData %} + {{ value_json.TuyaReceived['5'].DpIdData | int(base=16) }} + {% else %} + {{ states('sensor.kettle_temp') }} + {% endif %} + unit_of_measurement: "°C" + switch: + - unique_id: kettle.power + name: kettle + state_topic: "stat/tasmo-kkettle-3773-portable/POWER" + command_topic: "cmnd/tasmo-kkettle-3773-portable/POWER" + availability_topic: "tele/tasmo-kkettle-3773-portable/LWT" + payload_on: "ON" + payload_off: "OFF" + payload_available: "Online" + payload_not_available: "Offline" + retain: false + +input_select: + kettle_set: + name: Keep Kettle Warm + initial: "OFF" + options: + - "OFF" + - "40°C" + - "50°C" + - "60°C" + - "80°C" + - "90°C" + +automation: + - id: set_the_kettle + initial_state: true + alias: Set the Kettle + trigger: + platform: state + entity_id: input_select.kettle_set + action: + service: mqtt.publish + data: + topic: cmnd/tasmo-kkettle-3773-portable/TuyaSend4 + payload: '{% set mapping = { "OFF":"102,5", "40°C":"102,0", + "50°C":"102,1", "60°C":"102,2", "80°C":"102,3", + "90°C":"102,4" } %} {% set dta = trigger.to_state.state %} + {{ mapping[dta] }} + ' diff --git a/packages/media_players.yaml b/packages/media_players.yaml new file mode 100644 index 0000000..4be5330 --- /dev/null +++ b/packages/media_players.yaml @@ -0,0 +1,5 @@ +media_player: + # MPD Media Player on Lounge Touchscreen + platform: mpd + host: !secret lounge_mpd_player + scan_interval: 1 diff --git a/packages/office_media_buttons.yaml b/packages/office_media_buttons.yaml new file mode 100644 index 0000000..51a7c34 --- /dev/null +++ b/packages/office_media_buttons.yaml @@ -0,0 +1,62 @@ +mqtt: + sensor: + - unique_id: office_media_button_1 + name: "Office Media Button" + state_topic: "tele/tasmo-zigb-6440-1/9CB5/SENSOR" + unit_of_measurement: "Press" + value_template: "{{ value_json.ZbReceived.Office_Media_Button.Power }}" + +automation: + - id: "1629271273952" + alias: Pause Office TV on Media Button + description: "" + trigger: + - platform: state + entity_id: sensor.office_media_button + to: "1" + condition: [] + action: + - service: media_player.media_pause + target: + device_id: abb6b5a6b4e4925dcb3a77ea2c293eaa + mode: single + - id: "1629271457675" + alias: Play Office TV on Media Button + description: "" + trigger: + - platform: state + entity_id: sensor.office_media_button + to: "2" + condition: [] + action: + - service: media_player.media_play + target: + device_id: abb6b5a6b4e4925dcb3a77ea2c293eaa + mode: single + - id: "1629271273958" + alias: Pause office TV on MQTT + description: "" + trigger: + - platform: mqtt + topic: viewroad-commands/officetv/action + payload: pause + encoding: utf-8 + condition: [] + action: + - service: media_player.media_pause + target: + device_id: abb6b5a6b4e4925dcb3a77ea2c293eaa + mode: single + - id: "1630969028384" + alias: Skip Forward 30 Seconds on Media Button + description: "" + trigger: + - platform: state + entity_id: sensor.office_media_button + to: "3" + condition: [] + action: + - service: media_player.media_seek + data: + seek_position: 30 + mode: single diff --git a/packages/pet_feeding.yaml b/packages/pet_feeding.yaml new file mode 100644 index 0000000..7d7652b --- /dev/null +++ b/packages/pet_feeding.yaml @@ -0,0 +1,21 @@ +mqtt: + sensor: + - unique_id: pets_fed + name: "Pets Fed" + state_topic: "viewroad-status/activityfeed/petsfed" + - unique_id: hours_since_cat_fed + name: "Hours Since Cat Fed" + state_topic: "viewroad-tele/petfeeding/hoursSinceCatFed" + unit_of_measurement: "Hours" + - unique_id: hours_since_zorro_fed + name: "Hours Since Zorro Fed" + state_topic: "viewroad-tele/petfeeding/hoursSinceDogFed" + unit_of_measurement: "Hours" + - unique_id: hours_since_water_filled + name: "Hours Since Pet Water Filled" + state_topic: "viewroad-tele/petfeeding/hoursSinceWaterFilled" + unit_of_measurement: "Hours" + - unique_id: hours_since_pets_fed + name: "Hours Since Pets Fed" + state_topic: "viewroad-tele/petfeeding/averageHoursSincePetsFed" + unit_of_measurement: "Hours" diff --git a/packages/piano_practice.yaml b/packages/piano_practice.yaml new file mode 100644 index 0000000..6074d36 --- /dev/null +++ b/packages/piano_practice.yaml @@ -0,0 +1,45 @@ +mqtt: + sensor: + - unique_id: piano.lastfinish + name: "Last Piano Practice Complete" + state_topic: "viewroad-status/activityfeed/pianopractice" + - unique_id: piano.lastpracticeduration + state_topic: "viewroad-status/piano/lastPracticeDuration" + name: "Last Piano Practice Time" + unit_of_measurement: "mins" + - unique_id: piano.todayspracticeduration + state_topic: "viewroad-status/piano/todayPracticeDuration" + name: "Today's Piano Practice Time" + unit_of_measurement: "mins" + - unique_id: piano.thisweekspracticeduration + state_topic: "viewroad-status/piano/thisWeekPracticeDuration" + name: "This Week's Piano Practice Time" + unit_of_measurement: "mins" + +automation: + - id: "1648705777863" + alias: Tag Started Piano Practice is Scanned + description: "" + trigger: + - platform: tag + tag_id: af3f595c-5d41-4bb6-8985-27c70b0e6217 + condition: [] + action: + - service: mqtt.publish + data: + topic: viewroad-commands/chores/piano_practice + payload: start + mode: single + - id: "Tag Finished Piano Practice is Scanned" + alias: Tag Finished Piano Practice is Scanned + description: "" + trigger: + - platform: tag + tag_id: 6e7a6ab5-c7e4-47f3-be8f-830241175d69 + condition: [] + action: + - service: mqtt.publish + data: + topic: viewroad-commands/chores/piano_practice + payload: end + mode: single diff --git a/packages/presense_sense.yaml b/packages/presense_sense.yaml new file mode 100644 index 0000000..2dc1864 --- /dev/null +++ b/packages/presense_sense.yaml @@ -0,0 +1,25 @@ +sensor: + - platform: mqtt_room + device_id: "d75fda56c990" + name: "Nissan Leaf LNM748 (BTB01)" + state_topic: "espresense/rooms" + timeout: 60 + away_timeout: 120 # number of seconds after which the enitity will get status not_home + - platform: mqtt_room + device_id: "f54fe90c3d15" + name: "Mazda MPV KUU64 (BTB02)" + state_topic: "espresense/rooms" + timeout: 60 + away_timeout: 120 # number of seconds after which the enitity will get status not_home + - platform: mqtt_room + device_id: "c5eba6d8e8fd" + name: "Vespa Scooter B8EJJ (BTB03)" + state_topic: "espresense/rooms" + timeout: 60 + away_timeout: 120 # number of seconds after which the enitity will get status not_home + - platform: mqtt_room + device_id: "ed5e450c84a5" + name: "Zephyr Caravan Z556D (BTB04)" + state_topic: "espresense/rooms" + timeout: 60 + away_timeout: 120 # number of seconds after which the enitity will get status not_home diff --git a/packages/recorder.yaml b/packages/recorder.yaml new file mode 100644 index 0000000..8ddc46d --- /dev/null +++ b/packages/recorder.yaml @@ -0,0 +1,2 @@ +# enable the recorder integration (optional) +recorder: diff --git a/packages/room_fan_control.yaml b/packages/room_fan_control.yaml new file mode 100644 index 0000000..c3129b3 --- /dev/null +++ b/packages/room_fan_control.yaml @@ -0,0 +1,69 @@ +input_select: + master_bedroom_fan_set: + name: Master Bedroom Fan Speed + initial: "Off" + options: + - "Off" + - "Low" + - "Medium" + - "High" + bedroom_2_fan_set: + name: Bedroom 2 Fan Speed + initial: "Off" + options: + - "Off" + - "Low" + - "Medium" + - "High" + bedroom_3_fan_set: + name: Bedroom 3 Fan Speed + initial: "Off" + options: + - "Off" + - "Low" + - "Medium" + - "High" + +automation: + - id: set_the_master_bedroom_fan + initial_state: true + alias: Set the Master Bedroom Fan + trigger: + entity_id: input_select.master_bedroom_fan_set + platform: state + action: + service: mqtt.publish + data: + topic: cmnd/tasmo-ifan02-3793-bedrm1-1/FanSpeed + payload: '{% set mapping = { "Off":"0", "Low":"1", + "Medium":"2", "High":"3" } %} {% set dta = trigger.to_state.state %} + {{ mapping[dta] }} + ' + - id: set_bedroom_2_fan + initial_state: true + alias: Set Bedroom 2 Fan Speed + trigger: + entity_id: input_select.bedroom_2_fan_set + platform: state + action: + service: mqtt.publish + data: + topic: cmnd/tasmo-ifan02-7042-bedrm2/FanSpeed + payload: '{% set mapping = { "Off":"0", "Low":"1", + "Medium":"2", "High":"3" } %} {% set dta = trigger.to_state.state %} + {{ mapping[dta] }} + ' + - id: set_bedroom_3_fan + initial_state: true + alias: Set Bedroom 3 Fan Speed + trigger: + entity_id: input_select.bedroom_3_fan_set + platform: state + action: + service: mqtt.publish + data: + topic: cmnd/tasmo-ifan02-3497-bedrm3/FanSpeed + payload: '{% set mapping = { "Off":"0", "Low":"1", + "Medium":"2", "High":"3" } %} {% set dta = trigger.to_state.state %} + {{ mapping[dta] }} + ' diff --git a/packages/tts.yaml b/packages/tts.yaml new file mode 100644 index 0000000..810ebe6 --- /dev/null +++ b/packages/tts.yaml @@ -0,0 +1,4 @@ +# Text to speech +tts: + platform: google_translate + service_name: google_say diff --git a/scenes.yaml b/scenes.yaml new file mode 100644 index 0000000..e69de29 diff --git a/scripts.yaml b/scripts.yaml new file mode 100644 index 0000000..e69de29 diff --git a/scripts/cctv_detect.yaml b/scripts/cctv_detect.yaml new file mode 100644 index 0000000..05e8c37 --- /dev/null +++ b/scripts/cctv_detect.yaml @@ -0,0 +1,8 @@ +#camdetecon: +# alias: booleanopen +# sequence: +# - service: input_boolean.turn_on +# entity_id: input_boolean.cameramotion +# - delay: 00:00:30 +# - service: input_boolean.turn_off +# entity_id: input_boolean.cameramotion diff --git a/scripts/check_config.yaml b/scripts/check_config.yaml new file mode 100644 index 0000000..f202c64 --- /dev/null +++ b/scripts/check_config.yaml @@ -0,0 +1,3 @@ +check_config: + sequence: [] + alias: Check Configuration diff --git a/scripts/office_mediaplayer.yaml b/scripts/office_mediaplayer.yaml new file mode 100644 index 0000000..e2f7b1f --- /dev/null +++ b/scripts/office_mediaplayer.yaml @@ -0,0 +1,6 @@ +skip: + alias: skip + sequence: + - service: media_player.media_seek + data_template: + seek_position: "{{ state_attr(media_player.office_tv, 'media_position') | float + 10 }}" diff --git a/scripts/reload_lounge_browser.yaml b/scripts/reload_lounge_browser.yaml new file mode 100644 index 0000000..1fdebbb --- /dev/null +++ b/scripts/reload_lounge_browser.yaml @@ -0,0 +1,7 @@ +reload_lounge_browser_lovelace: + sequence: + - service: browser_mod.command + data: + command: lovelace-reload + deviceID: + - lounge_touchscreen diff --git a/scripts/turn_light_on_for_random_time.yaml b/scripts/turn_light_on_for_random_time.yaml new file mode 100644 index 0000000..e8f404c --- /dev/null +++ b/scripts/turn_light_on_for_random_time.yaml @@ -0,0 +1,23 @@ +light_duration: + mode: parallel # Enable parallel executions + description: "Turns on a light for a while, and then turns it off" + fields: + light: + description: "A specific light" + example: "light.bedroom" + duration: + description: "How long the light should be on in minutes" + example: "25" + sequence: + - service: logbook.log + data: + name: "Script Notice.." + message: > + "Light {{ light }} will be turned on for {{ duration }}" + - service: homeassistant.turn_on + data: + entity_id: "{{ light }}" + - delay: "{{ duration }}" + - service: homeassistant.turn_off + data: + entity_id: "{{ light }}" diff --git a/sensor/coronavirus.yaml b/sensor/coronavirus.yaml new file mode 100644 index 0000000..544a27e --- /dev/null +++ b/sensor/coronavirus.yaml @@ -0,0 +1,18 @@ +- platform: statistics + entity_id: sensor.coronavirus_totals_normalised + sampling_size: 200000 + state_characteristic: mean + max_age: + days: 1 + name: "Coronavirus Statistics" +- platform: template + sensors: + coronavirus_totals_normalised: + friendly_name: "NZ Coronavirus Totals (Normalised)" + value_template: > + {% set new_state = states('sensor.new_zealand_coronavirus_confirmed') | float %} + {% if new_state >= states('input_number.new_zealand_coronavirus_confirmed_previous_value') | float %} + {{ new_state }} + {% else %} + {{ states('input_number.new_zealand_coronavirus_confirmed_previous_value') | float }} + {% endif %} diff --git a/sensor/google_keep.yaml b/sensor/google_keep.yaml new file mode 100644 index 0000000..57dc283 --- /dev/null +++ b/sensor/google_keep.yaml @@ -0,0 +1,6 @@ +- platform: google_keep + username: !secret google_keep.username + password: !secret google_keep.password + labels: + - "Home Assistant" + pinned: true diff --git a/sensor/grocy.yaml b/sensor/grocy.yaml new file mode 100644 index 0000000..4783c23 --- /dev/null +++ b/sensor/grocy.yaml @@ -0,0 +1,26 @@ +- platform: rest + name: Dog Motel Cleaning + resource: !secret grocy_api_uri_chore3 + method: GET + value_template: "{{ (((as_timestamp(value_json.next_estimated_execution_time))-as_timestamp(now())) | int /60/1440) | round(0) }}" + json_attributes: + - last_tracked + - estimated_execution_time + headers: + Accept: application/json + Content-Type: application/json + GROCY-API-KEY: !secret grocy_api_key + unit_of_measurement: "Days" +- platform: rest + name: Red Bin Out + resource: !secret grocy_api_uri_chore2 + method: GET + value_template: "{{ (((as_timestamp(value_json.next_estimated_execution_time))-as_timestamp(now())) | int /60/1440) | round(0) }}" + json_attributes: + - last_tracked + - estimated_execution_time + headers: + Accept: application/json + Content-Type: application/json + GROCY-API-KEY: !secret grocy_api_key + unit_of_measurement: "Days" diff --git a/sensor/internet_traffic.yaml b/sensor/internet_traffic.yaml new file mode 100644 index 0000000..377433e --- /dev/null +++ b/sensor/internet_traffic.yaml @@ -0,0 +1,20 @@ +- platform: template + sensors: + sensor_internet_downtraffic: + friendly_name: "Internet Download Traffic" + unit_of_measurement: "kB/s" + value_template: "{{ state_attr('binary_sensor.edgeos_interface_pppoe0', 'KBytes/ps (Received)') }}" + +- platform: template + sensors: + sensor_internet_uptraffic: + friendly_name: "Internet Upload Traffic" + unit_of_measurement: "kB/s" + value_template: "{{ state_attr('binary_sensor.edgeos_interface_pppoe0', 'KBytes/ps (Sent)') }}" + +- platform: template + sensors: + sensor_internet_totaltraffic: + friendly_name: "Internet Total Traffic" + unit_of_measurement: "kB/s" + value_template: "{{ state_attr('binary_sensor.edgeos_interface_pppoe0', 'KBytes/ps (Received)') |float + state_attr('binary_sensor.edgeos_interface_pppoe0', 'KBytes/ps (Sent)') | float }}" diff --git a/sensor/low_battery_template.yaml b/sensor/low_battery_template.yaml new file mode 100644 index 0000000..b294f1d --- /dev/null +++ b/sensor/low_battery_template.yaml @@ -0,0 +1,19 @@ +- platform: template + sensors: + devices_with_low_battery: + friendly_name: "Devices with low battery" + unit_of_measurement: devices + value_template: >- + {{ states.sensor + | selectattr('attributes.device_class', 'eq', 'battery') + | map(attribute='state') + | reject('in', ['unknown', 'unavailable', 'Ok']) + | map('int', -1) | select('le', 97) + | list | count + }} + icon_template: >- + {% if is_state('sensor.devices_with_low_battery', '0') %} + mdi:check-circle + {% else %} + mdi:battery-alert + {% endif %} diff --git a/sensor/power_monitoring.yaml b/sensor/power_monitoring.yaml new file mode 100644 index 0000000..5e88648 --- /dev/null +++ b/sensor/power_monitoring.yaml @@ -0,0 +1,6 @@ +- platform: template + sensors: + electricity_power_total: + friendly_name: "Electricity Power Total" + unit_of_measurement: "W" + value_template: "{{ states('sensor.tasmo_wemosd1_7280_powermon_1_energy_power_0') |float + states('sensor.tasmo_wemosd1_7280_powermon_1_energy_power_1') | float + states('sensor.tasmo_wemosd1_7280_powermon_1_energy_power_2') | float }}" diff --git a/sensor/tautulli.yaml b/sensor/tautulli.yaml new file mode 100644 index 0000000..248d815 --- /dev/null +++ b/sensor/tautulli.yaml @@ -0,0 +1,4 @@ +- platform: tautulli + api_key: !secret tautulli_api_key + host: !secret tautulli_api_host + port: !secret tautulli_api_port diff --git a/sensor/tides.yaml b/sensor/tides.yaml new file mode 100644 index 0000000..d68d91d --- /dev/null +++ b/sensor/tides.yaml @@ -0,0 +1,6 @@ +- platform: niwa_tides + api_key: !secret niwa_tides_api_key + entity_id: "local_tides" + name: Local Tides + latitude: !secret latitude + longitude: !secret longitude diff --git a/themes.yaml b/themes.yaml new file mode 100644 index 0000000..e69de29