Skip to content
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

Add the ability to set state / attributes with entity proxies #8

Merged
merged 1 commit into from
Mar 23, 2024

Conversation

zoe-codez
Copy link
Member

@zoe-codez zoe-codez commented Mar 23, 2024

Entity proxies will now emit state & attribute updates if assigned to. These happen via the rest api, and are not sync

function Example({ hass }: TServiceParams) {
  const entity = hass.entity.byId("binary_sensor.foo");
  async function MyWorkflow() {
    entity.state = "off";
    // wait for hass to confirm if that matters
    await entity.nextState();
    await sleep(1000);
    entity.state = "on";
  }
}

@zoe-codez zoe-codez added the enhancement New feature or request label Mar 23, 2024
@zoe-codez zoe-codez self-assigned this Mar 23, 2024
@zoe-codez zoe-codez merged commit 17a3386 into main Mar 23, 2024
1 check passed
@zoe-codez zoe-codez deleted the entity_proxy_set branch March 23, 2024 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant