Set target temperature half a degree lower than target temperature of another entity

Hi,

I have a Aqara TRV connected to HA using zigbee2mqtt. The device shows up in HA and I can control it manually, all works fine

Now I want to create an automation to set the target temp half a degree lower than the target temperature of another entity.

The trigger part of the automation seems easy to configure:

The issue I’m running into is that I can only enter a numeric value in the action. I want take the target temperature of the entity half minus half a degree

The way I’m trying to configure the action is probably wrong, but not sure how it could be done.

It’s easily done.
But post what you have in yaml instead of pictures.
Just add a fixed temperature on the device you want to set the temperature on and we will help you with the template.

Remember to format the code with the </> button

Thanks for the reply. I’ve done some more research on how to do this and tried a few things. I’ve gotten this far and seems to work ok. Could this be improved?

alias: Set Aqara TRV half degree lower than Tado
description: "Set Aqara TRV half degree lower than Tado with a "
triggers:
  - trigger: state
    entity_id:
      - climate.hal
    attribute: temperature
conditions: []
actions:
  - action: climate.set_temperature
    metadata: {}
    data:
      temperature: "{{ state_attr('climate.hal', 'temperature') | float - 0.5 }}"
    target:
      device_id: e048a759c7a7c881e5e6f45f98fe73d3
mode: single

That’s how I would do it, except for the device action.
I would rather use the normal action (call service)

I tried to change the action to a call serice. Could it be possible that ‘call service’ is now ‘perform action’ in HA? At least that is what the drop down tells me when I try to select ‘call service’ from the drop down with options when adding a Action to my automation.

I continued anyway using the ‘perform action’ option but the YAML seems almost exactly the same as the previous way I did this. Or am I missing something here?

Thanks again for your time and response.

alias: Set Aqara TRV half degree lower than Tado as a service
description: "Set Aqara TRV half degree lower than Tado with a "
triggers:
  - trigger: state
    entity_id:
      - climate.hal
    attribute: temperature
conditions: []
actions:
  - action: climate.set_temperature
    target:
      device_id: e048a759c7a7c881e5e6f45f98fe73d3
    data:
      temperature: "{{ state_attr('climate.hal', 'temperature') | float - 0.5 }}"
mode: single

If you use the perform action then you shouldn’t see the device id.
Making automation based on devices is bad form since it could/will cause issues later.
You should see entity_id

1 Like

RE device_id’s: Why and how to avoid device_ids in automations and scripts

1 Like