Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

pyscript and Home Assistant entity #270

Unanswered
bigbread59 asked this question in General
Discussion options

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.

You must be logged in to vote

Replies: 1 comment 3 replies

Comment options

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.

You must be logged in to vote
3 replies
Comment options

thank you so much

Comment options

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).

Comment options

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /