-
Notifications
You must be signed in to change notification settings - Fork 58
pyscript and Home Assistant entity #270
-
Hello :)
Is it possible to create an Home Assistant entity using pyscript?
I would like to create a custom thermostat like generic_thermostat to insert in Home Assistant climate.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 3 replies
-
It is possible, yes. But pyscript doesn't provide you with any assistance to do so. So you're going to need to dig through the Home Assistant Docs as well as the code for the climate platform to work out the details. To do most of this stuff you're going to want to configure hass_is_global and then use the hass
object to get the instantiated objects from hass
for the Entity Registry and such.
It's not an easy road, and there isn't a tutorial for this that I've found in Home Assistant. However, minus the setup
stuff, it mostly similar to writing a Home Assistant integration. So, you can likely gain some insight by reviewing the code for "generic_thermostat", too.
Beta Was this translation helpful? Give feedback.
All reactions
-
thank you so much
Beta Was this translation helpful? Give feedback.
All reactions
-
Any thoughts on whether pyscript could/should add direct support for this? There are some powerful use cases - I was looking at magic_areas as an inspiration. I would love to leverage pyscript to create a higher level of abstraction and 'automagic' configuration to make basic use cases in HA much simpler (this is my love/hate relationship with HA coming out: it's potential for customization is unlimited, but the simple stuff is obnoxiously over-complicated, IMO).
Beta Was this translation helpful? Give feedback.
All reactions
-
I feel that pyscript should. I have an open PR to provide exactly this functionality (though it's quite outdated now, so if interest in it is renewed, it'll need to be rebased).
That being said, it's not incredibly complex to do it without help from pyscript. Your code just ends up looking like code in an Integration instead of typical pyscript looking code.
Beta Was this translation helpful? Give feedback.