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

feat: Update Service (part 1) #117

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 13 additions & 1 deletion content/wiki/service/access-code/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: "Access Code"
description: "Access Code"
lead: ""
date: 2021-09-27T18:51:43.245Z
lastmod: 2021-09-27T18:51:43.245Z
lastmod: 2022-02-07T14:31:14.059Z
draft: false
images: []
menu:
Expand All @@ -13,3 +13,15 @@ toc: true
service:
name: "AccessCode"
---

{{< alert icon="‼️" >}}This service must be used as a [**Linked Service**]({{< ref "/wiki/nodes/linked-service" >}} "Linked Service")!{{< /alert >}}
\
Access Code is a Linked Service to [Lock Mechanism]({{< ref "/wiki/service/lock-mechanism" >}} "Lock Mechanism").
This Service allows you to unlock a door using an Access Code.

## Basic Principle

This is the simplest example of a Lock Mechanism item with an Access Code. The input nodes are `Close`, `Opening`, `Closing`, and `Open`.


{{< alert icon="‼️" >}}This service is under development ‼️{{< /alert >}}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 23 additions & 30 deletions content/wiki/service/air-purifier/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: "Air Purifier"
description: "Air Purifier"
lead: ""
date: 2021-04-17T18:50:12.025Z
lastmod: 2021-10-15T22:06:07.935Z
lastmod: 2022-02-07T14:31:14.059Z
draft: false
images: []
menu:
Expand All @@ -15,53 +15,46 @@ service:
contributors: ["crxporter","Shaquu"]
---

## Possible combinations
## Basic Principle

The display in the Home.app on iOS/macOS depends on the pair of values sent to the Characteristics `Active` and `CurrentAirPurifierState`. This table shows each of the 6 possible combinations of these two properties along with what the Home.app display will show. In order to have the Home.app display properly, it is important to send the correct pair of values to the HomeKit service node.
This is the simplest example of an Air Purifier item. There are 3 sets of input nodes.

The node will output `{"Active":1}` or `{"Active":0}` when the user switches the purifier on and off. The node will output `{"TargetAirPurifierState":0}` or `{"TargetAirPurifierState":1}` when the user changes between Manual and Automatic operation in the Home.app. The `TargetAirPurifierState` property can also be passed into the HomeKit node to dictate when the purifier is in manual or automatic operation mode.
**Auto/Manual Mode** will determine whether the Home.app displays that the Purifier is in Automatic or Manual Mode. This is set by sending a value of 0 or 1 to `TargetAirPurifierState`.

**Set Target State** will dictate whether the user wants the Purifier to be On or Off. This is set by sending a value of 0 or 1 to `Active`.

**Set Current State Off/Idle/On** this will dictate whether the Purifier is Off, Idle, or On. This is set by sending a value of 0, 1, or 2 to `CurrentAirPurifierState`.

![Basic Principle](air_purifier_basic_principle.png)

Copyable Node-RED flow:

```json
[{"id":"23658c6b.4bf7fc","type":"debug","z":"3e0d11cf.29e996","name":"Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":570,"y":220,"wires":[]},{"id":"48715e2b.edde4","type":"inject","z":"3e0d11cf.29e996","name":"Target state: on","topic":"","payload":"{\"Active\":true}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":280,"wires":[["b76a15e.cbd98e8"]]},{"id":"6c58b865.cbe098","type":"inject","z":"3e0d11cf.29e996","name":"Target state: off","topic":"","payload":"{\"Active\":false}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":320,"wires":[["b76a15e.cbd98e8"]]},{"id":"c80db304.c4e","type":"inject","z":"3e0d11cf.29e996","name":"Auto mode","topic":"","payload":"{\"TargetAirPurifierState\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":440,"y":100,"wires":[["b76a15e.cbd98e8"]]},{"id":"2188d196.d711e6","type":"inject","z":"3e0d11cf.29e996","name":"Current State: ON","topic":"","payload":"{\"CurrentAirPurifierState\":2}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":410,"y":500,"wires":[["b76a15e.cbd98e8"]]},{"id":"b76a15e.cbd98e8","type":"homekit-service","z":"3e0d11cf.29e996","bridge":"f0825aeb.9064a8","name":"Pure 2","serviceName":"AirPurifier","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","characteristicProperties":"{}","x":430,"y":220,"wires":[["23658c6b.4bf7fc"]]},{"id":"5c80309d.22e278","type":"inject","z":"3e0d11cf.29e996","name":"Manual Mode","topic":"","payload":"{\"TargetAirPurifierState\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":430,"y":140,"wires":[["b76a15e.cbd98e8"]]},{"id":"44a8a93d.b0b51","type":"inject","z":"3e0d11cf.29e996","name":"Current State: OFF","topic":"","payload":"{\"CurrentAirPurifierState\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":410,"y":420,"wires":[["b76a15e.cbd98e8"]]},{"id":"e090d2b0.110df8","type":"inject","z":"3e0d11cf.29e996","name":"Current State: IDLE","topic":"","payload":"{\"CurrentAirPurifierState\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":410,"y":460,"wires":[["b76a15e.cbd98e8"]]},{"id":"633c58dd.2f2dc8","type":"comment","z":"3e0d11cf.29e996","name":"Auto/Manual mode","info":"","x":250,"y":100,"wires":[]},{"id":"9a55b755.665a2","type":"comment","z":"3e0d11cf.29e996","name":"Set target state","info":"","x":160,"y":240,"wires":[]},{"id":"6d243594.778f14","type":"comment","z":"3e0d11cf.29e996","name":"Set actual state off/idle/on","info":"","x":410,"y":380,"wires":[]},{"id":"f0825aeb.9064a8","type":"homekit-bridge","z":"","bridgeName":"Dev","pinCode":"111-11-111","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number"}]
```

