-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does this still work even with the 2022.3 update of HA? #4
Comments
You are absolutely right. This is likely broken against version 2022.3 and later. I don't actually use this custom component any longer, so a it'll be a bit before I can get around to setting up an environment to test the fix. However, as I sent the PR for the pyscript fix, I'm pretty sure the fix in this case is the same. I'll happily accept a PR from anyone able to do so. Otherwise, I'll try to get to this later this week. |
Thanks for your response. Maybe you can help me use the method provided by pyscript to set an entity and persist it. # Set State (persist)
def set_state(entity_id=None, value=None, friendly_name=None, icon=None, unit_of_measurement=None, new_attributes=None):
options = { "friendly_name": friendly_name }
if icon is not None:
options['icon'] = icon
if unit_of_measurement is not None:
options['unit_of_measurement'] = unit_of_measurement
if new_attributes is not None:
for key in new_attributes:
options[key] = new_attributes[key]
setter.set(entity_id=entity_id, state=str(value), attributes=options) I can try to create a PR for this project too, but unfortunately I'm pretty busy at the moment. |
pyscript is unable to persist entities outside of the "pyscript." domain. It isn't that Home Assistant doesn't allow it, but the pyscript code specifically checks for and refuses to persist any entity that isn't "pyscript.*". If you need persistence (i.e. restoring of state), then hass-setter, as you are using it, is one way to get that. If your pyscript code is capable of recalculating state at startup without the need for persistence, you can just use "state.set(entity_id, value)". |
Hi,
After seeing an issue (custom-components/pyscript#331) in the pyscript project, I was wondering if there may be a similar problem with this component too.
Thanks for your response,
Maxime
The text was updated successfully, but these errors were encountered: