Skip to content

Instantly share code, notes, and snippets.

@ipeacocks
Created November 21, 2021 02:19
Show Gist options
  • Select an option

  • Save ipeacocks/4ac4cc88840819b6c51cd878b9e70ad1 to your computer and use it in GitHub Desktop.

Select an option

Save ipeacocks/4ac4cc88840819b6c51cd878b9e70ad1 to your computer and use it in GitHub Desktop.

Revisions

  1. ipeacocks created this gist Nov 21, 2021.
    42 changes: 42 additions & 0 deletions TS0601_valve.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    blueprint:
    name: Temperature Calibration
    description: Temperature calibration for Zigbee valve TS0601, according to external temperature sensor
    domain: automation
    input:
    valve:
    name: Smart Valve
    selector:
    entity:
    domain: climate
    temp_sensor:
    name: Temperature Sensor
    selector:
    entity:
    domain: sensor
    device_class: temperature

    variables:
    valve: !input "valve"
    temp_sensor: !input "temp_sensor"

    trigger:
    - platform: time_pattern
    minutes: "/10"
    - platform: template
    value_template: "{{ ( state_attr(valve, 'current_temperature')|float - states(temp_sensor)|float)|abs > 0.25 }}"
    for: '00:00:02'
    condition:
    condition: and
    conditions:
    - condition: template
    value_template: "{{ states(temp_sensor) != 'unavailable' }}"
    - condition: template
    value_template: "{{ states(temp_sensor) != 'unknown' }}"
    action:
    - service: mqtt.publish
    data_template:
    topic: "zigbee2mqtt/{{state_attr(valve,'friendly_name')}}/set/local_temperature_calibration"
    payload_template: >-
    {{(state_attr(valve,'local_temperature_calibration')|float -
    state_attr(valve, 'current_temperature')|float +
    states(temp_sensor)|float + 128)|round(1,'half')}}