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

Type definitions for getEntity() #27

Open
zoe-codez opened this issue Aug 25, 2024 · 0 comments
Open

Type definitions for getEntity() #27

zoe-codez opened this issue Aug 25, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@zoe-codez
Copy link
Member

🪤 Context

Feature isn't implemented yet

  const example = synapse.switch({  });
  example.getEntity().onUpdate(new_state => {
    //
  });

new_state: NonNullable<ENTITY_STATE<PICK_ENTITY<TRawDomains>>>

📬 Caveats

  • there isn't a straightforward way to go from entity to go from synapse entity -> hass entity in type definitions

Both suggested_object_id & unique_id are optional params, leaving name as the only guaranteed attribute. A fully automatic strategy doesn't seem viable here

🩻 Additional details

Probably can do a manual thing, limiting by platform and domain to trim down the options

const example = synapse.switch({  });
example.getEntity<"switch.example">().onUpdate(new_state => {
  //
});
@zoe-codez zoe-codez added the enhancement New feature or request label Aug 25, 2024
@github-staff github-staff deleted a comment Aug 27, 2024
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

No branches or pull requests

1 participant