@kylerw thanks for creating this, as I am beginning to learn some new ways of doing things. This is very interesting, as I have avoided using the self.set_state
function for a while, and it totally skipped me it had the ability to create entities within HASS.
The reason I avoided it was initially when I started writing apps, I used it as usual. At a point when I was using it to control entities like input_numbers
, which was used to in turn determine my media players’s volume level, I noticed some delays in execution time.
This got me to dig into the reason, and that was when I noticed the doc made mention of the fact it doesn’t change the state of the device, but just the state within Hass and it could be reverted back when the device is polled again. This also leads to it no longer reflects reality
, and it was advised to be used for testing purposes…
Since then I just avoided using it, forgetting the fact it also stated it could be used to create entities within Hass if it doesn’t exist, as it doesn’t check for if it exist unlike the call service function.
I will need to play a bit more with it, so I could understand its limitation. HA’s docs does state one can create binary_sensors
and sensors
only using http requests (which I believe is what set_state
does) in reference to what @ReneTode said . Now if one can use the self.set_state
function to do more based on what @swiftlyfalling said, that will be very interesting.
Regards