## Possible Combinations

The combination of `Active` and `CurrentAirPurifierState` Characteristics will determine what the Home.app shows for the Air Purifier item. Here is a table showing all (known) combinations:

| Active | CurrentAirPurifierState | Home.app Shows |
| --- | --- | --- |
| `{"Active":0}` | `{"CurrentAirPurifierState":0}` | Off |
| `{"Active":0}` | `{"CurrentAirPurifierState":1}` | Turning Off |
| `{"Active":0}` | `{"CurrentAirPurifierState":2}` | Turning Off |
||||
| `{"Active":1}` | `{"CurrentAirPurifierState":0}` | Turning On |
| `{"Active":1}` | `{"CurrentAirPurifierState":1}` | Idle |
| `{"Active":1}` | `{"CurrentAirPurifierState":2}` | On |

## Examples

These examples are meant to be copied into your Node-RED system and adapted to your setup.

### Simple Air Purifier

This is an example of a simple air purifier item. There are 3 sets of input nodes.

**Auto/Manual mode** will determine whether the Home.app displays that the purifier is in automatic or manual mode. This is set by sending a value of 0 or 1 to `TargetAirPurifierState`.

**Set target state** will dictate whether the user wants the purifier to be on or off. This is set by sending a value of 0 or 1 to `Active`.

**Set actual state off/idle/on** this will dictate whether the air purifier is actually off, idle, or on. This is set by sending a value of 0, 1, or 2 to `CurrentAirPurifierState`.

See the table above for a matrix explaining all 6 combinations and what will appear in the Home.app.

<img width="594" alt="screen shot 2019-03-06 at 3 56 33 pm" src="https://user-images.githubusercontent.com/38265886/53916694-6d695580-4028-11e9-92d0-09ef7542116e.png">

Copyable Node-RED flow:

```json
[{"id":"23658c6b.4bf7fc","type":"debug","z":"3e0d11cf.29e996","name":"Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":570,"y":220,"wires":[]},{"id":"48715e2b.edde4","type":"inject","z":"3e0d11cf.29e996","name":"Target state: on","topic":"","payload":"{\"Active\":true}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":280,"wires":[["b76a15e.cbd98e8"]]},{"id":"6c58b865.cbe098","type":"inject","z":"3e0d11cf.29e996","name":"Target state: off","topic":"","payload":"{\"Active\":false}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":320,"wires":[["b76a15e.cbd98e8"]]},{"id":"c80db304.c4e","type":"inject","z":"3e0d11cf.29e996","name":"Auto mode","topic":"","payload":"{\"TargetAirPurifierState\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":440,"y":100,"wires":[["b76a15e.cbd98e8"]]},{"id":"2188d196.d711e6","type":"inject","z":"3e0d11cf.29e996","name":"Current State: ON","topic":"","payload":"{\"CurrentAirPurifierState\":2}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":410,"y":500,"wires":[["b76a15e.cbd98e8"]]},{"id":"b76a15e.cbd98e8","type":"homekit-service","z":"3e0d11cf.29e996","bridge":"f0825aeb.9064a8","name":"Pure 2","serviceName":"AirPurifier","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","characteristicProperties":"{}","x":430,"y":220,"wires":[["23658c6b.4bf7fc"]]},{"id":"5c80309d.22e278","type":"inject","z":"3e0d11cf.29e996","name":"Manual Mode","topic":"","payload":"{\"TargetAirPurifierState\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":430,"y":140,"wires":[["b76a15e.cbd98e8"]]},{"id":"44a8a93d.b0b51","type":"inject","z":"3e0d11cf.29e996","name":"Current State: OFF","topic":"","payload":"{\"CurrentAirPurifierState\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":410,"y":420,"wires":[["b76a15e.cbd98e8"]]},{"id":"e090d2b0.110df8","type":"inject","z":"3e0d11cf.29e996","name":"Current State: IDLE","topic":"","payload":"{\"CurrentAirPurifierState\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":410,"y":460,"wires":[["b76a15e.cbd98e8"]]},{"id":"633c58dd.2f2dc8","type":"comment","z":"3e0d11cf.29e996","name":"Auto/Manual mode","info":"","x":250,"y":100,"wires":[]},{"id":"9a55b755.665a2","type":"comment","z":"3e0d11cf.29e996","name":"Set target state","info":"","x":160,"y":240,"wires":[]},{"id":"6d243594.778f14","type":"comment","z":"3e0d11cf.29e996","name":"Set actual state off/idle/on","info":"","x":410,"y":380,"wires":[]},{"id":"f0825aeb.9064a8","type":"homekit-bridge","z":"","bridgeName":"Dev","pinCode":"111-11-111","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number"}]
```
Below is a list of examples intended to be copied into your Node-RED system and adapted to your setup:

### Full Featured Air Purifier

#### Requires version 0.6 or better

This air purifier example shows a full-featured air purifier. It has a parent service (purifier) and a child service (filter state). The basic operation is the same as described above, additions are child lock, oscillate, fan speed, and filter status.
This example shows a full-featured Air Purifier. It has a Parent Service (Air Purifier) and a Linked Service (Filter Maintenance). The basic operation is the same as described above, additions are child lock, oscillate, fan speed, and filter status.

![screen shot 2019-03-08 at 8 03 24 am](https://user-images.githubusercontent.com/38265886/54032948-a7e20800-4178-11e9-9733-d91cfbcea3c5.png)
![Full Example](full_air_purifier_example.png)

Copyable Node-RED flow:

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading