Thermostatic Radiator Valve Controller TS0601 automation

Hi,

i integrated many devices in HA with ZHA and everything went fine.
Now i tried to make my first automation with a TS0601 (Hysen Thermostatic Radiator Valve Controller HY368 Zigbee compatibility).
On the lovelace it works pretty good. I can see the actual temperature and can steer the temperature that the thermostat should heat. But when i try to an automatic steering it wont work (mainly im the problem i think).
As entities there are three:

  1. switch.thermostat_on_off
  2. sensor.thermostat_power
  3. climate.thermostat_thermostat

with (1) i can him switch on and off (works) about the interface
with (2) i can readout the batterystatus (i think it works too, 100% with new batteries) in the interface
with (3) i can see the actual temperature, can steer the temperature he should heat to and select some “Modes” (none, away, schedule, comfort, eco, boost, complex)

I want a time steered automation like from 17:00 21C and from 23:00 15C and additional when the switch is pressed 24C for 1h.
Like i said on the lovelace interface i can all switch manually. But i cant get an automation run. I cant handle the temperatures. I can only switch the “modes” or turn it on and off.

The signature of the thermostat is

{
  "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)",
  "endpoints": {
    "1": {
      "profile_id": 260,
      "device_type": "0x0301",
      "in_clusters": [
        "0x0000",
        "0x0001",
        "0x0004",
        "0x0005",
        "0x0006",
        "0x0201",
        "0x0204",
        "0xef00"
      ],
      "out_clusters": [
        "0x000a",
        "0x0019"
      ]
    }
  },
  "manufacturer": "_TZE200_cwnjrr72",
  "model": "TS0601",
  "class": "zhaquirks.tuya.ts0601_trv.MoesHY368_Type1"
}

In the developer section i found this:

and i took a working automation, where i can set the “modes” and tried to replace it with the variables out of this. So i tried to cange

alias: Thermostatsteuerung Badezimmer
description: ''
trigger:
  - platform: time
    at: '22:30'
condition: []
action:
  - device_id: 52601c1c5427b02e73feacda89b57202
    domain: climate
    entity_id: climate.thermostat_thermostat
    type: set_preset_mode
    preset_mode: away
mode: single

in

alias: Thermostatsteuerung Badezimmer
description: ''
trigger:
  - platform: time
    at: '22:30'
condition: []
action:
  - device_id: 52601c1c5427b02e73feacda89b57202
    domain: climate
    entity_id: climate.thermostat_thermostat
    type: set_occupied_heating_setpoint
    occupied_heating_setpoint: 1650
mode: single

But i get a “Message malformed: not a valid value for dictionary value @ data[‘type’]”
I think there are some missing variables this script cant reach.
Whatever i found this topic here and i think this was the same or similar problem:

but i dont get a clue how to work with these informations. Maybe someone can give me a tip what is wrong here and where and what i have to read to understand the automations on a very easy level to get this thing started (i dont even understand the meaning of quirks…).
Im a very newbee and maybe automation is not so easy as it seems, but maybe someone can help me.

Thanks and regards from germany

Dirk

Have you considered making a generic thermostat and using schedule?

This is the simple thermostat card and schedule. This is a physical thermostat but it will work the same way.

Wow, seems to be complicate bu i will try it out. First i try to install hacs for it. Maybe i need to get some help with the generic thermostat (like i said: im a bloody beginner without a clou how the system is working, but willingly to learn)…
Thanks for the advice

For the generic thermostat all you have to do is use the below code as a template in configuration.yaml: Generic Thermostat is built in to core.

#
#Create a generic Thermostat for family room fireplace
#Use Temperature sensor located on Family Room East wall
#
climate:
  - platform: generic_thermostat
    name: Family Room Fireplace
    heater: switch.family_room_fireplace
    target_sensor: sensor.multisensor_6_air_temperature
    min_temp: 45
    max_temp: 78
    target_temp: 50
    away_temp: 45
    initial_hvac_mode: heat

Hacs can be complicated but is worth the effort. It opens up a lot of code written by others who are more knowledgeable.

I should have also answered your question - apologies:

Here is a solution by @123 that will work for both weekdays and weekends with different times. You will need to create a binary sensor in helpers that allows you to turn on/off the system.

alias: example
description: ''
trigger:
  - id: 'schedule'
    platform: time
    at:
      - '06:00'
      - '08:00'
      - '15:00'
      - '20:00'
      - '21:00'
      - '22:00'
  - id: 'override'
    platform: state
    entity_id: binary_sensor.tuer_balkon_onoff
    to: 'on'
    for: '00:01:00'
  - id: 'disable'
    platform: state
    entity_id: binary_sensor.tuer_balkon_onoff
    to: 'off'
    for: '00:02:00'
condition: []
action:
  - choose:
      - conditions:
          - "{{ trigger.id != 'disable' }}"
          - "{{ is_state('binary_sensor.tuer_balkon_onoff', 'on') }}"
        sequence:
          - variables:
              weekday:
                6: 17
                8: 24
                15: 20
                20: 22
                22: 20
                24: 17
              weekend:
                8: 17
                21: 24
                22: 20
                24: 17
              schedule: "{{ weekday if 1 <= now().isoweekday() <= 5 else weekend }}"
          - service: climate.set_temperature
            target:
              entity_id: climate.thermostat_kueche
            data:
              hvac_mode: 'heat'
              temperature: "{{ schedule.get(schedule.keys() | select('>', now().hour) | first, 21) }}"
      - conditions:
          - "{{ trigger.id == 'disable' }}"
        sequence:
          - service: climate.turn_off
            target:
              entity_id: climate.thermostat_kueche
    default: []
mode: single

These are time (hour) and temperature (C)

              weekday:
                6: 17
                8: 24
                15: 20
                20: 22
                22: 20
                24: 17
              weekend:
                8: 17
                21: 24
                22: 20
                24: 17

the default temperature is 21.

temperature: "{{ schedule.get(schedule.keys() | select('>', now().hour) | first, 21) }}