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

V2 #5

Merged
merged 52 commits into from
Jun 2, 2024
Merged

V2 #5

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
198c417
working commit
zoe-codez Apr 15, 2024
7b177f8
wip
zoe-codez Apr 15, 2024
1d33d6e
catch up commit
zoe-codez May 7, 2024
20fa961
working commit
zoe-codez May 17, 2024
024d431
sync
zoe-codez May 17, 2024
e1ddef8
refactors for sensors
zoe-codez May 18, 2024
a87ace8
working commit
zoe-codez May 20, 2024
f1f6ec4
more sensor work
zoe-codez May 24, 2024
c73bad1
buttons & binary_sensors
zoe-codez May 24, 2024
82dc8c9
scene
zoe-codez May 24, 2024
3eed750
switches
zoe-codez May 25, 2024
91afa8d
acp
zoe-codez May 25, 2024
68d9579
breaking up types
zoe-codez May 25, 2024
b0a3287
building types
zoe-codez May 25, 2024
80bfad9
list of target domains
zoe-codez May 25, 2024
b6e1a4d
binary_sensor refactor
zoe-codez May 25, 2024
0fd0633
carrying through refactors to button
zoe-codez May 25, 2024
19075d2
locks
zoe-codez May 25, 2024
07d9655
number
zoe-codez May 25, 2024
76c6859
select
zoe-codez May 25, 2024
bd67bd4
alarm control panel
zoe-codez May 25, 2024
87026ac
text
zoe-codez May 25, 2024
802b34f
date, datetime, time
zoe-codez May 25, 2024
7b43d00
notify
zoe-codez May 25, 2024
7e4b0eb
domain fixin
zoe-codez May 25, 2024
8ad05a9
cover
zoe-codez May 25, 2024
415ce7b
fan
zoe-codez May 25, 2024
0e3b687
climate
zoe-codez May 25, 2024
d900842
update
zoe-codez May 26, 2024
3e9a2a1
media_player
zoe-codez May 26, 2024
e7bcd8b
humifier
zoe-codez May 26, 2024
0a033f4
lawn mower
zoe-codez May 26, 2024
ca1d293
vacuum
zoe-codez May 26, 2024
ef275a4
water heater
zoe-codez May 26, 2024
c81aae9
valve
zoe-codez May 26, 2024
6a60cc9
siren
zoe-codez May 26, 2024
a70bb22
light
zoe-codez May 26, 2024
2d79f37
camera
zoe-codez May 26, 2024
65e8a07
todo_list, remote
zoe-codez May 26, 2024
345f350
mass touchups
zoe-codez May 27, 2024
ad008eb
condensing bus
zoe-codez May 27, 2024
dd4b351
baseGet
zoe-codez May 27, 2024
b532ee3
bus transfer standardization
zoe-codez May 27, 2024
2c1b6b1
lint
zoe-codez May 27, 2024
69307d5
order of operations
zoe-codez May 28, 2024
c77162b
prettier printWidth
zoe-codez May 31, 2024
ec2da58
debugging
zoe-codez May 31, 2024
ba202ac
working commit
zoe-codez Jun 1, 2024
3d6d249
more wiring updates
zoe-codez Jun 1, 2024
278fa8d
wiring upgrades
zoe-codez Jun 1, 2024
74f55d7
core batch
zoe-codez Jun 2, 2024
365834c
readme
zoe-codez Jun 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .entity_generator
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[hass]
BASE_URL=http://localhost:9123
TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhYTdjOGQ5MzBiMDM0MDM2OGVjZTdjOTRjMTcyOWQ0OSIsImlhdCI6MTcxNDYwMzkyMywiZXhwIjoyMDI5OTYzOTIzfQ.Tvoh25bukQh5T5WIuvvkL9jVBihcOGG6D5JYdqdwx1U
3 changes: 1 addition & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
"unicorn/no-empty-file": "off",
"sonarjs/prefer-single-boolean-return": "off",
"unicorn/no-array-callback-reference": "off",
"@typescript-eslint/unbound-method": "off",
"unicorn/no-await-expression-member": "off",
"unicorn/no-useless-undefined": "off",
"@typescript-eslint/unbound-method": "error",
"import/no-extraneous-dependencies": [
"error",
{
Expand Down Expand Up @@ -72,7 +72,6 @@
"unicorn/prefer-node-protocol": "off",
"unicorn/no-array-for-each": "off",
"unicorn/import-style": "off",
"sonarjs/cognitive-complexity": "off",
"sort-keys-fix/sort-keys-fix": "warn",
"unicorn/prefer-event-target": "off",
"simple-import-sort/imports": "warn",
Expand Down
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"singleQuote": false,
"trailingComma": "all",
"jsxSingleQuote": false,
"printWidth": 100,
"arrowParens": "avoid"
}
22 changes: 22 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Attach to process",
"type": "node",
"request": "attach",
"port": 9229,
"skipFiles": [
// Node.js internal core modules
"<node_internals>/**",

// Ignore all dependencies (optional)
// "${workspaceFolder}/node_modules/**",
// "!${workspaceFolder}/node_modules/@digital-alchemy/**",
],
}
]
}
34 changes: 5 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Welcome to `@digital-alchemy/synapse`!
This project builds on the functions provided by `@digital-alchemy/hass` to provide the ability to generate entities within your Home Assistant install. With the help of a [custom component](https://github.com/Digital-Alchemy-TS/synapse-extension), you can gate logic behind switches, report states with sensors, attach functions to buttons, and more!

- [Extended docs](https://docs.digital-alchemy.app/Synapse)
- [Discord](https://discord.com/invite/mtWHk36upW)
- [Discord](https://discord.gg/JkZ35Gv97Y)

## 💾 Install

Expand Down Expand Up @@ -52,10 +52,12 @@ export function Example({ scheduler, context, synapse }: TServiceParams) {
// create a new phrase
// taking into consideration the current state of the switch
const regenerate = () => {
sensor.state =
sensor.storage.set(
"state",
useHacker.state === "on"
? faker.hacker.phrase()
: faker.company.catchPhrase();
: faker.company.catchPhrase()
);
};

// update sensor every 10 minutes
Expand All @@ -73,32 +75,6 @@ export function Example({ scheduler, context, synapse }: TServiceParams) {
}
```

> Names should be unique per domain!

### 🔌 Automatic availability reporting

A `binary_sensor.{app_name}_online` will be created and managed by the extension. This binary sensor will display the connected state of your application and is always available. All other entities owned by this application will have their `availability` state tied to the online state.

When your application disconnects, it emits a "going offline" message to automatically flag entities. Applications also emit a heartbeat that the custom component uses to identify more sudden failures.

### 🔁 Reloading in Home Assistant

By default, applications don't automatically send their current list of entities to Home Assistant. To trigger an update/resync with your application and the custom component, use the `reload` button.

![reload button](./docs//reload.png)

## 🌐 Supported Domains

Current support includes

| Domain | Notes |
| --------------- | ------------------------------------------------------------- |
| `binary_sensor` | reports an `on`/`off` state, not much else |
| `button` | create a quick callback to some code on your dashboard |
| `sensor` | report `string`/`number`/`date` states, as well as attributes |
| `switch` | create virtual switches to gate logic with |
| `scene` | slightly different buttons, bring your own scene setting logic|

## 🤝 Related Projects

| GitHub | Description | NPM |
Expand Down
21 changes: 20 additions & 1 deletion cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,26 @@ ignorePaths: []
dictionaryDefinitions: []
dictionaries: []
words:
- hass
- alexa
- cbar
- comms
- datetime
- desync
- endregion
- gbit
- gotify
- hass
- homeassistant
- hvac
- kbit
- mbar
- mbit
- programminghorror
- rgbw
- rgbww
- sonarjs
- tvshow
- utcnow
- zeroconf
ignoreWords: []
import: []
Loading
Loading