diff --git a/content/wiki/service/access-code/index.md b/content/wiki/service/access-code/index.md index 54135962d..dc7f5d3a7 100644 --- a/content/wiki/service/access-code/index.md +++ b/content/wiki/service/access-code/index.md @@ -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: @@ -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 >}} diff --git a/content/wiki/service/air-purifier/air_purifier_basic_principle.png b/content/wiki/service/air-purifier/air_purifier_basic_principle.png new file mode 100644 index 000000000..70beda19d Binary files /dev/null and b/content/wiki/service/air-purifier/air_purifier_basic_principle.png differ diff --git a/content/wiki/service/air-purifier/full_air_purifier_example.png b/content/wiki/service/air-purifier/full_air_purifier_example.png new file mode 100644 index 000000000..ba6dbe4de Binary files /dev/null and b/content/wiki/service/air-purifier/full_air_purifier_example.png differ diff --git a/content/wiki/service/air-purifier/index.md b/content/wiki/service/air-purifier/index.md index 9bbaf7983..4f50298bf 100644 --- a/content/wiki/service/air-purifier/index.md +++ b/content/wiki/service/air-purifier/index.md @@ -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: @@ -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. - -screen shot 2019-03-06 at 3 56 33 pm - -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: diff --git a/content/wiki/service/air-quality-sensor/air_quality_basic_principle.png b/content/wiki/service/air-quality-sensor/air_quality_basic_principle.png new file mode 100644 index 000000000..723c7e467 Binary files /dev/null and b/content/wiki/service/air-quality-sensor/air_quality_basic_principle.png differ diff --git a/content/wiki/service/air-quality-sensor/full_air_quality_example.png b/content/wiki/service/air-quality-sensor/full_air_quality_example.png new file mode 100644 index 000000000..fd31f819d Binary files /dev/null and b/content/wiki/service/air-quality-sensor/full_air_quality_example.png differ diff --git a/content/wiki/service/air-quality-sensor/full_air_quality_home_example.png b/content/wiki/service/air-quality-sensor/full_air_quality_home_example.png new file mode 100644 index 000000000..9e6cde7c6 Binary files /dev/null and b/content/wiki/service/air-quality-sensor/full_air_quality_home_example.png differ diff --git a/content/wiki/service/air-quality-sensor/index.md b/content/wiki/service/air-quality-sensor/index.md index 883f92fda..add77f21f 100644 --- a/content/wiki/service/air-quality-sensor/index.md +++ b/content/wiki/service/air-quality-sensor/index.md @@ -3,7 +3,7 @@ title: "Air Quality Sensor" description: "Air Quality Sensor" lead: "" date: 2021-04-17T18:50:12.025Z -lastmod: 2021-10-15T22:06:08.212Z +lastmod: 2022-02-07T14:31:14.059Z draft: false images: [] menu: @@ -15,49 +15,51 @@ service: contributors: ["djiwondee","Shaquu"] --- -To have a real _Air Quality Sensor_ appear in the Home.app showing a _Particulate Levels for 2.5 and 10 microns_ as well as an _Air Quality Index_ based on the [US EPA Scale](https://aqicn.org), you can setup a Node-red flow to provide air characteristics value in HomeKit. +{{< alert icon="💡" text="Home.app will not display the Air Quality Measures in the Accessory's bubble." />}} -## Example - -These simple examples are meant to be copied into your Node-RED system and adapted to your setup. - -**Please note:** Different from other HomeKit services (e.g. temperature sensor) the Home.app is not showing the Air Quality Measures on the device icon. To view the current values you have to open the preferences of the device in the Home.app. This works as designed by Apple and can't be changed with characteristics properties. +## Basic Principle -### Simple Air Quality Sensor +This is the simplest example of an Air Quality Sensor item passing the Characteristics value for testing purposes. -This example is a simple air quality sensor passing the characteristics value for testing purposes. +![Basic Principle](air_quality_basic_principle.png) -image - -**Note:** A value for `{"AirQuality" : 4}` and `{"AirQuality" : 5}` will trigger a notification on the device running the Home.app. +Copyable Node-RED flow: ```json [{"id":"ffa9ddb4.26a9e8","type":"homekit-service","z":"7138f7e3.add4a8","isParent":true,"bridge":"60729d35.03880c","accessoryCategory":"OTHER","parentService":"","name":"AirQuality","serviceName":"AirQualitySensor","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","characteristicProperties":"{\n \"AirQuality\" : 0,\n \"PM2_5Density\" : 1.0,\n \"PM10Density\" : 2.0,\n \"StatusActive\" : 1\n}","x":1120,"y":1340,"wires":[[],[]]},{"id":"56a1e83b.c2441","type":"inject","z":"7138f7e3.add4a8","name":"","topic":"","payload":"{\"foo\":\"bar\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":1200,"wires":[["ffa9ddb4.26a9e8"]]},{"id":"f9907030.d93868","type":"inject","z":"7138f7e3.add4a8","name":"","topic":"","payload":"{\"AirQuality\":3}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":1360,"wires":[["ffa9ddb4.26a9e8"]]},{"id":"17c07925.fe45a7","type":"inject","z":"7138f7e3.add4a8","name":"","topic":"","payload":"{\"PM2_5Density\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":1480,"wires":[["ffa9ddb4.26a9e8"]]},{"id":"e2706164.e33e5","type":"inject","z":"7138f7e3.add4a8","name":"","topic":"","payload":"{\"PM10Density\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":1520,"wires":[["ffa9ddb4.26a9e8"]]},{"id":"35ca8872.7b877","type":"inject","z":"7138f7e3.add4a8","name":"","topic":"","payload":"{\"AirQuality\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":1280,"wires":[["ffa9ddb4.26a9e8"]]},{"id":"3e5ee1ad.6fd466","type":"inject","z":"7138f7e3.add4a8","name":"","topic":"","payload":"{\"AirQuality\":5}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":1440,"wires":[["ffa9ddb4.26a9e8"]]},{"id":"829b371b.08c6d","type":"inject","z":"7138f7e3.add4a8","name":"","topic":"","payload":"{\"AirQuality\":2}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":1320,"wires":[["ffa9ddb4.26a9e8"]]},{"id":"6b87d568.54d98c","type":"inject","z":"7138f7e3.add4a8","name":"","topic":"","payload":"{\"AirQuality\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":1240,"wires":[["ffa9ddb4.26a9e8"]]},{"id":"e539751f.24eeb","type":"inject","z":"7138f7e3.add4a8","name":"","topic":"","payload":"{\"AirQuality\":4}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":1400,"wires":[["ffa9ddb4.26a9e8"]]},{"id":"60729d35.03880c","type":"homekit-bridge","z":"","bridgeName":"RedMatic-HAP-02","pinCode":"002-01-001","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true}] ``` +{{< alert icon="💡" >}}A value of 4 or 5 for **Air Quality** will trigger a notification on the device running the Home.app.{{< /alert >}} + +## Example + +Below is a list of examples intended to be copied into your Node-RED system and adapted to your setup: + ### Full Featured Air Quality Sensor with real data -This is an example of an Air Quality Sensor captures real-time date from a simple web service using a http-request: +This is an example of an Air Quality Sensor captures real-time data from a simple web service using a http-request: -image +![Full Example](full_air_quality_example.png) -There are a couple of public available websites providing real-time data to monitor pollution in public available areas. The author of this Wiki has been chosen the service [luftdaten.info](https://luftdaten.info/en/home-en/) for the setup above, a service provided by the OK Lab Stuttgart. The OK Lab Stuttgart is part of the program _Code for Germany_ of the _Open Knowledge Foundation Germany_. The aim of the program is to promote developments in the areas of transparency, Open Data and Citizen Science. +There are a couple of publicly available websites providing real-time data to monitor pollution in publicly available areas. The author of this Wiki has been chosen the service [luftdaten.info](https://luftdaten.info/en/home-en/) for the setup above, a service provided by the OK Lab Stuttgart. The OK Lab Stuttgart is part of the program _Code for Germany_ of the _Open Knowledge Foundation Germany_. The program aims to promote developments in the areas of transparency, Open Data, and Citizen Science. -As such the service is providing a web based [accessible network](https://deutschland.maps.sensor.community/#6/51.165/10.455) of air quality sensors, distributed across Germany. A few sensors are also located outside of Germany across Europe. +As such the service is providing a web-based [accessible network](https://deutschland.maps.sensor.community/#6/51.165/10.455) of Air Quality Sensors, distributed across Germany. A few sensors are also located outside of Germany across Europe. -This service is providing real-time values for PM 10 and PM 2.5 particulate density. A URL (e.g. `http://api.luftdaten.info/v1/sensor/{{SENSOR_ID}}/`) can be called by a http request node in Node-red to retrieve a parsed payload with sensor data, formed as an analyzed JSON-object. +This service is providing real-time values for PM 10 and PM 2.5 particulate density. A URL (e.g. `https://data.sensor.community/airrohr/v1/sensor/{{SENSOR_ID}}/`) can be called by a http request node in Node-RED to retrieve a parsed payload with sensor data, formed as an analyzed JSON-object. -The following Node-RED flow uses one particular sensor.: +{{< alert icon="💡" >}}**Update**:~~`http://api.luftdaten.info/v1/sensor/`~~ change to `https://data.sensor.community/airrohr/v1/sensor/`.{{< /alert >}} +\ +Copyable Node-RED flow: ```json -[{"id":"cae95a6c.0010d8","type":"inject","z":"7138f7e3.add4a8","name":"Initiate Airquality Read","topic":"","payload":"true","payloadType":"bool","repeat":"1200","crontab":"","once":true,"onceDelay":"10","x":270,"y":1120,"wires":[["8dee64b7.b1cd"]]},{"id":"9f84bead.b2093","type":"debug","z":"7138f7e3.add4a8","name":"HK Output","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":1130,"y":1120,"wires":[]},{"id":"8dee64b7.b1cd","type":"http request","z":"7138f7e3.add4a8","name":"Air Quality Kiedrich","method":"GET","ret":"obj","paytoqs":false,"url":"http://api.luftdaten.info/v1/sensor/23490/","tls":"","persist":false,"proxy":"","authType":"","x":530,"y":1120,"wires":[["3d68d0ef.68703"]],"info":"Source: [Kiedrich](https://luftdaten.info)"},{"id":"3d68d0ef.68703","type":"function","z":"7138f7e3.add4a8","name":"Adjust payload for HomeKit","func":"var hkMsg = {};\n\nvar pm10 = Number(msg.payload[0].sensordatavalues[0].value);\nvar pm2 = Number(msg.payload[0].sensordatavalues[1].value);\nvar airQualityPM10, airQualityPM2, airQuality;\n\n// Banding AirQiality based on US AQI to provide HomeKit Levels\n// Source: https://aqicn.org/calculator\n\nif (pm10 < 55) {\n airQualityPM10 = 1;\n} else if (pm10 < 155) {\n airQualityPM10 = 2\n} else if (pm10 < 255) {\n airQualityPM10 = 3\n} else if (pm10 < 355) {\n airQualityPM10 = 4\n} else if (pm10 >= 425) {\n airQualityPM10 = 5;\n} else {\n airQualityPM10 = 0; \n}\n\nif (pm2 < 12) {\n airQualityPM2 = 1;\n} else if (pm2 < 35.5) {\n airQualityPM2 = 2\n} else if (pm2 < 55.5) {\n airQualityPM2 = 3\n} else if (pm2 < 150.5) {\n airQualityPM2 = 4\n} else if (pm2 >= 250.5) {\n airQualityPM2 = 5;\n} else {\n airQualityPM2 = 0; \n}\n\n// Average airQuality derived from PM2 and PM10\n\nairQuality = (airQualityPM10 + airQualityPM2) / 2;\n\nhkMsg.payload = {\n \"AirQuality\" : Number(airQuality.toFixed(0)),\n \"PM10Density\" : pm10,\n \"PM2_5Density\" : pm2,\n \"StatusActive\" : 1\n };\n\nreturn hkMsg;","outputs":1,"noerr":0,"x":800,"y":1120,"wires":[["9f84bead.b2093","ffa9ddb4.26a9e8"]]},{"id":"ffa9ddb4.26a9e8","type":"homekit-service","z":"7138f7e3.add4a8","isParent":true,"bridge":"60729d35.03880c","accessoryCategory":"OTHER","parentService":"","name":"AirQuality","serviceName":"AirQualitySensor","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","characteristicProperties":"{\n \"AirQuality\" : 0,\n \"PM2_5Density\" : 1.0,\n \"PM10Density\" : 2.0,\n \"StatusActive\" : 1\n}","x":1120,"y":1200,"wires":[[],[]]},{"id":"60729d35.03880c","type":"homekit-bridge","z":"","bridgeName":"RedMatic-HAP-02","pinCode":"002-01-001","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true}] +[{"id":"cae95a6c.0010d8","type":"inject","z":"7138f7e3.add4a8","name":"Initiate Airquality Read","topic":"","payload":"true","payloadType":"bool","repeat":"1200","crontab":"","once":true,"onceDelay":"10","x":270,"y":1120,"wires":[["8dee64b7.b1cd"]]},{"id":"9f84bead.b2093","type":"debug","z":"7138f7e3.add4a8","name":"HK Output","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":1130,"y":1120,"wires":[]},{"id":"8dee64b7.b1cd","type":"http request","z":"7138f7e3.add4a8","name":"Air Quality Kiedrich","method":"GET","ret":"obj","paytoqs":false,"url":"https://data.sensor.community/airrohr/v1/sensor/23490/","tls":"","persist":false,"proxy":"","authType":"","x":530,"y":1120,"wires":[["3d68d0ef.68703"]],"info":"Source: [Kiedrich](https://luftdaten.info)"},{"id":"3d68d0ef.68703","type":"function","z":"7138f7e3.add4a8","name":"Adjust payload for HomeKit","func":"var hkMsg = {};\n\nvar pm10 = Number(msg.payload[0].sensordatavalues[0].value);\nvar pm2 = Number(msg.payload[0].sensordatavalues[1].value);\nvar airQualityPM10, airQualityPM2, airQuality;\n\n// Banding AirQiality based on US AQI to provide HomeKit Levels\n// Source: https://aqicn.org/calculator\n\nif (pm10 < 55) {\n airQualityPM10 = 1;\n} else if (pm10 < 155) {\n airQualityPM10 = 2\n} else if (pm10 < 255) {\n airQualityPM10 = 3\n} else if (pm10 < 355) {\n airQualityPM10 = 4\n} else if (pm10 >= 425) {\n airQualityPM10 = 5;\n} else {\n airQualityPM10 = 0; \n}\n\nif (pm2 < 12) {\n airQualityPM2 = 1;\n} else if (pm2 < 35.5) {\n airQualityPM2 = 2\n} else if (pm2 < 55.5) {\n airQualityPM2 = 3\n} else if (pm2 < 150.5) {\n airQualityPM2 = 4\n} else if (pm2 >= 250.5) {\n airQualityPM2 = 5;\n} else {\n airQualityPM2 = 0; \n}\n\n// Average airQuality derived from PM2 and PM10\n\nairQuality = (airQualityPM10 + airQualityPM2) / 2;\n\nhkMsg.payload = {\n \"AirQuality\" : Number(airQuality.toFixed(0)),\n \"PM10Density\" : pm10,\n \"PM2_5Density\" : pm2,\n \"StatusActive\" : 1\n };\n\nreturn hkMsg;","outputs":1,"noerr":0,"x":800,"y":1120,"wires":[["9f84bead.b2093","ffa9ddb4.26a9e8"]]},{"id":"ffa9ddb4.26a9e8","type":"homekit-service","z":"7138f7e3.add4a8","isParent":true,"bridge":"60729d35.03880c","accessoryCategory":"OTHER","parentService":"","name":"AirQuality","serviceName":"AirQualitySensor","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","characteristicProperties":"{\n \"AirQuality\" : 0,\n \"PM2_5Density\" : 1.0,\n \"PM10Density\" : 2.0,\n \"StatusActive\" : 1\n}","x":1120,"y":1200,"wires":[[],[]]},{"id":"60729d35.03880c","type":"homekit-bridge","z":"","bridgeName":"RedMatic-HAP-02","pinCode":"002-01-001","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true}] ``` -image +![Full Example Home.app](full_air_quality_home_example.png) The PM 10 and PM 2.5 value is directly mapped to the appropriate HomeKit Characteristics value, using a _function node_. -```javascript +```js var pm10 = Number(msg.payload[0].sensordatavalues[0].value); var pm2 = Number(msg.payload[0].sensordatavalues[1].value); @@ -71,6 +73,10 @@ hkMsg.payload = { ``` A special calculation is applied for the `AirQuality` value itself. -Since the HAP specification doesn't necessarily dictate _how_ the value has to be calculated it is up to the accessory to determine the subject assessment of the air quality. For the example above the author decide to calculate a mean value derived from the different scale of the PM 10 and PM 2.5 particulate density US AQI scale. For reference please see [here](https://aqicn.org/calculator). +Since the HAP Specification doesn't necessarily dictate _how_ the value has to be calculated it is up to the Accessory to determine the subject assessment of the Air Quality. For the example above the author decide to calculate a mean value derived from the different scales of the PM 10 and PM 2.5 particulate density US AQI scale. + +{{< alert icon="👉" >}}Find more about the [Calculator](https://aqicn.org/calculator).{{< /alert >}} + +However, with such a setup you can decide for yourself, whether your windows open/closes automatically based on Air Quality outside. In addition to that, the project encourages you to become part of the network by [building your own](https://luftdaten.info/en/construction-manual/) Air Quality Sensor. -However, with such a setup you can decide for yourself, whether your windows open/closes automatically based on air quality outside. In addition to that, the project encourages you to become part of the network by [building your own](https://luftdaten.info/en/construction-manual/) air quality sensor. +{{< alert icon="👉" >}}Find more about [US EPA Scale](https://aqicn.org).{{< /alert >}} diff --git a/content/wiki/service/battery/battery_motion_sensor_home_app_example.png b/content/wiki/service/battery/battery_motion_sensor_home_app_example.png index e952c7276..5b6342a33 100644 Binary files a/content/wiki/service/battery/battery_motion_sensor_home_app_example.png and b/content/wiki/service/battery/battery_motion_sensor_home_app_example.png differ diff --git a/content/wiki/service/battery/index.md b/content/wiki/service/battery/index.md index 2b711782b..462eb20e2 100644 --- a/content/wiki/service/battery/index.md +++ b/content/wiki/service/battery/index.md @@ -3,7 +3,7 @@ title: "Battery" description: "Battery" lead: "" date: 2021-04-17T18:50:12.025Z -lastmod: 2021-10-25T17:14:21.615Z +lastmod: 2022-02-07T14:31:14.059Z draft: false images: [] menu: @@ -15,33 +15,33 @@ service: contributors: ["GogoVega","Shaquu"] --- -**Note:** This service is to be used as a Linked Service as status of the parent's battery level. +{{< alert icon="‼️" >}}This service must be used as a [**Linked Service**]({{< ref "/wiki/nodes/linked-service" >}} "Linked Service")!{{< /alert >}} ## Creating Battery Service -To display a battery service you must first create a parent service. Motion Sensor for this example. +To display a Battery Service you must first create a Parent Service. Motion Sensor for this example. ![Create Parent Service](battery_create_parent_service_example.png) -Next you must create a battery linked service and select parent service used. +Next, create the Battery Service as a Linked Service, selecting your desired Accessory as the Parent Service for which your Battery will be grouped under. ![Create Linked Service](battery_create_linked_service_example.png) ### Characteristic Properties -Use the following JSON in your battery characteristic properties so that the Home application displays a `BatteryLevel`, `ChargingState` and `StatusLowBattery`. +Use the following JSON in your Battery Characteristic Properties so that the Home.app displays a `BatteryLevel`, `ChargingState`, and `StatusLowBattery`. ```json { "BatteryLevel": 100, - "ChargingState":0, - "StatusLowBattery":0 + "ChargingState": 0, + "StatusLowBattery": 0 } ``` ### Example -Here is a screenshot of the Home app. +Here is a screenshot of the Home.app. ![Battery Motion Sensor Home App](battery_motion_sensor_home_app_example.png)