What is wrong in my blueprint code? (Bosch TRV - Remote Temperature Sync. Automation)

Hello,

First of all, I am not familiar with this language code is created with ChatGPT. Is it structured text?

I am using Bosch TRV with Zigbee2MQTT and trying to create blueprint for automation that needs to get temperature from external thermistor and set this value in Bosch TRV remote_temperature. This needs to be triggered either value change on external thermistor or configurable time is elapsed. Additionally, it needs to set window mode depending on selected contact sensor. For Contact sensor, since I could not make sensor selection optional I have created dummy sensor which will be always false/closed.

Blueprint:

blueprint:
  name: Bosch TRV Automation
  description: Automate Bosch TRV with optional sensors
  domain: automation
  input:
    bosch_trv:
      name: Bosch TRV
      description: The Bosch TRV Zigbee2MQTT entity
      selector:
        entity:
          domain: climate
    temperature_sensor:
      name: Temperature Sensor
      description: The sensor providing the current temperature value
      selector:
        entity:
          domain: sensor
          device_class: temperature
    window_sensor:
      name: Window/Door Sensor
      description: The sensor detecting window/door status
      selector:
        entity:
          domain: binary_sensor
      default: binary_sensor.dummy_contactSensor
    timer_interval:
      name: Timer Interval
      description: Set the interval for periodic updates (in minutes)
      selector:
        number:
          min: 1
          max: 30
          step: 1
          unit_of_measurement: "min"
          mode: box

trigger:
  - platform: state
    entity_id: !input temperature_sensor
  - platform: state
    entity_id: !input window_sensor
  - platform: time_pattern
    minutes: "{{ !input timer_interval }}"

action:
  - choose:
      - conditions:
          - condition: template
            value_template: >
              {{ trigger.entity_id == states('input_temperature_sensor') }}
        sequence:
          - service: mqtt.publish
            data:
              topic: >
                zigbee2mqtt/{{ states('input_bosch_trv').split('.')[1] | lower }}/set
              payload: >
                {"remote_temperature": "{{ states('input_temperature_sensor') }}"}
      - conditions:
          - condition: template
            value_template: >
              {{ trigger.entity_id == states('input_window_sensor') }}
        sequence:
          - service: mqtt.publish
            data:
              topic: >
                zigbee2mqtt/{{ states('input_bosch_trv').split('.')[1] | lower }}/set
              payload: >
                {"window_detection": "{{ "ON" if is_state('input_window_sensor', "on") else "OFF" }}"}
  - service: mqtt.publish
    data:
      topic: >
        zigbee2mqtt/{{ states('input_bosch_trv').split('.')[1] | lower }}/set
      payload: >
        {"remote_temperature": "{{ states('input_temperature_sensor') }}"}

  1. While I am using blueprint it gives me error for line 43 (minutes: “/{{ (timer_interval | int) }}” If I do this '1’for test for example I can create automation.
    Error: Message malformed: invalid time_pattern value for dictionary value @ data[‘minutes’]
  2. When I trigger automation, it does not set any value. When I was seeing log of zigbee2MQTT I saw that, device name is gotten unknown by automation. And also in the trace I can see that it could not get device name of TRV(last screenshot can be seen) After that I played with code again now it doesn’t give Z2M log but when I see trace, now temperature is unknown I am sure that TRV and thermistor working.

Trace:

Reference for Bosch TRV: Bosch BTH-RA control via MQTT | Zigbee2MQTT

Hello zer02pi,

First of all, ChatGPT is not trained for the language of Home Assistant, so much of the time it makes stuff up and guesses. Never trust it as your final answer, it is usually wrong.

Then I think this is your problem.

In addition, that is a Trigger so you need a triffer_variable: