I know there are more similar topics but in those I didn’t find a solution for my problem:
I have two automations to control a smart socket (Tuya-WOOX) that is connected to an electric blanket. In the first one the trigger is a button-press (Zigbee) and the action the toggle of the smart socket. This works, also when I am standing next to the socket with the button in my hand [my conclusion: both are within reach (Zigbee/WiFi)].
In the second one the trigger is a point of time (05:00:00) and the action is the switching off of the same smart socket. This one doesn’t work and generates an error message (see title) in the log file.
Check the history of your entity. If it’s going unavailable when your automation fires, then the action will fail.
There are two other issues I can see with your automation:
First one is an inconsistency - you’re using toggle to switch on, but turn_off to switch off. Try using toggle for both (and have a condition to check the state), or else use turn_on for your first automation.
Second issue is your trigger in the second automation - you’re using a time_pattern trigger, but what you really want is a time trigger. Learn the difference between the two or it might cause you issues down the line.
Thanks for your response. As both actions are valid (I think), I don’t understand why it should make a difference for the automation. But I will try it out. And I will certainly follow your other advises. I haven’t changed the automation, but for one or other reason this morning it worked. In between there was an update of HA, but I don’t really think that had any influence.
Check the history of your smart socket for the past week. I suspect it’s randomly going unavailable and you were lucky enough that it was available this morning when the automation fired at 5.
I checked the history already before and the entity is not going randomly unavailable, but only was missing at the time the automation fired. For what reason could it go randomly unavailable?
It could go unavailable for a number of reasons. In no particular order:
Network issues, such as low WiFi signal, changes in IP or your router set to automatically reboot at around 5 am
Cloud disconnection issue if you’re using the Tuya integration. They’re not exactly known to be reliable.
Power or temperature issues. Electric blankets draw a fair amount of power. Your plug might be rated at the very edge of this power, causing it to heat up over time & disconnect or shutdown.
Obviously the above are just assumptions based on the info you provided so far, but they are all valid possibilities. You will need to figure out what is causing the disconnect yourself
Thanks for the information. Indeed I am using the Tuya integration and also the strength of the WiFi isn’t great there. And this afternoon it is getting “unavailable” every 20 minutes or so. So I will look in that direction to improve things. Again, thanks for helping.
I studied the time trigger and the time pattern. They only differ in the number of variations that are available to specify the trigger-times. I don’t see how using the time-trigger might cause me issues?
In this particular case, it won’t cause you issues. There’s only 1 time pattern which matches hours: 5, and that’s 5am.
I was simply trying to warn you in case you do a similar automation where the time_pattern could match multiple times. Easier to get used to it now rather than have it cause you issues down the line.
PS: Note the warning below time_pattern in the docs too:
“Do not prefix numbers with a zero - using '01' instead of '1' for example will result in errors.”