Hello everyone.
I need help to create a home automation assistant using broadlink rm.
I created a swicth.
switch 1:
platform: broadlink
host: 192.168.1.4
mac: ‘B4:43:0D:38:62:18’
timeout: 15
switches:
luce:
friendly_name: “Luce Sala”
command_on: '6Qs0AA0hIwsjCwwhIwsNIQ0hD…
command_off: '6Qs0AA0hIwsjCwwhIwsNIQ0h……
I would make sure that given the on command after 20 seconds the off command is activated automatically.
Can it be done? What do I enter and where? Thank you.
If I understood your question right, you want to turn off after the switch is turned on for 20 seconds? You could write an automation with trigger as the state of the switch (to: 'on’), and use for:.
- alias: Turn Off After 20 Seconds
trigger:
- platform: state
entity_id:
- switch.xxx
to: 'on'
for:
seconds: 20
action:
- service: switch.turn_off
entity_id: switch.xxx
The above automation triggers when the switch state goes to ‘on’ mode for 20 seconds, and it turns off the switch. When you copy the code, you may want to replace xxx with the actual entity_id.
I am not sure if that is your entire configuration or part of it, Please format the code when pasting here, so that it renders correctly and folks can spot any formatting or indentation issues. To format the code you can use three backtics, hit enter, paste your code, hit enter and type three back ticks. Here is an example
Also, the automation code I pasted above goes into the automations.yaml file. If the code is not properly indented, or placed in wrong place, you might get configuration errors.
Please try again. This is still not the correct formatting. You used three single quote characters, not three “back tick” characters. I’m not sure about all keyboards, but on mine, it’s the top-left most key, above the Tab key and to the left of the “1” key. You need to format your code correctly so we can see the exact spacing. I’m pretty sure your problem is incorrect spacing.
Thanks for the proper formatting. There might be other issues, but one that jumps out is the entity_id of the switch. I believe it should be switch.luce, not switch.1.
As @pnbruckner mentioned, the entity_id looks suspicious. Also, what error are you getting? If you can post the complete error message and the source code, that will be great. If you are looking for immediate help, you may join here and post the same https://discord.gg/c5DvZ4e