From 07f821590bb7d9f355527a09c1bb0dd1490a3bf7 Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 15 Oct 2019 18:26:58 +0200 Subject: [PATCH] fix HA shower time --- doc/home assistant/automation.yaml | 11 ++++++----- doc/home assistant/sensor.yaml | 25 +++++++++++++------------ 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/doc/home assistant/automation.yaml b/doc/home assistant/automation.yaml index f896a69ce..fcbdb28c8 100644 --- a/doc/home assistant/automation.yaml +++ b/doc/home assistant/automation.yaml @@ -1,13 +1,14 @@ - id: boiler_shower alias: Alert shower time + initial_state: true trigger: platform: mqtt - topic: home/ems-esp/showertime + topic: home/ems-esp/shower_data action: - - service: notify.general_notify - data_template: - title: "Shower finished at {{states.sensor.time.state}}" - message: "{{ trigger.payload_json['duration'] }}" + - service: notify.admin_notify + data_template: + title: Shower finished at {{states.sensor.time.state}} + message: "{{ trigger.payload_json['duration'] }}" # when ems-esp starts send boottime - id: boiler_restart diff --git a/doc/home assistant/sensor.yaml b/doc/home assistant/sensor.yaml index c88224f1c..28821fe97 100644 --- a/doc/home assistant/sensor.yaml +++ b/doc/home assistant/sensor.yaml @@ -1,3 +1,6 @@ + +# thermostat HC1 + - platform: mqtt state_topic: 'home/ems-esp/thermostat_data' name: 'Current Room Temperature' @@ -15,16 +18,7 @@ name: 'Current Mode' value_template: "{{ value_json.hc1.mode }}" -# last time esp-esp 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/ems-esp/showertime' - name: 'Last shower duration' - force_update: true + # boiler - platform: mqtt state_topic: 'home/ems-esp/boiler_data' @@ -137,6 +131,13 @@ unit_of_measurement: '%' value_template: '{{ value_json.pumpMod }}' + # shower time duration +- platform: mqtt + name: 'Last shower duration' + state_topic: "home/ems-esp/shower_data" + value_template: "{{ value_json.duration }}" + force_update: true + - platform: template sensors: showertime_time: @@ -145,5 +146,5 @@ boiler_updated: value_template: '{{ as_timestamp(states.sensor.boiler_temperature.last_updated) | timestamp_custom("%H:%M on %d/%b") }}' - - + boiler_boottime: + value_template: '{{ as_timestamp(states.automation.see_if_boiler_restarts.attributes.last_triggered) | timestamp_custom("%H:%M:%S %d/%m/%y") }}'