Changing Entity to Device

Hi all, I’ve searched but am so new to HA that I may have even misunderstood what I am really looking for. ng up and running and have all my Nest products working with BadNest. The are all there in the entity section but when I come to do an automation I cannot find the Thermostat as a device.

I want to be able to turn the heating to ECO when the back door is open but to do this in automations I need a device and not an entity.

Im sure I’ve just asked a stupid question but for the life of me I have been going round in circles for a couple of days so I feel its time to ask.

Hope you can help.

There is a growing misconception that you need a device to create an automation. That is not true. Every entity can be used to create an automation. Simply select a state trigger, choose your entity and what state it changed to, and voila, all you need.

1 Like

Go to Developer Tools > States and find the two entities that represent your back door (probably a binary_sensor entity) and your thermostat (a climate entity).

You will be creating an automation that uses a State Trigger, meaning the automation is triggered when the state of the binary_sensor (representing your back door) changes to on. The automation’s action will execute the service called climate.set_hvac_mode for the climate entity (that represents your thermostat) and set hvac_mode to eco.

Here’s a rough example:

automation:
- alias: Rough Example
  trigger:
    platform: state
    entity_id: binary_sensor.my_back_door
    to: 'on'
  action:
    service: climate.set_hvac_mode
    data:
      entity_id: climate.my_badnest_thing
      hvac_mode: eco

To be clear, this automation only sets eco mode when the door is open. It does nothing when the door is closed (but can be modified to handle that as well).

Thanks for this. It appears from the answers I need to dive in and teach myself more about this sytem. Are you able to recommend any documentation or websites for beginners?

The documentation covers most everything you will need (and is more up to date than other sources, notably videos). For automations, start here:

Hi all again,

I’m finally getting somewhere here but I cannot get the delay function to work at all. It gives me no errors but simply refuses to work. If I remove the delay it operates as expected.

Ive put the delay everywhere within the code but to no avail. Again I’m sure its a schoolboy error but for the life of me I cannot sort it.

Your help as always is greatly appeciated.

- alias: Stat Control Back Door ECO
  trigger:
    platform: state
    entity_id: binary_sensor.konnected_back_door
    to: 'on'
  action:
    service: climate.set_preset_mode
    data:
      delay: '00:00:30'
      entity_id: climate.living_room_thermostat
      preset_mode: eco
     
- alias: Stat Control Back Door HEAT
  trigger:
    platform: state
    entity_id: binary_sensor.konnected_back_door
    to: 'off'
  action:
    service: climate.set_preset_mode
    data:
      entity_id: climate.living_room_thermostat
      preset_mode: none

In the example you posted, the location of delay is incorrect. A delay is not an option of any service call.

Move delay out of the service call so that it stands alone. In the following example, execution of action will first pause for 30 seconds before the next step which is to call the climate.set_preset_mode service. Note how the hyphens are used.

  action:
    - delay: '00:00:30'
    - service: climate.set_preset_mode
      data:
        entity_id: climate.living_room_thermostat
        preset_mode: eco
1 Like

Perfect, wrong place and my indentation was all over the show and no hyphens.

Thanks so much again. I will get there.

2 Likes

the way you wrote your action section in that code was fine as far as indentation and hyphenation. It was just that the delay needed moved out of the service call.

you only need to hyphenate actions if you use more than one “thing” in the action.

Since you now have a “delay:” and a “service:” then each item in the list needs to be separated by a hyphen.