From ec959fe3dfcfcb3263d6c1918812be50f19b7530 Mon Sep 17 00:00:00 2001 From: proddy Date: Tue, 25 Sep 2018 21:02:26 +0200 Subject: [PATCH] home assistant config --- doc/ha/automations.yaml | 94 +++++++++ doc/ha/climate.yaml | 11 + doc/ha/customize.yaml | 12 ++ doc/ha/input_number.yaml | 18 ++ doc/ha/notify.yaml | 17 ++ doc/ha/scripts.yaml | 7 + doc/ha/sensors.yaml | 133 ++++++++++++ doc/ha/switches.yaml | 20 ++ doc/ha/ui-lovelace.yaml | 442 +++++++++++++++++++++++++++++++++++++++ 9 files changed, 754 insertions(+) create mode 100644 doc/ha/automations.yaml create mode 100644 doc/ha/climate.yaml create mode 100644 doc/ha/customize.yaml create mode 100644 doc/ha/input_number.yaml create mode 100644 doc/ha/notify.yaml create mode 100644 doc/ha/scripts.yaml create mode 100644 doc/ha/sensors.yaml create mode 100644 doc/ha/switches.yaml create mode 100644 doc/ha/ui-lovelace.yaml diff --git a/doc/ha/automations.yaml b/doc/ha/automations.yaml new file mode 100644 index 000000000..8c10ef9b0 --- /dev/null +++ b/doc/ha/automations.yaml @@ -0,0 +1,94 @@ +########################################################## +## Boiler +########################################################## + +- id: boiler_shower + alias: Alert shower time + trigger: + platform: mqtt + topic: home/boiler/showertime + action: + - service: notify.general_notify + data_template: + title: "Shower finished at {{states.sensor.time.state}}" + message: '{{trigger.payload}}' + +- id: boiler_shower_alarm + alias: Alert shower too long + trigger: + platform: mqtt + topic: home/boiler/command + payload: 'shower_alarm' + action: + - service: notify.admin_notify + data_template: + title: "Shower Alert!" + message: "Shower time exceeded limit" + +# when boiler starts send boottime +- id: boiler_restart + alias: See if boiler restarts + trigger: + platform: mqtt + topic: home/boiler/start + payload: 'start' + action: + - service: notify.admin_notify + data_template: + title: "boiler has booted" + message: "Boiler" + - service: mqtt.publish + data_template: + topic: 'home/boiler/start' + payload: > + {{ now().strftime("%H:%M:%S %-d/%b/%Y") }} + +# Set thermostat temp +- id: thermostat_temp + alias: 'Adjust Theromostat Temperature' + trigger: + platform: state + entity_id: input_number.thermostat_temp + action: + service: mqtt.publish + data_template: + topic: 'home/boiler/thermostat_temp' + payload: > + {{ states.input_number.thermostat_temp.state }} + +# See if thermostat_temp has changed in recent mqtt payload, then adjust input_number +- id: thermostat_temp_incoming + trigger: + platform: state + entity_id: sensor.current_set_temperature + action: + service: input_number.set_value + data_template: + entity_id: input_number.thermostat_temp + value: '{{ states.sensor.current_set_temperature.state }}' + + +# Boiler warm water temp +- id: boiler_wwtemp + trigger: + platform: state + entity_id: input_number.boiler_wwtemp + action: + service: mqtt.publish + data_template: + topic: 'home/boiler/boiler_wwtemp' + payload: > + {{ states.input_number.boiler_wwtemp.state }} + +# See if wwTemp has changed in recent mqtt payload, then adjust input_number +- id: boiler_wwtemp_incoming + trigger: + platform: state + entity_id: sensor.warm_water_selected_temperature + action: + service: input_number.set_value + data_template: + entity_id: input_number.boiler_wwtemp + value: '{{ states.sensor.warm_water_selected_temperature.state }}' + + diff --git a/doc/ha/climate.yaml b/doc/ha/climate.yaml new file mode 100644 index 000000000..f697d7e63 --- /dev/null +++ b/doc/ha/climate.yaml @@ -0,0 +1,11 @@ + - platform: mqtt + name: Thermostat + modes: + - low + - manual + - auto + mode_state_topic: "home/boiler/thermostat_mode" + temperature_command_topic: "home/boiler/thermostat_temp" + temperature_state_topic: "home/boiler/thermostat_seltemp" + current_temperature_topic: "home/boiler/thermostat_currtemp" + diff --git a/doc/ha/customize.yaml b/doc/ha/customize.yaml new file mode 100644 index 000000000..404c78858 --- /dev/null +++ b/doc/ha/customize.yaml @@ -0,0 +1,12 @@ + sensor.boiler_boottime: + friendly_name: Controller last restart + icon: mdi:clock-start + + sensor.showertime_time: + friendly_name: 'Last shower at' + icon: mdi:timelapse + + sensor.boiler_updated: + friendly_name: 'Data last received' + icon: mdi:clock-start + diff --git a/doc/ha/input_number.yaml b/doc/ha/input_number.yaml new file mode 100644 index 000000000..d5ecd4113 --- /dev/null +++ b/doc/ha/input_number.yaml @@ -0,0 +1,18 @@ + thermostat_temp: + name: Set Temperature + icon: mdi:temperature-celsius + min: 10 + max: 25 + step: 0.5 + unit_of_measurement: "°C" + mode: slider + + boiler_wwtemp: + name: Warm Water temp + icon: mdi:temperature-celsius + min: 30 + max: 60 + step: 1 + unit_of_measurement: "°C" + mode: slider + diff --git a/doc/ha/notify.yaml b/doc/ha/notify.yaml new file mode 100644 index 000000000..8fef11786 --- /dev/null +++ b/doc/ha/notify.yaml @@ -0,0 +1,17 @@ + - name: pushover + platform: pushover + api_key: !secret pushover_api_key + user_key: !secret pushover_user_key + + - name: general_notify + platform: group + services: + - service: ios_pauls_iphone + - service: ios_fleurs_iphone + - service: pushover + + - name: admin_notify + platform: group + services: + - service: ios_pauls_iphone + - service: pushover diff --git a/doc/ha/scripts.yaml b/doc/ha/scripts.yaml new file mode 100644 index 000000000..5134827e5 --- /dev/null +++ b/doc/ha/scripts.yaml @@ -0,0 +1,7 @@ +shower_coldshot: + sequence: + - service: mqtt.publish + data_template: + topic: 'home/boiler/shower_coldshot' + payload: '1' + diff --git a/doc/ha/sensors.yaml b/doc/ha/sensors.yaml new file mode 100644 index 000000000..26233b2b1 --- /dev/null +++ b/doc/ha/sensors.yaml @@ -0,0 +1,133 @@ +- platform: mqtt + state_topic: 'home/boiler/thermostat_currtemp' + name: 'Current Room Temperature' + unit_of_measurement: '°C' + +- platform: mqtt + state_topic: 'home/boiler/thermostat_seltemp' + name: 'Current Set Temperature' + unit_of_measurement: '°C' + +- platform: mqtt + state_topic: 'home/boiler/thermostat_mode' + name: 'Current Mode' + +# last time boiler was started +- platform: template + sensors: + boiler_boottime: + value_template: '{{ as_timestamp(states.automation.see_if_boiler_restarts.attributes.last_triggered) | timestamp_custom("%H:%M:%S %d/%m/%y") }}' + +- platform: mqtt + state_topic: 'home/boiler/showertime' + name: 'Last shower duration' + force_update: true +# unit_of_measurement: "minutes" +# value_template: '{{ states("sensor.last_shower_duration") | float / 60}}' + +- platform: mqtt + state_topic: 'home/boiler/boiler_data' + name: 'Warm Water selected temperature' + unit_of_measurement: '°C' + value_template: '{{ value_json.wWSelTemp }}' + +- platform: mqtt + state_topic: 'home/boiler/boiler_data' + name: 'Warm Water current temperature' + unit_of_measurement: '°C' + value_template: '{{ value_json.wWCurTmp }}' + +- platform: mqtt + state_topic: 'home/boiler/boiler_data' + name: 'Warm Water activated' + value_template: '{{ value_json.wWActivated }}' + +- platform: mqtt + state_topic: 'home/boiler/boiler_data' + name: 'Warm Water 3-way valve' + value_template: '{{ value_json.wWHeat }}' + +- platform: mqtt + state_topic: 'home/boiler/boiler_data' + name: 'Current flow temperature' + unit_of_measurement: '°C' + value_template: '{{ value_json.curFlowTemp }}' + +- platform: mqtt + state_topic: 'home/boiler/boiler_data' + name: 'Return temperature' + unit_of_measurement: '°C' + value_template: '{{ value_json.retTemp }}' + +- platform: mqtt + state_topic: 'home/boiler/boiler_data' + name: 'Gas' + value_template: '{{ value_json.burnGas }}' + +- platform: mqtt + state_topic: 'home/boiler/boiler_data' + name: 'Boiler pump' + value_template: '{{ value_json.heatPmp }}' + +- platform: mqtt + state_topic: 'home/boiler/boiler_data' + name: 'Fan' + value_template: '{{ value_json.fanWork }}' + +- platform: mqtt + state_topic: 'home/boiler/boiler_data' + name: 'Ignition' + value_template: '{{ value_json.ignWork }}' + +- platform: mqtt + state_topic: 'home/boiler/boiler_data' + name: 'Circulation pump' + value_template: '{{ value_json.wWCirc }}' + +- platform: mqtt + state_topic: 'home/boiler/boiler_data' + name: 'Burner max power' + unit_of_measurement: '%' + value_template: '{{ value_json.selBurnPow }}' + +- platform: mqtt + state_topic: 'home/boiler/boiler_data' + name: 'Burner max power' + unit_of_measurement: '%' + value_template: '{{ value_json.selBurnPow }}' + +- platform: mqtt + state_topic: 'home/boiler/boiler_data' + name: 'Burner current power' + unit_of_measurement: '%' + value_template: '{{ value_json.curBurnPow }}' + +- platform: mqtt + state_topic: 'home/boiler/boiler_data' + name: 'System Pressure' + unit_of_measurement: 'bar' + value_template: '{{ value_json.sysPress }}' + +- platform: mqtt + state_topic: 'home/boiler/boiler_data' + name: 'Boiler temperature' + unit_of_measurement: '°C' + value_template: '{{ value_json.boilTemp }}' + +- platform: mqtt + state_topic: 'home/boiler/boiler_data' + name: 'Pump modulation' + unit_of_measurement: '%' + value_template: '{{ value_json.pumpMod }}' + +- platform: template + sensors: + showertime_time: + value_template: '{{ as_timestamp(states.sensor.last_shower_duration.last_updated) | int | timestamp_custom("%-I:%M %P on %a %-d %b") }}' + + boiler_updated: +# value_template: '{{ (as_timestamp(now()) - as_timestamp(states.sensor.boiler_temperature.last_updated)) | int | timestamp_custom("%-M min %-S seconds ago") }}' + value_template: '{{ as_timestamp(states.sensor.boiler_temperature.last_updated) | timestamp_custom("%H:%M on %d/%b") }}' + + + diff --git a/doc/ha/switches.yaml b/doc/ha/switches.yaml new file mode 100644 index 000000000..2c667efa7 --- /dev/null +++ b/doc/ha/switches.yaml @@ -0,0 +1,20 @@ +- platform: mqtt + name: "Shower Timer" + state_topic: "home/boiler/shower_timer" + command_topic: "home/boiler/shower_timer" + payload_on: "1" + payload_off: "0" + optimistic: false + qos: 1 + retain: false + +- platform: mqtt + name: "Long Shower Alert" + state_topic: "home/boiler/shower_alert" + command_topic: "home/boiler/shower_alert" + payload_on: "1" + payload_off: "0" + optimistic: false + qos: 1 + retain: false + diff --git a/doc/ha/ui-lovelace.yaml b/doc/ha/ui-lovelace.yaml new file mode 100644 index 000000000..780d44e6a --- /dev/null +++ b/doc/ha/ui-lovelace.yaml @@ -0,0 +1,442 @@ +resources: + - url: /local/dual-gauge-card.js + type: js + - url: /local/tracker-card.js?v=0.1.4 + type: js + - url: /local/custom-lovelace/monster-card/monster-card.js?v=0.2.3 + type: js + - url: /local/custom-lovelace/gauge-card/gauge-card.js + type: js + - url: /local/custom-lovelace/bignumber-card/bignumber-card.js + type: js + - url: /local/custom-lovelace/group-card/group-card.js + type: js + - url: /local/custom-lovelace/thermostat-card/thermostat-card.js + type: module + - url: /local/button-card.js + type: module + - url: /local/dark-sky-weather-card.js + type: js + - url: /local/column-card.js + type: js + +title: Home +views: + - title: home + cards: + - type: entities + title: Broadcast to Sonos + show_header_toggle: true + entities: + - input_text.sonos_speak + - input_select.speaker + - type: entities + title: DNS + show_header_toggle: true + entities: + - sensor.pihole_dns_queries_today + - sensor.pihole_ads_percentage_blocked_today + - sensor.pihole_ads_blocked_today + - type: entities + title: System + show_header_toggle: true + entities: + - sensor.current_ha_release + - sensor.glances_disk_used_2 + - sensor.glances_ram_used + - sensor.last_boot + - sensor.glances_sleeping + - sensor.glances_total + - sensor.installed_ha_version + - sensor.glances_swap_free + - sensor.glances_disk_free + - sensor.glances_cpu_temp + - sensor.glances_disk_used + - sensor.glances_cpu_load + - sensor.glances_ram_used_2 + - sensor.glances_ram_free + - sensor.glances_running + - sensor.glances_thread + - sensor.cpu_temp + - type: entities + title: People + show_header_toggle: true + entities: + - sensor.pauls_iphone_battery_level + - sensor.pauls_iphone_battery_state + - sensor.fleurs_iphone_battery_level + - sensor.fleurs_iphone_battery_state +# - type: entities +# title: Climate +# show_header_toggle: true +# entities: +# - sensor.dark_sky_humidity +# - sensor.dark_sky_summary +# - sensor.dark_sky_temperature +# - sensor.dark_sky_precip_intensity + - type: weather-forecast + name: Weather + entity: weather.yweather + - type: "custom:dark-sky-weather-card" + entity_sun: sun.sun +# entity_daily_summary: sensor.dark_sky_daily_summary +# entity_current_conditions: sensor.dark_sky_icon +# entity_humidity: sensor.dark_sky_humidity +# entity_pressure: sensor.dark_sky_pressure +# entity_temperature: sensor.dark_sky_temperature +# entity_visibility: sensor.dark_sky_visibility +# entity_wind_bearing: sensor.dark_sky_wind_bearing +# entity_wind_speed: sensor.dark_sky_wind_speed +# entity_forecast_high_temp_1: sensor.dark_sky_daytime_high_temperature_1 +# entity_forecast_high_temp_2: sensor.dark_sky_daytime_high_temperature_2 +# entity_forecast_high_temp_3: sensor.dark_sky_daytime_high_temperature_3 +# entity_forecast_high_temp_4: sensor.dark_sky_daytime_high_temperature_4 +# entity_forecast_high_temp_5: sensor.dark_sky_daytime_high_temperature_5 +# entity_forecast_low_temp_1: sensor.dark_sky_overnight_low_temperature +# entity_forecast_low_temp_2: sensor.dark_sky_overnight_low_temperature_1 +# entity_forecast_low_temp_3: sensor.dark_sky_overnight_low_temperature_2 +# entity_forecast_low_temp_4: sensor.dark_sky_overnight_low_temperature_3 +# entity_forecast_low_temp_5: sensor.dark_sky_overnight_low_temperature_4 +# entity_forecast_icon_1: sensor.dark_sky_icon_1 + + - title: Heating + cards: + - type: entities + title: Boiler + show_header_toggle: true + entities: + - sensor.boiler_boottime + - sensor.boiler_updated + - type: divider +# - sensor.warm_water_selected_temperature + - input_number.boiler_wwtemp + - sensor.warm_water_current_temperature + - sensor.warm_water_activated + - sensor.warm_water_3way_valve + - type: divider + - sensor.boiler_temperature + - sensor.return_temperature + - sensor.current_flow_temperature + - sensor.pump_modulation + - sensor.ignition + - sensor.gas + - sensor.fan + - sensor.boiler_pump + - sensor.system_pressure + - sensor.burner_max_power + - sensor.burner_current_power + + - type: vertical-stack + cards: + - type: entities + title: Shower Monitor + show_header_toggle: true + entities: + - switch.shower_timer + - switch.long_shower_alert + - type: divider + - sensor.last_shower_duration + - sensor.showertime_time + - type: custom:button-card +# color_type: card + color: auto + icon: mdi:shower-head + name: send a cold shot of shower water + style: + - text-transform: none + - color: rgb(28, 128, 199) + - font-weight: bold + entity: script.shower_coldshot + show_state: false + + - type: vertical-stack + cards: + - type: entities + title: Thermostat + show_header_toggle: true + entities: + - sensor.current_room_temperature + - sensor.current_mode + - input_number.thermostat_temp +# - sensor.current_set_temperature + - type: history-graph + entities: + - sensor.current_room_temperature + - sensor.dark_sky_temperature +# - type: custom:dual-gauge-card +# title: Living room +# min: -20 +# max: 40 +# outer: +# entity: climate.thermostat +# attribute: current_temperature +# label: "Current" +# unit: "C" +# inner: +# entity: climate.thermostat +# label: "Target" +# attribute: temperature +# unit: "C" +# colors: +# - color: "var(--label-badge-red)" +# value: 27.5 +# - color: "var(--label-badge-green)" +# value: 25 +# - color: "var(--label-badge-yellow)" +# value: 18 +# - color: "var(--label-badge-blue)" +# value: 0 +# - color: "var(--paper-blue-400)" +# value: -40 + - type: custom:thermostat-card + title: Living Room + entity: climate.thermostat + pending: 1 + chevron_size: 50 + no_card: false + hvac: + states: + 'low': 'low' + 'manual': 'manual' + 'auto': 'auto' + attribute: operation_mode + highlight_tap: true + - title: Media + cards: + - type: media-control + entity: media_player.pf_bedroom + - type: media-control + entity: media_player.kitchen + - type: media-control + entity: media_player.tv + - type: media-control + entity: media_player.lounge + - type: entities + title: Kodi + show_header_toggle: false + entities: + - script.update_kodi_library + - script.clean_kodi_library + - type: media-control + entity: media_player.kodi + - title: Door bell + cards: + - type: entities + entities: + - sensor.doorbell_boottime + - type: entities + title: Door Bell + show_header_toggle: true + entities: + - sensor.ring_time + - sensor.ring_type + + + - title: Talking Clock + cards: + + - type: vertical-stack + cards: + + - type: entities + title: Talking Clock Settings + show_header_toggle: false + entities: + - sensor.talkingclock_boottime + - input_number.clock_sensitivity + - input_number.clock_displaymode + - sensor.temperature + - sensor.humidity + - switch.talkingclock_clockmode_switch + - input_datetime.nightmode_time + + - type: entities + title: Reset Alarms + show_header_toggle: true + entities: + - input_number.alarm_hour + - input_number.alarm_minutes + - sensor.alarmtime + + + - type: custom:column-card + cards: + + - type: horizontal-stack + cards: + - type: entities + entities: + - entity: input_datetime.alarmtime1_mon + - entity: input_boolean.alarmtime1_mon + - type: entities + entities: + - entity: input_datetime.alarmtime2_mon + - entity: input_boolean.alarmtime2_mon + - type: entities + entities: + - entity: input_text.goodmorning_mon + + - type: horizontal-stack + cards: + - type: entities + entities: + - entity: input_datetime.alarmtime1_tue + - entity: input_boolean.alarmtime1_tue + - type: entities + entities: + - entity: input_datetime.alarmtime2_tue + - entity: input_boolean.alarmtime2_tue + - type: entities + entities: + - entity: input_text.goodmorning_tue + + - type: horizontal-stack + cards: + - type: entities + entities: + - entity: input_datetime.alarmtime1_wed + - entity: input_boolean.alarmtime1_wed + - type: entities + entities: + - entity: input_datetime.alarmtime2_wed + - entity: input_boolean.alarmtime2_wed + - type: entities + entities: + - entity: input_text.goodmorning_wed + + - type: horizontal-stack + cards: + - type: entities + entities: + - entity: input_datetime.alarmtime1_thu + - entity: input_boolean.alarmtime1_thu + - type: entities + entities: + - entity: input_datetime.alarmtime2_thu + - entity: input_boolean.alarmtime2_thu + - type: entities + entities: + - entity: input_text.goodmorning_thu + + - type: horizontal-stack + cards: + - type: entities + entities: + - entity: input_datetime.alarmtime1_fri + - entity: input_boolean.alarmtime1_fri + - type: entities + entities: + - entity: input_datetime.alarmtime2_fri + - entity: input_boolean.alarmtime2_fri + - type: entities + entities: + - entity: input_text.goodmorning_fri + + - type: horizontal-stack + cards: + - type: entities + entities: + - entity: input_datetime.alarmtime1_sat + - entity: input_boolean.alarmtime1_sat + - type: entities + entities: + - entity: input_datetime.alarmtime2_sat + - entity: input_boolean.alarmtime2_sat + - type: entities + entities: + - entity: input_text.goodmorning_sat + + - type: horizontal-stack + cards: + - type: entities + entities: + - entity: input_datetime.alarmtime1_sun + - entity: input_boolean.alarmtime1_sun + - type: entities + entities: + - entity: input_datetime.alarmtime2_sun + - entity: input_boolean.alarmtime2_sun + - type: entities + entities: + - entity: input_text.goodmorning_sun + +# - type: custom:column-card + - type: vertical-stack + cards: + - type: "custom:button-card" + entity: input_boolean.alarmtime1_mon + icon: mdi:alarm + name: Mon Alarm 1 + color: rgb(51,255,51) + size: 20px + - type: "custom:button-card" + entity: input_boolean.alarmtime2_mon + icon: mdi:alarm + name: Mon Alarm 2 + color: rgb(51,255,51) + size: 20px + - type: "custom:button-card" + entity: input_boolean.alarmtime1_tue + icon: mdi:alarm + name: Tue Alarm 1 + color: rgb(51,255,51) + size: 20px + - type: "custom:button-card" + entity: input_boolean.alarmtime2_tue + icon: mdi:alarm + name: Tue Alarm 2 + color: rgb(51,255,51) + size: 20px + - type: "custom:button-card" + entity: input_boolean.alarmtime1_wed + icon: mdi:alarm + name: Wed Alarm 1 + color: rgb(51,255,51) + size: 20px + - type: "custom:button-card" + entity: input_boolean.alarmtime2_wed + icon: mdi:alarm + name: Wed Alarm 2 + color: rgb(51,255,51) + size: 20px + - type: "custom:button-card" + entity: input_boolean.alarmtime1_thu + icon: mdi:alarm + name: Thu Alarm 1 + color: rgb(51,255,51) + size: 20px + - type: "custom:button-card" + entity: input_boolean.alarmtime2_thu + icon: mdi:alarm + name: Thu Alarm 2 + color: rgb(51,255,51) + size: 20px + - type: "custom:button-card" + entity: input_boolean.alarmtime1_fri + icon: mdi:alarm + name: Fri Alarm 1 + color: rgb(51,255,51) + size: 20px + - type: "custom:button-card" + entity: input_boolean.alarmtime2_fri + icon: mdi:alarm + name: Fri Alarm 2 + color: rgb(51,255,51) + size: 20px + + + + - title: Living Room + cards: + - type: entities + entities: + - light.tv_room + - light.dining_room + - title: System + cards: + - type: custom:tracker-card + title: + trackers: + - sensor.custom_card_tracker + - sensor.custom_component_tracker +