Digital-Alchemy-TS / Digital-Alchemy-TS/synapse

Type definitions for getEntity()

Open
#27 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
3
Forks
1
PR merge metrics
No merged PRs in 30d

Description

## 🪤 Context

Feature isn't implemented yet

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

> `new_state: NonNullable>>`

## 📬 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

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.