Hi, in my automation I need to set an attribute (temperature setpoint) of a generic_thermostat device.
When I call self.set_state(self.args["device"], attributes={"temperature": value})
it seems to work, I see the new value on the panel; but after some minutes, the old temperature value is restored.
As to turn_on/turn_off, on documentation it seems these functions cannot accept attributes on HASS; I’ve tried but I only got error 400 from HA’s API.
I cannot invoke a service as generic_thermostat can only do “reload”.
What else can I do?
If you’re trying to set a temp of a thermostat, you should be using call_service() method, not set_state(). The turn_on() and turn_off() methods are only helper methods that wrap the call_service() method which can pass various parameters to a service.
Yep, I had missed that.
I called this service:
self.call_service('climate/set_temperature', entity_id=self.args["device"], temperature=<value>)
and it worked. Thanks.