bob1de / hass-apps

Some useful apps and snippets to empower Home Assistant and AppDaemon even more.
Apache License 2.0
85 stars 23 forks source link

Tuya Zigbee Thermostat not reacting on one window #74

Open monsterflo opened 2 years ago

monsterflo commented 2 years ago

Hello All, I posted this in the HA forum twice but apparently nobody had a solution. So I give it another try here. I advanced in using Schedy for my heating schedules. The unsolved problem still is that the thermostats do not react when a window is opened. The used thermostats are Zigbee Tuya thermostats. After browsing the web I found a configuration that promised being the solution but it is not:

actor_type: thermostat
  actor_templates:
    default:
      off_temp: 5
      supports_hvac_modes: false

The log still states the following:

2022-03-01 20:15:10.616086 INFO schedy_heating: --> Attribute 'state' of 'binary_sensor.door_window_sensor_wc' changed from 'off' to 'on', reevaluating <Room R:wc>.
2022-03-01 20:15:17.592606 INFO schedy_heating: --> Attribute 'state' of 'binary_sensor.door_window_sensor_wc' changed from 'on' to 'off', reevaluating <Room R:wc>.

Can someone suggest anything to fix this?

Here is my schedy_heating.yaml

schedy_heating:
  module: hass_apps_loader
  class: SchedyApp

  actor_type: thermostat
  actor_templates:
    default:
      off_temp: 5
      supports_hvac_modes: false

  expression_environment: |
    def heating_mode():
        return state("input_select.heating_mode")

  schedule_snippets:

    ss_aus: 
    - v: 5

    ss_durchgehend_wohnen:
    - v: 21

    ss_durchgehend_sonstige:
    - v: 19

    ss_durchgehend_kids:
    - v: 20

    ss_abwesend:
    - v: 18
      start: "10:00"
      end: "20:00"

    ss_kz:
    - v: 20
      rules:
      - weekdays: 1-5
        rules:
        - { start: "07:30", end: "17:59" }
      - weekdays: 6-7
        rules:
        - { start: "08:00", end: "17:59" }
    - v: 18
      rules:
        - weekdays: 1-5
          rules:
          - { start: "18:00", end: "07:29" }
        - weekdays: 6-7
          rules:
          - { start: "18:00", end: "07:59" }

    ss_sz:
    - v: 20
      rules:
      - weekdays: 1-5
        rules:
        - { start: "07:30", end: "17:59" }
      - weekdays: 6-7
        rules:
        - { start: "08:00", end: "17:59" }
    - v: 18
      rules:
        - weekdays: 1-5
          rules:
          - { start: "18:00", end: "07:29" }
        - weekdays: 6-7
          rules:
          - { start: "18:00", end: "07:59" }

    ss_bz:
    - v: 20
      rules:
      - weekdays: 1-5
        rules:
        - { start: "07:00", end: "16:59" }
      - weekdays: 6-7
        rules:
        - { start: "08:00", end: "17:59" }
    - v: 18
      rules:
        - weekdays: 1-5
          rules:
          - { start: "17:00", end: "06:59" }
        - weekdays: 6-7
          rules:
          - { start: "18:00", end: "07:59" }

    ss_wz:
    - v: 21
      rules:
      - weekdays: 1-5
        rules:
        - { start: "05:30", end: "21:59" }
      - weekdays: 6-7
        rules:
        - { start: "05:30", end: "22:59" }
    - v: 18
      rules:
        - weekdays: 1-5
          rules:
          - { start: "22:00", end: "05:29" }
        - weekdays: 6-7
          rules:
          - { start: "23:00", end: "05:29" }

    ss_wc:
    - v: 19
      rules:
        - weekdays: 1-5
          rules:
          - { start: "07:30", end: "17:59" }
        - weekdays: 6-7
          rules:
          - { start: "08:00", end: "17:59" }
    - v: 18
      rules:
        - weekdays: 1-5
          rules:
          - { start: "18:00", end: "07:29" }
        - weekdays: 6-7
          rules:
          - { start: "18:00", end: "07:59" }

    ss_ki:
    - v: 20
      rules:
      - weekdays: 1-5
        rules:
        - { start: "08:00", end: "17:59" }
      - weekdays: 6-7
        rules:
        - { start: "09:00", end: "17:59" }
    - v: 18
      rules:
        - weekdays: 1-5
          rules:
          - { start: "18:00", end: "07:59" }
        - weekdays: 6-7
          rules:
          - { start: "18:00", end: "08:59" }

  watched_entities:
  - input_select.heating_mode

  schedule_prepend:
  - x: "Mark(OFF, Mark.OVERLAY) if not (is_empty(filter_entities('sensor', state='open', window_room=room_name))) else Next()"
  - x: "Mark(OFF, Mark.OVERLAY) if not (is_empty(filter_entities('sensor', state='tilted', window_room=room_name))) else Next()"
  - x: "Mark(OFF, Mark.OVERLAY) if not (is_empty(filter_entities('binary_sensor', state='on', window_room=room_name))) else Next()"
  - x: "IncludeSchedule(schedule_snippets['ss_abwesend']) if heating_mode() == 'abwesend/zeitgesteuert' else Next()"
  - x: "IncludeSchedule(schedule_snippets['ss_aus']) if heating_mode() == 'aus' else Next()"

  schedule_append:
  - value: "17"

  rooms:

    wc:
      allow_manual_changes: false
      actors:
        climate.zb_thermostat_eg_wc:
      watched_entities:
      - binary_sensor.door_window_sensor_wc
      schedule:
      - x: "IncludeSchedule(schedule_snippets['ss_wc']) if heating_mode() == 'anwesend/zeitgesteuert' else Next()"
      - x: "IncludeSchedule(schedule_snippets['ss_durchgehend_sonstige']) if heating_mode() == 'durchgehend aktiv' else Next()"

    sz:
      allow_manual_changes: false
      actors:
        climate.zb_thermostat_eg_kz2:
      watched_entities:
      - binary_sensor.door_window_sensor_kz_21
      - binary_sensor.door_window_sensor_kz_22
      schedule:
      - x: "IncludeSchedule(schedule_snippets['ss_sz']) if heating_mode() == 'anwesend/zeitgesteuert' else Next()"
      - x: "IncludeSchedule(schedule_snippets['ss_durchgehend_sonstige']) if heating_mode() == 'durchgehend aktiv' else Next()"

    kz1:
      allow_manual_changes: false
      actors:
        climate.zb_thermostat_eg_kz1_1:
        climate.zb_thermostat_eg_kz1_2:
      watched_entities:
      - binary_sensor.door_window_sensor_kz_11
      - binary_sensor.door_window_sensor_kz_12
      schedule:
      - x: "IncludeSchedule(schedule_snippets['ss_kz']) if heating_mode() == 'anwesend/zeitgesteuert' else Next()"
      - x: "IncludeSchedule(schedule_snippets['ss_durchgehend_kids']) if heating_mode() == 'durchgehend aktiv' else Next()"

    bz:
      allow_manual_changes: true
      rescheduling_delay: 60
      actors:
        climate.zb_thermostat_eg_bz:
      watched_entities:
      - binary_sensor.door_window_sensor_bz
      schedule:
      - x: "IncludeSchedule(schedule_snippets['ss_bz']) if heating_mode() == 'anwesend/zeitgesteuert' else Next()"
      - x: "IncludeSchedule(schedule_snippets['ss_durchgehend_sonstige']) if heating_mode() == 'durchgehend aktiv' else Next()"

Thanks in Advance Florian