What is wrong with this configuration?

image
I have this masterbedroom fan that i can control manually from my app, but this automation wont turn it off at 9am

Before this new build, i used node red for most of my automations… but i havent set that up yet, so want to try and control using the automations within HA

No matter the order i put these triggers/conditions/actions it doesnt turn it off.

Your trigger and condition look fine.

The automation.turn_off you are using as your action is incorrect. That service call disables an automation… you need to turn a fan off. The correct service is fan.turn_off. In the UI editor it looks like:

1 Like

thank you, i have made the change and will see if tomorrow morning the light is in fact off.

Then in this case you have to call the service light.turn_off.

Also, after selecting the service you will call you have also to select the entities to which the service will run. I mean, you have to select the entity (or a device or an entire area) for your light so the service knows which light(s) to turn off.

So this is the setup i save lastnight to test this morning… and come to find the light it still on… i have to be missing something else…

It is much easier for people here on the forum to help you debug if you post the YAML configuration and the Traces. These can be found by clicking on the 3-dot menu on the top right while in the automation editor.

Troubleshooting Automations

The reason im here is because i dont know what to ask, if i knew to provide that information i would have already.

alias: MasterLight
description: ""
trigger:
  - platform: time
    at: "09:00:00"
condition:
  - condition: state
    entity_id: switch.shelly1_c4f524
    state: "on"
action:
  - service: light.turn_off
    data: {}
    target:
      device_id: 12c421fe67b096fc139cc3829bdd9bbc
mode: single

image

1 Like

If your light is controlled by the Shelly switch you have to call the service switch.turn_off instead.
Or set your Shelly to identity itself as a light.

Try this:

alias: MasterLight
description: ""
trigger:
  - platform: time
    at: "09:00:00"
condition:
  - condition: state
    entity_id: switch.shelly1_c4f524
    state: "on"
action:
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.shelly1_c4f524
mode: single

By the way, you don’t have to wait until tomorrow morning to try this. As your automation is triggering at 9AM (you ca confirm this with your trace) the problem is on the action part. If you click in that same menu in the top right and select “Run”, it will ignore your trigger and conditions and will run all the actions, which is the part where the error is. So, fix the error and force a run, if everything works as expected, then wait until 9AM to check your trigger… :wink:

If you want to go this way, which I will definitely do, just open your Shelly app, select this device and go to Settings > Appliance type and the select “Light”. You probably will have to remove and add your Shelly again on Home Assistant.

thank you for the information and suggestions, will def try when i get home.
LOL funny story on why im trying to do this automation in HA… So little back story and im sure you can find my other post on my first HA corruption issues i experienced. So last year down south we had a hard freeze the crippled the city for a bit… Well prior to that i had spent all this time setting up automations and what not in HA on my RPI, well we had a few quick/short brown outs and then a few days without power, once things got back to normal, realized that my HA build was corrupt, along with that, my shelly was not longer acknowledged in my app either… so left things alone, but realized that the device was still working as originally programmed… and because i couldnt control it from the app anymore, this time around i was looking to control it via HA since it was controllable from it. (being lazy instead of just factory resetting the device and starting over from the app… )

If i have time this weekend, i guess i will hard reset the shelly and get it back into the app and reset in HA…but if the above works, that will buy me some time for now until i can do the resets.

That’s why this FAQ was created to help new users understand what’s needed to help them in the most efficient manner.

In this case, guidelines 11 and 14 are applicable (post a formatted copy of your automation as opposed to a screenshot).

It’s much easier for experienced users to examine the YAML version of your automation. Plus it allows us to easily edit it, to make corrections, and share it with you.


Tip

Try to avoid referencing an entity by its device_id. If you ever need to replace the device, it will be automatically assigned a new device_id value. As a result, any automation that referenced the device by its device_id will still have the old value and have to be manually updated. Opt for referencing an entity by its entity_id.

1 Like

Thank you for the assistance, i made the change to switch off and did the “run” to test and works… so verifying tomorrow morning to see it in action.

1 Like