Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- automation:
- ############################################## HEATING ##############################################
- # Restart OTGW-MQTT if offline
- - alias: Restart OTGW-MQTT if offline
- hide_entity: false
- initial_state: false
- trigger:
- - entity_id: binary_sensor.otgw_mqtt
- platform: state
- from: 'on'
- to: 'off'
- action:
- - service: script.restart_otgw_mqtt_service
- # Set DHW temp on slider change
- - alias: Set DHW temp on slider change
- hide_entity: true
- initial_state: true
- trigger:
- platform: state
- entity_id: input_number.dhw_setpoint
- condition:
- condition: state
- entity_id: input_boolean.away_mode
- state: 'off'
- action:
- service: script.set_home_dhw_setpoint
- # Restart OTGW-MQTT periodicaly
- - alias: Restart OTGW-MQTT periodicaly
- hide_entity: false
- initial_state: false
- trigger:
- platform: time_pattern
- minutes: /5
- seconds: '0'
- condition:
- condition: state
- entity_id: binary_sensor.otgw_esp
- state: 'on'
- action:
- - service: script.restart_otgw_mqtt_service
- # OTGW-MQTT offline notification
- - alias: OTGW-MQTT offline notification
- hide_entity: true
- initial_state: true
- trigger:
- platform: state
- entity_id: binary_sensor.otgw_mqtt
- to: 'off'
- for: '00:10:00'
- action:
- - service: notify.my_homeassistant_samsung
- data:
- message: "Alert! Serwis OTGW-MQTT jest niedostępny od 10 minut"
- data:
- priority: high
- url: /lovelace/heating
- - service: input_boolean.turn_on
- entity_id: input_boolean.otgw_failure_detected
- - service: shell_command.run_heating_diagnostics
- # Restart OTGW-MQTT if esp online
- - alias: Restart OTGW-MQTT if esp online
- hide_entity: false
- initial_state: true
- trigger:
- platform: state
- entity_id: binary_sensor.otgw_esp
- to: 'on'
- action:
- service: script.full_restart_otgw_mqtt_service
- # Stop OTGW-MQTT if esp offline
- - alias: Stop OTGW-MQTT if esp offline
- hide_entity: false
- initial_state: true
- trigger:
- platform: state
- entity_id: binary_sensor.otgw_esp
- to: 'off'
- action:
- service: script.stop_otgw_mqtt_service
- # Set CH temp on slider change
- - alias: Set CH temp on slider change
- hide_entity: true
- initial_state: true
- trigger:
- platform: state
- entity_id: input_number.ch_setpoint
- action:
- service: script.set_ch_setpoint
- # Restart OTGW-MQTT periodicaly Full
- - alias: Restart OTGW-MQTT periodicaly full
- hide_entity: false
- initial_state: true
- trigger:
- platform: time_pattern
- minutes: /30
- seconds: '30'
- condition:
- condition: state
- entity_id: binary_sensor.otgw_esp
- state: 'on'
- action:
- - service: script.full_restart_otgw_mqtt_service
- #Turn on heating
- - alias: Turn on heating
- hide_entity: true
- initial_state: true
- trigger:
- platform: template
- value_template: "{% if states('sensor.lowest_temp') | float < states('sensor.tech_home_away_temp_setpoint') | float - 0.2 %}true{% endif %}"
- condition:
- - condition: state
- entity_id: input_select.set_heat_or_not
- state: 'Tak'
- action:
- service: script.ch_enable
- #Turn off heating
- - alias: Turn off heating
- hide_entity: true
- initial_state: true
- trigger:
- platform: template
- value_template: "{% if states('sensor.lowest_temp') | float >= states('sensor.tech_home_away_temp_setpoint') | float + 0.2 %}true{% endif %}"
- action:
- service: script.ch_disable
- # Heating watchdog
- - alias: Heating watchdog
- hide_entity: true
- initial_state: true
- trigger:
- platform: template
- value_template: "{% if states('sensor.lowest_temp') | float >= states('sensor.tech_home_away_temp_setpoint') | float + 0.5 %}true{% endif %}"
- condition:
- condition: state
- entity_id: sensor.boiler_current_mode
- state: 'Ogrzewanie'
- action:
- service: mqtt.publish
- data:
- topic: "otgw/set/central_heating/control_setpoint"
- payload: "0"
- # Set heating on slider change
- - alias: Set heating on slider change
- hide_entity: true
- initial_state: true
- trigger:
- platform: state
- entity_id: input_number.home_temp_setpoint
- action:
- service: script.check_and_heat
- # Automatic OTGW recovery
- - alias: Automatic OTGW recovery
- hide_entity: false
- trigger:
- platform: time_pattern
- minutes: "/5"
- seconds: 0
- condition:
- - condition: state
- entity_id: input_boolean.otgw_failure_detected
- state: 'on'
- action:
- - service: script.full_restart_otgw_mqtt_service
- # OTGW-MQTT recovered detection
- - alias: OTGW-MQTT recovered detection
- hide_entity: true
- initial_state: true
- trigger:
- platform: state
- entity_id: binary_sensor.otgw_mqtt
- from: 'off'
- to: 'on'
- for: '00:05:00'
- action:
- - service: input_boolean.turn_off
- entity_id: input_boolean.otgw_failure_detected
- # OTGW-MQTT recovered notification
- - alias: OTGW-MQTT recovered notification
- hide_entity: true
- initial_state: true
- trigger:
- platform: state
- entity_id: input_boolean.otgw_failure_detected
- from: 'on'
- to: 'off'
- action:
- - service: notify.my_homeassistant_samsung
- data:
- message: "Serwis OTGW-MQTT przywrócony automatycznie"
- data:
- priority: high
- url: /lovelace/heating
- script:
- ############################################ HEATING ############################################
- #Set home DHW setpoint
- set_home_dhw_setpoint:
- sequence:
- - service: mqtt.publish
- data_template:
- topic: "otgw/set/hot_water/temperature"
- payload: "{{ states('input_number.dhw_setpoint') }}"
- #Disable DHW
- dhw_disable:
- sequence:
- - service: mqtt.publish
- data:
- topic: "otgw/set/hot_water/enable"
- payload: "0"
- - delay:
- seconds: 2
- - service: script.restart_otgw_mqtt_service
- - delay:
- seconds: 2
- #Enable DHW
- dhw_enable:
- sequence:
- - service: mqtt.publish
- data:
- topic: "otgw/set/hot_water/enable"
- payload: "1"
- - delay:
- seconds: 2
- - service: script.restart_otgw_mqtt_service
- - delay:
- seconds: 2
- #Restart OTGW-MQTT service
- restart_otgw_mqtt_service:
- sequence:
- - service: mqtt.publish
- data:
- topic: "otgw/restart"
- payload: "1"
- #Restart OTGW-MQTT service full
- full_restart_otgw_mqtt_service:
- sequence:
- - service: mqtt.publish
- data:
- topic: "otgw/restart"
- payload: "1"
- - delay:
- seconds: 5
- - service: script.set_home_dhw_setpoint
- - delay:
- seconds: 1
- - service: mqtt.publish
- data_template:
- topic: "otgw/set/hot_water/enable"
- payload: >-
- {% if is_state('input_boolean.away_mode', 'on') %}
- 0
- {% else %}
- 1
- {% endif %}
- - delay:
- seconds: 1
- - service: script.set_ch_setpoint
- - delay:
- seconds: 1
- - service: script.check_and_heat
- - delay:
- seconds: 2
- - service: mqtt.publish
- data:
- topic: "otgw/restart"
- payload: "1"
- #Set CH setpoint
- set_ch_setpoint:
- sequence:
- - service: mqtt.publish
- data_template:
- topic: "otgw/set/central_heating/setpoint"
- payload: "{{ states('input_number.ch_setpoint') }}"
- #Stop OTGW-MQTT service
- stop_otgw_mqtt_service:
- sequence:
- - service: mqtt.publish
- data:
- topic: "otgw/stop"
- payload: "1"
- #Enable CH
- ch_enable:
- sequence:
- - delay:
- seconds: 2
- - service: mqtt.publish
- data:
- topic: "otgw/set/central_heating/control_setpoint"
- payload: "80"
- - delay:
- seconds: 2
- - service: script.restart_otgw_mqtt_service
- #Disable CH
- ch_disable:
- sequence:
- - delay:
- seconds: 2
- - service: mqtt.publish
- data:
- topic: "otgw/set/central_heating/control_setpoint"
- payload: "0"
- - delay:
- seconds: 2
- - service: script.restart_otgw_mqtt_service
- #Check and heat
- check_and_heat:
- sequence:
- - service_template: >
- {% if is_state('input_select.set_heat_or_not', 'Tak') %}
- {% if states('sensor.lowest_temp') | float <= states('sensor.tech_home_away_temp_setpoint') | float - 0.2 %}
- script.ch_enable
- {% else %}
- {% if states('sensor.lowest_temp') | float >= states('sensor.tech_home_away_temp_setpoint') | float + 0.2 %}
- script.ch_disable
- {% else %}
- {% if is_state('sensor.boiler_current_mode', 'Ogrzewanie') %}
- script.ch_enable
- {% else %}
- script.ch_disable
- {% endif %}
- {% endif %}
- {% endif %}
- {% else %}
- script.ch_disable
- {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement