im facing a very interesting behavior environment. maybe somebody of you got a tip for me how to tackle this…
What i want to archive: At the end very easy. i want, if somebody changes the temperature on the thermostat manual, to stop the automation for the room till end of the day. i tried it in the way to read out the context.id, context.parent_id & context.user_id of that particular change of the target temperature und set an input boolean with that. (like its described in the community)
i didnt get that working. if read out the contexts i saw a interesting thing.
for my case (change target temperature via UI, change via thermostat, change via automation) i always got this infos back.
context.id: not null
context.parent_id: None
context.user_id: None
so i cant differ between the input channels. anybody an idea whats wrong?
(sideinfo: HA within Docker, actual version connected to an Homemactic CCU3 for the heaters)
I am also trying to detect when a switch has been manually operated (opposed to by an automation or from the UI). In my testing when the switch is manually operated, payload.new_state.context.user_id and payload.new_state.context.parent_id are always null, so that is a good identifier. In testing, either user_id or parent_ id was not null, so I thought I had a solution. But I have found that randomly (maybe 2 times a day out of 10’s of automation runs) they will both be null if the switch is changed by an automation (I have not reliably tested if this is the case via the UI also), so I think there is a bug somewhere. I am going to do some more testing and write some specific logs to see if I can narrow this down. My automations are in node red and very simple. I am using sonoff zigbee switches and either a philips hue or an aqara motion sensor. I do not believe any of the devices are at fault, but need to test more.
Sorry, I should have said “In testing, either user_id or parent_ id was not null if the switch was operated by an automation or the UI, so I thought I had a solution”
There is no context data you can use to know if it was manual or not.
I created an issue on it a few months ago.
What @francisp posted is somewhat true. But there are some instances where you can’t see the difference between some of them. Can’t remember what the instance is now.
I see this as a big issue.
Especially if you have some type of switch based heating control.
If you manually switch on the switch when the temperature is above the target temperature the thermostat will not switch of the heating.
That is the main point of a thermostat, govern the temperature. But the HA thermostat doesn’t do that.
@Hellis81 I agree. My testing agrees broadly with @francisp message above, but randomly (it seems) both user_id and parent_id are set to null. So it is impossible to reliably detect manual switch operation. I cannot find a bug report which describes exactly this, but there is one [here] which may be related. Or not. I continue to test to see if I can come up with a way to reproduce the issue consistently.