Skip to content

Commit

Permalink
fix vm, cleanup listener
Browse files Browse the repository at this point in the history
  • Loading branch information
grrowl committed Jan 28, 2024
1 parent 59b93fa commit 00ce4fe
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 682 deletions.
12 changes: 6 additions & 6 deletions README.md
Expand Up @@ -10,18 +10,18 @@ Control your homebridge instance with Javascript.
(sorry this is so gnarly, we can improve the interface in `PLATFORM_SCRIPT`)

```js
function onMessage(event) {
automation.listen(function (event) {
if (event.type === "Lightbulb") {
}
if (event.name === "Book Globe") {
}
}
});
```

When Dummy Switch is turned on, wait 5 seconds, then turn it Off.

```js
function onMessage(event) {
automation.listen(function (event) {
if (event.name === "Dummy Switch") {
const On = event.serviceCharacteristics.find((c) => c.name === "On");

Expand All @@ -34,13 +34,13 @@ function onMessage(event) {
return false;
}
return null;
}
});
```

On Motion Sensed (Active), set Globe light to On

```js
function onMessage(event) {
automation.listen(function (event) {
if (event.name === "Motion Sensor") {
if (
event.serviceCharacteristics.find(
Expand All @@ -56,7 +56,7 @@ function onMessage(event) {
}
}
}
}
});
```

## API
Expand Down

0 comments on commit 00ce4fe

Please sign in to comment.