Puedes maldecir o idolatrar los dispositivos de Apple, pero lo que Apple ha hecho muy bien es integrar componentes SmartHome en sus sistemas operativos. Por ejemplo, iOs viene con la opción de controlar dispositivos HomeKit (así es como se denomina a los componentes SmartHome en el universo Apple) a través de iOs.
También es práctico que puedas simular estos dispositivos HomeKit con NodeRed (y el Nodo correspondiente). Esto te permite controlar los actuadores de tu SmartHome desde tu dispositivo iOs e incluso visualizar los datos de los sensores (por ejemplo, temperatura, humedad) del SmartHome.
El siguiente artículo explica cómo hacerlo y qué hay que tener en cuenta.
Instrucciones de seguridad
Sé que las siguientes notas siempre son un poco molestas y parecen innecesarias. Desafortunadamente, muchas personas que sabían "mejor" han perdido ojos, dedos u otras cosas debido a un descuido o se lesionaron. La pérdida de datos es casi insignificante en comparación, pero incluso estos pueden ser realmente molestos. Por lo tanto, tómese cinco minutos para leer las instrucciones de seguridad. Porque incluso el proyecto más genial no vale la pena lesionarse u otros problemas.
https://www.nerdiy.de/sicherheitshinweise/
Enlaces afiliados / enlaces publicitarios
Los enlaces a las tiendas en línea enumerados aquí son los llamados enlaces de afiliados. Si hace clic en dicho enlace de afiliado y realiza una compra a través de este enlace, Nerdiy.de recibirá una comisión de la tienda en línea o el proveedor correspondiente. El precio no cambia para usted. Si realiza sus compras a través de estos enlaces, ayuda a Nerdiy.de a poder ofrecer otros proyectos útiles en el futuro. 🙂
Requisitos
Artículos útiles:
Antes de empezar con este artículo, debes haber preparado la RaspberryPi para que sea accesible a través de la red y controlable a través de SSH. NodeRed también debe estar instalado.
Los siguientes tres artículos describen lo que se debe hacer para preparar la RaspberryPi:
RaspberryPi: ¡configuración para nerdiys!
RaspberryPi – ¡La primera configuración!
RaspberryPi: controle el RaspberryPi a través de SSH
NodeRed: instalación de NodeRed en RaspberryPi
NodeRed – Instalar nuevos nodos
Herramienta requerida:
-No-
Material requerido:
En la siguiente lista encontrará todas las piezas que necesita para implementar este artículo.
Inicie sesión en la interfaz de configuración de NodeRed
Antes de que pueda editar su configuración de NodeRed, debe, si está activado, primero iniciar sesión en la interfaz de configuración de NodeRed.
Instalación de los nodos requeridos.
Damit Ihr Homekit Geräte simulieren könnt muss natürlich erstmal die passende Node installiert sein. Installiert dazu die Node „node-red-contrib-homekit“. Wie Ihr Nodes installiert ist im Artikel NodeRed – Instalar nuevos nodos explicado.
nodo-rojo-contrib-homekit
Leer detectores de movimiento
Ein kleiner Beispiel-Node-Code um über den Status eines Bewegungsmelders informiert zu werden könnte so aussehen. Zur Simulation des Bewegungsmelders sind die „Inject“-Nodes „true“ und „false“ eingebaut, welche ein Bewegungsmelder-ist-betätigt-Signal(true) und ein Bewegungsmelder-ist-nicht-betätigt-Signal(false) simulieren. An diese Eingänge könnt Ihr dann einen Bewegunsmelder „anschließen“, dessen Signale dann über HomeKit angezeigt werden.
Außerdem ist dabei noch eine Inject-Node mit dem Namen „requestOptions“. Bei einem klick darauf, werden Euch in der Debug-Leiste alle Eigenschaften dieses HomeKit-Devices angezeigt.
{"id": "9998cf7e.5cf8e","type":"homekit-service","z":"5dcffcbc.bae6c4","accessory":"a10e8039.50d9c","name":"BewegungsmelderBad","serviceName":"MotionSensor","x":740,"y":820,"wires":[["9dcd9414.118448"]]},{"id":"18fa3044.4d02d","type":"json","z":"5dcffcbc.bae6c4","name":"","property":"payload","action":"","pretty":false,"x":550,"y":820,"wires":[["9998cf7e.5cf8e"]]},{"id":"2fea5d63.ae8852","type":"template","z":"5dcffcbc.bae6c4","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{"MotionDetected":{{payload}}}","output":"str","x":400,"y":820,"wires":[["18fa3044.4d02d"]]},{"id":"c568f55f.d8e828","type":"inject","z":"5dcffcbc.bae6c4","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":800,"wires":[["2fea5d63.ae8852"]]},{"id":"9dcd9414.118448","type":"debug","z":"5dcffcbc.bae6c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":930,"y":820,"wires":[]},{"id":"46dbd92c.8000e8", "type": "inject", "z": "5dcffcbc.bae6c4", "name":"", "topic":"", "payload": "false", "payloadType": "bool", "repeat":"", "crontab":"", "once":false, "onceDelay":0.1,"x":190,"y":840,"wires":[["2fea5d63.ae8852"]]},{"id":"39aee99f.957496","type":"comment","z":"5dcffcbc.bae6c4","name":"Bewegungsmelder als Event","info":"","x":220,"y":740,"wires":[]},{"id":"769255e1.22b44c","type":"json","z":"5dcffcbc.bae6c4","name":"","property":"payload","action":"","pretty":false,"x":550,"y":860,"wires":[["9998cf7e.5cf8e"]]},{"id":"fdd0e0c1.c5117","type":"template","z":"5dcffcbc.bae6c4","name":"options","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{"foo":"bar"}","output":"str","x":400,"y":860,"wires":[["769255e1.22b44c"]]},{"id":"40c3c829.e4f308","type":"inject","z":"5dcffcbc.bae6c4","name":"requestOptions","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":900,"wires":[["fdd0e0c1.c5117"]]},{"id":"a10e8039.50d9c", "type": "homekit-accessory", "z":"", "accessoryName": "Sensores", "pinCode": "111-11-111", "port": "32304", "manufacturer": "Nerdiy.de", "model": "Modelo por defecto", "serialNo": "Número de serie por defecto", "accessoryType": "10"}].
Damit dieser NodeCode funktioniert müsst Ihr noch das HomeKit-accessory und den Service konfigurieren. Klickt dazu doppelt auf die Node „BewegungsmelderBad“. Dadurch öffnet sich das folgende Menü.
Habt Ihr all diese Daten eingetragen klickt Ihr auf „Add“ und auf „Done“ um diese Einstellung zu übernehmen. Im letzten Abschnitt dieses Artikels wird erklärt wie Ihr die HomeKit-Devices dann in iOS anmeldet.
Ajustar los termostatos de calefacción
A continuación se muestra un código de nodo de ejemplo de cómo puede reenviar la información de un termostato de calefacción a un termostato HomeKit simulado, por ejemplo. Hay (en este ejemplo) dos propiedades que se muestran en el dispositivo iOS. Una es la temperatura objetivo establecida y la otra es la temperatura real actual. Ambos valores pueden simularse a través de los nodos Inject. Por lo tanto, en este punto tendría que sustituir los nodos Inject por los valores de su termostato de calefacción real.
Por otro lado, los valores que se envían al dispositivo HomeKit simulado a través de la app HomeKit de iOS se emiten a través del nodo de depuración. Por lo tanto, los valores a ajustar podrían reenviarse al termostato de calefacción en este punto.
Außerdem ist dabei auch wieder eine Inject-Node mit dem Namen „requestOptions“ vorhanden. Bei einem klick darauf, werden Euch in der Debug-Leiste alle Eigenschaften dieses HomeKit-Devices angezeigt.
[{"id":"b3001d65.5105f","type":"comment","z":"5dcffcbc.bae6c4","name":"Heizungsthermostate steuern","info":"","x":220,"y":1300,"wires":[]},{"id":"b12f3ad3.c1ef68","type":"homekit-service","z":"5dcffcbc.bae6c4","accessory":"39b8cf37.35a27","name":"Heizung","serviceName":"Thermostat","x":740,"y":1480,"wires":[["3cb1fd5c.fd60c2"]]},{"id":"8d9e79f3.0de618","type":"json","z":"5dcffcbc.bae6c4","name":"","property":"payload","action":"","pretty":false,"x":590,"y":1480,"wires":[["b12f3ad3.c1ef68"]]},{"id":"7e9e340b.320a5c", "type": "template", "z": "5dcffcbc.bae6c4","name":"Soll-Temp","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{"TargetTemperature": {{payload}}}","output":"str","x":420,"y":1460,"wires":[["8d9e79f3.0de618"]]},{"id":"3cb1fd5c.fd60c2","type":"change","z":"5dcffcbc.bae6c4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.TargetTemperature","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":1480,"wires":[["4ca89ee5.5cd2d"]]},{"id":"4ca89ee5.5cd2d","type":"debug","z":"5dcffcbc.bae6c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1130,"y":1480,"wires":[]},{"id":"129c9403.2c229c","type":"template","z":"5dcffcbc.bae6c4","name":"Ist-Temp","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{"CurrentTemperature":{{payload}}}","output":"str","x":420,"y":1500,"wires":[["8d9e79f3.0de618"]]},{"id":"182c1f88.f4e04","type":"inject","z":"5dcffcbc.bae6c4","name":"","topic":"","payload":"30","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":1600,"wires":[["129c9403.2c229c"]]},{"id":"93979569.ae6e68","type":"inject","z":"5dcffcbc.bae6c4","name":"","topic":"","payload":"20","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":1560,"wires":[["129c9403.2c229c"]]},{"id":"f2fdf87d.6e9be8","type":"inject","z":"5dcffcbc.bae6c4","name":"","topic":"","payload":"10","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":1520,"wires":[["129c9403.2c229c"]]},{"id":"ccdae584.bd2dd8","type":"inject","z":"5dcffcbc.bae6c4","name":"","topic":"","payload":"30","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":1440,"wires":[["7e9e340b.320a5c"]]},{"id":"820780bd.32628","type":"inject","z":"5dcffcbc.bae6c4","name":"","topic":"","payload":"20","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":1400,"wires":[["7e9e340b.320a5c"]]},{"id":"fafe7787.64f6c8","type":"inject","z":"5dcffcbc.bae6c4","name":"","topic":"","payload":"10","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":1360,"wires":[["7e9e340b.320a5c"]]},{"id":"78c76a0a.b7b7f4","type":"json","z":"5dcffcbc.bae6c4","name":"","property":"payload","action":"","pretty":false,"x":590,"y":1620,"wires":[["b12f3ad3.c1ef68"]]},{"id":"a6b574ca.dc1c98","type":"template","z":"5dcffcbc.bae6c4","name":"options","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{"foo":"bar"}","output":"str","x":440,"y":1620,"wires":[["78c76a0a.b7b7f4"]]},{"id":"63397e19.508ff", "type": "inject", "z": "5dcffcbc.bae6c4", "name": "requestOptions", "topic":"", "payload": "true", "payloadType": "bool", "repeat":"", "crontab":"", "once":false, "onceDelay":0.1,"x":260,"y":1660,"wires":[["a6b574ca.dc1c98"]]},{"id":"39b8cf37.35a27","type":"homekit-accessory","z":"","accessoryName":"Heizung","pinCode":"111-11-111","port":"32305","manufacturer":"Nerdiy.de","model":"Default Model","serialNo":"Default Serial Number","accessoryType":"9"}]
Wie beim Bewegungsmelder müsst Ihr auch bei diesem NodeCode das HomeKit-Accessory und den Service konfigurieren. Klickt dazu doppelt auf die Node „Heizung“. Dadurch öffnet sich wieder das folgende Menü.
Leer sensores de temperatura y humedad
Dieses NodeCode-Beispiel zeigt wie man einen Luftfeuchtigkeits- und Temperatursensor mit der HomeKit-Node simuliert. Die HomeKit-Node nutzt dabei als „Datenquelle“ die Daten von „openweathermap“. Das heißt es werden die aktuellen Temperaturen des in der openweathermap-Node eingestellten Ortes angezeigt.
Wie bei allen anderen Beispielen ist dabei auch wieder eine Inject-Node mit dem Namen „requestOptions“ vorhanden. Bei einem klick darauf, werden Euch in der Debug-Leiste alle Eigenschaften dieses HomeKit-Devices angezeigt.
[{"id":"cc6c7b40.da9078","type":"homekit-service","z":"5dcffcbc.bae6c4","accessory":"bd29e027.b0d63","name":"Temperatur","serviceName":"TemperatureSensor","x":1130,"y":1100,"wires":[["7a89e1f4.1dc75"]]},{"id":"3b22973d.547ac8","type":"homekit-service","z":"5dcffcbc.bae6c4","accessory":"2dc17d94.90bc32","name":"Luftfeuchtigkeit","serviceName":"HumiditySensor","x":1140,"y":1180,"wires":[["195b33c9.57261c"]]},{"id":"7a89e1f4.1dc75","type":"debug","z":"5dcffcbc.bae6c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1290,"y":1100,"wires":[]},{"id":"1c8b89c4.9270b6","type":"json","z":"5dcffcbc.bae6c4","name":"","property":"payload","action":"","pretty":false,"x":970,"y":1120,"wires":[["cc6c7b40.da9078"]]},{"id":"a3736df8.87e9c","type":"json","z":"5dcffcbc.bae6c4","name":"","property":"payload","action":"","pretty":false,"x":970,"y":1160,"wires":[["3b22973d.547ac8"]]},{"id":"400e1113.e2f29","type":"template","z":"5dcffcbc.bae6c4","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{"CurrentRelativeHumidity":"{{payload}}"}","output":"str","x":820,"y":1160,"wires":[["a3736df8.87e9c"]]},{"id":"bf9000c2.be6a8","type":"template","z":"5dcffcbc.bae6c4","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{"CurrentTemperature":"{{payload}}"}","output":"str","x":820,"y":1120,"wires":[["1c8b89c4.9270b6"]]},{"id":"195b33c9.57261c","type":"debug","z":"5dcffcbc.bae6c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1290,"y":1180,"wires":[]},{"id":"a64825b.273ccd8","type":"change","z":"5dcffcbc.bae6c4","name":"convert","rules":[{"t":"set","p":"payload","pt":"msg","to":"data.main.temp-273.15","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":1120,"wires":[["bf9000c2.be6a8"]]},{"id":"fcbc03d9.26567","type":"json","z":"5dcffcbc.bae6c4","name":"","property":"payload","action":"","pretty":false,"x":410,"y":1140,"wires":[["a64825b.273ccd8","553238c1.76cb68"]]},{"id":"9dbc96a3.21dcf8","type":"inject","z":"5dcffcbc.bae6c4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":1080,"wires":[["2d6b39b3.dc72f6"]]},{"id":"553238c1.76cb68","type":"change","z":"5dcffcbc.bae6c4","name":"convert","rules":[{"t":"set","p":"payload","pt":"msg","to":"data.main.humidity","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":1160,"wires":[["400e1113.e2f29"]]},{"id":"2d6b39b3.dc72f6","type":"openweathermap","z":"5dcffcbc.bae6c4","name":"","wtype":"current","lon":"","lat":"","city":"Bochum","country":"Germany","language":"de","x":400,"y":1080,"wires":[["fcbc03d9.26567"]]},{"id":"66e6d0.bca8793","type":"comment","z":"5dcffcbc.bae6c4","name":"Klimasensoren auslesen","info":"","x":210,"y":1000,"wires":[]},{"id":"648f2c18.d730f4","type":"json","z":"5dcffcbc.bae6c4","name":"","property":"payload","action":"","pretty":false,"x":970,"y":1200,"wires":[["3b22973d.547ac8"]]},{"id":"f5f3fc95.8afe2","type":"template","z":"5dcffcbc.bae6c4","name":"options","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{"foo":"bar"}","output":"str","x":820,"y":1200,"wires":[["648f2c18.d730f4"]]},{"id":"4a9292b6.a69abc","type":"inject","z":"5dcffcbc.bae6c4","name":"requestOptions","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":640,"y":1200,"wires":[["f5f3fc95.8afe2"]]},{"id":"31aa55d1.30fa6a","type":"json","z":"5dcffcbc.bae6c4","name":"","property":"payload","action":"","pretty":false,"x":970,"y":1080,"wires":[["cc6c7b40.da9078"]]},{"id":"d0d837e2.311f88","type":"template","z":"5dcffcbc.bae6c4","name":"options","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{"foo":"bar"}","output":"str","x":820,"y":1080,"wires":[["31aa55d1.30fa6a"]]},{"id":"c13c8c2f.1991c", "type": "inject", "z": "5dcffcbc.bae6c4", "name": "requestOptions", "topic":"", "payload": "true", "payloadType": "bool", "repeat":"", "crontab":"", "once":false, "onceDelay":0.1,"x":640,"y":1080,"wires":[["d0d837e2.311f88"]]},{"id":"bd29e027.b0d63","type":"homekit-accessory","z":"","accessoryName":"Temperatur","pinCode":"111-11-111","port":"32300","manufacturer":"Nerdiy.de", "model": "Modelo por defecto", "serialNo": "Número de serie por defecto", "accessoryType": "10"},{"id": "2dc17d94.90bc32", "type": "homekit-accessory", "z":"", "accessoryName": "Humedad", "pinCode": "111-11-111", "port": "32301", "manufacturer": "Nerdiy.de", "model": "Modelo por defecto", "serialNo": "Número de serie por defecto", "accessoryType": "10"}].
Wie bei den vorherigen Beispielen müsst Ihr auch bei diesem NodeCode das HomeKit-Accessory und den Service konfigurieren. Klickt dazu doppelt auf die Node „Luftfeuchtigkeit“ bzw. „Temperatur“. Dadurch öffnet sich wieder das folgende Menü.
Lámparas de control (Tasmota)
A continuación se muestra un ejemplo de cómo se puede vincular una lámpara con el firmware Tasmota al nodo HomeKit para que todos los cambios de todas las fuentes se transmitan siempre a todas las opciones de entrada. Esto permite ajustar el color, el brillo o la configuración general de encendido/apagado en iOS o en el salpicadero o mediante otro método y, al mismo tiempo, el estado actual también se transmite a todas las opciones de ajuste.
Para que este NodeCode funcione para usted, también necesita el nodo Sonoff y debe configurarlo en consecuencia (para que coincida con su dispositivo Sonoff).
[{"id":"b200ae52.6003d","type":"comment","z":"5dcffcbc.bae6c4","name":"Tasmota RGB-LED-Steuerung","info":"","x":220,"y":80,"wires":[]},{"id":"a42e8481.c58778","type":"ui_switch","z":"5dcffcbc.bae6c4","name":"","label":"MiniLichterkette","group":"ca676059.8e72e","order":12,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":820,"y":220,"wires":[["fd8991ee.f7fd1"]]},{"id":"73405495.f1e9cc","type":"homekit-service","z":"5dcffcbc.bae6c4","accessory":"753c6646.f99048","name":"MiniLichterkette","serviceName":"Lightbulb","x":200,"y":160,"wires":[["94a1b366.5c039","9b6599ac.52e878"]]},{"id":"94a1b366.5c039","type":"change","z":"5dcffcbc.bae6c4","name":"convert","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.On","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":160,"wires":[["fd8991ee.f7fd1"]]},{"id":"9e961d23.1c88b","type":"ui_colour_picker","z":"5dcffcbc.bae6c4","name":"","label":"MiniLichterkette","group":"ca676059.8e72e","format":"hsl","outformat":"object","showSwatch":true,"showPicker":true,"showValue":true,"showHue":true,"showAlpha":true,"showLightness":true,"dynOutput":"false","order":25,"width":0,"height":0,"passthru":false,"topic":"","x":200,"y":520,"wires":[["be8d6249.9bab5"]]},{"id":"6c5cc00.0eed54","type":"ui_slider","z":"5dcffcbc.bae6c4","name":"","label":"MiniLichterkette","group":"ca676059.8e72e","order":0,"width":0,"height":0,"passthru":false,"topic":"","min":0,"max":"100","step":1,"x":200,"y":380,"wires":[["2dabaae2.c1e016"]]},{"id":"20784c5.660aab4","type":"template","z":"5dcffcbc.bae6c4","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{"Brightness":"{{payload.l}}","Hue":"{{payload.h}}", "Saturation":"{{payload.s}}", "On": true}","output":"str","x":580,"y":520,"wires":[["e8458a57.465e58"]]},{"id":"e8458a57.465e58","type":"json","z":"5dcffcbc.bae6c4","name":"","property":"payload","action":"","pretty":false,"x":730,"y":520,"wires":[["73405495.f1e9cc"]]},{"id":"3bd94571.32107a","type":"mqtt out","z":"5dcffcbc.bae6c4","name":"Set Hue","topic":"cmnd/MiniLichterkette/HsbColor1","qos":"","retain":"","broker":"aa8ea139.37c07","x":800,"y":280,"wires":[]},{"id":"c8c9c8e5.fccc08","type":"mqtt out","z":"5dcffcbc.bae6c4","name":"Set Saturation","topic":"cmnd/MiniLichterkette/HsbColor2","qos":"","retain":"","broker":"aa8ea139.37c07","x":820,"y":400,"wires":[]},{"id":"be920697.1bc058","type":"mqtt out","z":"5dcffcbc.bae6c4","name":"Set Brightness","topic":"cmnd/MiniLichterkette/HsbColor3","qos":"","retain":"","broker":"aa8ea139.37c07","x":820,"y":340,"wires":[]},{"id":"9b6599ac.52e878","type":"function","z":"5dcffcbc.bae6c4","name":"Split Color Values","func":"if (msg.payload.Hue!==undefined) { msg.payload=msg.payload.Hue; return [ msg, null, null ]; } if (msg.payload.Brightness!==undefined) { msg.payload=msg.payload.Brightness; return [null, msg, null ]; } if (msg.payload.Saturation!==undefined) { msg.payload=msg.payload.Saturation; return [ null, null, msg ]; }","outputs":3,"noerr":0,"x":470,"y":220,"wires":[["3bd94571.32107a"],["be920697.1bc058"],["c8c9c8e5.fccc08"]]},{"id":"15bdce9b.ac1781","type":"mqtt in","z":"5dcffcbc.bae6c4","name":"dimmerState","topic":"stat/MiniLichterkette/RESULT","qos":"2","broker":"aa8ea139.37c07","x":190,"y":440,"wires":[["441ae395.5fbfcc"]]},{"id":"441ae395.5fbfcc","type":"json","z":"5dcffcbc.bae6c4","name":"","property":"payload","action":"","pretty":false,"x":350,"y":440,"wires":[["5918dc5d.eee394"]]},{"id":"5918dc5d.eee394","type":"change","z":"5dcffcbc.bae6c4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.Dimmer","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":440,"wires":[["6c5cc00.0eed54"]]},{"id":"96cbb503.343228","type":"json","z":"5dcffcbc.bae6c4","name":"","property":"payload","action":"","pretty":false,"x":530,"y":380,"wires":[["73405495.f1e9cc"]]},{"id":"2dabaae2.c1e016","type":"template","z":"5dcffcbc.bae6c4","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{"Brightness":"{{payload}}"}","output":"str","x":380,"y":380,"wires":[["96cbb503.343228"]]},{"id":"be8d6249.9bab5","type":"function","z":"5dcffcbc.bae6c4","name":"map","func":"msg.payload.l=msg.payload.l*100; msg.payload.s=msg.payload.s*100; return msg;","outputs":1,"noerr":0,"x":430,"y":520,"wires":[["20784c5.660aab4"]]},{"id":"bf36bff2.3d98f","type":"mqtt in","z":"5dcffcbc.bae6c4","name":"colorState","topic":"stat/MiniLichterkette/RESULT","qos":"2","broker":"aa8ea139.37c07","x":180,"y":580,"wires":[["d85429c0.4501c8","852254eb.6c9668"]]},{"id":"852254eb.6c9668","type":"json","z":"5dcffcbc.bae6c4","name":"","property":"payload","action":"","pretty":false,"x":330,"y":580,"wires":[["be6203d4.c9e66"]]},{"id":"4a52a0ca.93eac","type":"function","z":"5dcffcbc.bae6c4","name":"convert Color","func":"//var input=msg.payload.HSBColor; let values=msg.payload.HSBColor.split(","); msg.payload.h=values[0]; msg.payload.s=values[1]/100; msg.payload.l=values[2]/100; return msg;","outputs":1,"noerr":0,"x":610,"y":580,"wires":[["9e961d23.1c88b"]]},{"id":"be6203d4.c9e66","type":"switch","z":"5dcffcbc.bae6c4","name":"","property":"payload.HSBColor","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":450,"y":580,"wires":[["db3e37fb.97a5f8","4a52a0ca.93eac"]]},{"id":"fd8991ee.f7fd1","type":"Sonoff device","z":"5dcffcbc.bae6c4","mode":"0","broker":"665cb0c4.3e438","device":"MiniLichterkette","name":"","onValue":"ON","offValue":"OFF","cmdPrefix":"cmnd","statPrefix":"stat","telePrefix":"tele","x":810,"y":160,"wires":[["a42e8481.c58778"]]},{"id":"b3771bf1.2acd78","type":"json","z":"5dcffcbc.bae6c4","name":"","property":"payload","action":"","pretty":false,"x":550,"y":120,"wires":[["73405495.f1e9cc"]]},{"id":"5dbdb6ee.9ac9f8","type":"template","z":"5dcffcbc.bae6c4","name":"options","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{"foo":"bar"}","output":"str","x":400,"y":120,"wires":[["b3771bf1.2acd78"]]},{"id":"97278e2f.5d65a","type":"inject","z":"5dcffcbc.bae6c4","name":"requestOptions","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":120,"wires":[["5dbdb6ee.9ac9f8"]]},{"id":"d85429c0.4501c8","type":"debug","z":"5dcffcbc.bae6c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":350,"y":640,"wires":[]},{"id":"db3e37fb.97a5f8","type":"debug","z":"5dcffcbc.bae6c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":590,"y":640,"wires":[]},{"id":"ca676059.8e72e","type":"ui_group","z":"","name":"Mini-Lichterkette","tab":"d651a8eb.fefb38","disp":true,"width":"6","collapse":false},{"id":"753c6646.f99048","type":"homekit-accessory","z":"","accessoryName":"Lampen","pinCode":"111-11-111","port":"32302","manufacturer":"Nerdiy.de","model":"Default Model","serialNo":"Default Serial Number","accessoryType":"5"},{"id":"aa8ea139.37c07","type":"mqtt-broker","z":"","name":"Server-Mqtt","broker":"server.fritz.box","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"665cb0c4.3e438","type":"mqtt-broker","z":"","name":"","broker":"server.fritz.box","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"d651a8eb.fefb38","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]
Wie bei den vorherigen Beispielen müsst Ihr auch bei diesem NodeCode das HomeKit-Accessory und den Service konfigurieren. Klickt dazu doppelt auf die Node (in diesem Fall)“MiniLichterkette“. Dadurch öffnet sich wieder das folgende Menü.
enchufes de control
Dieses Beispiel zeigt Euch wie Ihr eine SmartHome-Steckdose mit der HomeKit-Node simulieren könnt. Dazu wird Hier eine SonoffS26-Steckdose verwendet die (wie auch die Lampe im vorherigen Beispiel) mit der Tasmota-Firmware „bestückt“ ist. Wie Ihr so eine Steckdose mit der Tasmota-Firmware programmiert und über Node-Red steuert ist in dem Artikel Tasmota - Toma Flash Sonoff S26 con firmware Tasmota descrito.
Wie bei allen anderen Beispielen ist dabei auch wieder eine Inject-Node mit dem Namen „requestOptions“ vorhanden. Bei einem Klick darauf, werden Euch in der Debug-Leiste alle Eigenschaften dieses HomeKit-Devices angezeigt.
[{"id":"d6d0d8e6.785448","type":"comment","z":"5dcffcbc.bae6c4","name":"Steckdose","info":"","x":180,"y":1800,"wires":[]},{"id":"bad38f27.a93b4","type":"ui_switch","z":"5dcffcbc.bae6c4","name":"","label":"Steckdose","group":"16663fb4.9e351", "order":20, "width":0, "height":0, "passthru":false, "decouple": "true", "topic":"", "style":"", "onvalue": "true", "onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":670,"y":1920,"wires":[["f1118c1c.95804"]]},{"id":"f1118c1c.95804","type":"Sonoff device","z":"5dcffcbc.bae6c4","mode":"0","broker":"1fafbb1c.a2df75","device":"SonoffS26","name":"","onValue":"ON","offValue":"OFF","cmdPrefix":"cmnd","statPrefix":"stat","telePrefix":"tele","x":660,"y":1860,"wires":[["bad38f27.a93b4"]]},{"id":"a4cdda.44b67228","type":"homekit-service","z":"5dcffcbc.bae6c4","accessory":"b7e7d023.40f38","name":"Steckdose","serviceName":"Outlet","x":250,"y":1860,"wires":[["307b902a.ca26b"]]},{"id":"307b902a.ca26b","type":"change","z":"5dcffcbc.bae6c4","name":"convert","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.On","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":1860,"wires":[["f1118c1c.95804"]]},{"id":"fb3c28d1.cb8da8","type":"json","z":"5dcffcbc.bae6c4","name":"","property":"payload","action":"","pretty":false,"x":570,"y":1980,"wires":[["a4cdda.44b67228"]]},{"id":"811d7998.a861e8","type":"template","z":"5dcffcbc.bae6c4","name":"options","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{"foo":"bar"}","output":"str","x":420,"y":1980,"wires":[["fb3c28d1.cb8da8"]]},{"id":"6bdad444.d1270c","type":"inject","z":"5dcffcbc.bae6c4","name":"requestOptions","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":260,"y":1980,"wires":[["811d7998.a861e8"]]},{"id":"16663fb4.9e351","type":"ui_group","z":"","name":"Licht","tab":"e5c99d4.147226","order":2,"disp":true,"width":"6","collapse":false},{"id":"1fafbb1c.a2df75", "type": "mqtt-broker", "z":"", "name": "Server-Mqtt", "broker": "server.fritz.box", "port": "1883", "clientid":"", "usetls":false, "compatmode":true, "keepalive": "60", "cleansession":true, "birthTopic":"", "birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"b7e7d023.40f38","type":"homekit-accessory","z":"","accessoryName":"Steckdosen","pinCode":"111-11-111","port":"32303","manufacturer":"Nerdiy.de","model":"Default Model","serialNo":"Default Serial Number","accessoryType":"7"},{"id":"e5c99d4.147226","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1}]
Auch hier müsst Ihr (Überraschung 🙂 ) – wie bei den vorherigen Beispielen – das HomeKit-Accessory und den Service konfigurieren. Klickt dazu doppelt auf die Node „Steckdose“. Dadurch öffnet sich wieder das folgende Menü.
Descubre las opciones de configuración y las propiedades de los dispositivos
Bei Einigen Beispielen ist eine Inject-Node mit dem Namen „requestOptions“ vorhanden. Über diese habt Ihr die Möglichkeit die verfügbaren Eigenschaften der jeweiligen HomeKit-Node anzeigen zu lassen. Diese Eigenschaften könnt Ihr dann nutzen um das simulierte HomeKit-Gerät einzustellen. Zum Beispiel gibt es bei der HomeKit-Node welche die „MiniLichterkette“ steuert die Möglichkeit die ColorTermperature zu setzen. Setzt Ihr also die Eigenschaft wird der entsprechende Wert in HomeKit angezeigt.
Configuración en iPhone
Una vez creados los dispositivos HomeKit deseados en NodeRed, es hora de registrarlos en el dispositivo iOS. En esta sección se le guiará (un poco) paso a paso a través del proceso de registro. Como esto a veces implica muchas imágenes, los siguientes pasos se resumen como presentaciones de diapositivas.
humedad
Um die Anmeldung eines Luftfeuchtigkeitssensors zu starten klickt Ihr – wie im vorherigen Schritt angegeben – auf „Add Accessory“.
termostatos de calefacción
Um die Anmeldung des Heizungs-Thermostats zu starten klickt Ihr – wie im vorherigen Schritt – auf „Add Accessory“ und dann auf „Don’t Have a Code or Can’t Scan“.
(Tasmota) lámpara
Um die Anmeldung der Lampe zu starten klickt Ihr – wie im vorherigen Schritt – auf „Add Accessory“ und dann auf „Don’t Have a Code or Can’t Scan“.
(Tasmota) enchufe
Um die Anmeldung der Steckdose zu starten klickt Ihr – wie im vorherigen Schritt – auf „Add Accessory“ und dann auf „Don’t Have a Code or Can’t Scan“.
sensor de temperatura
Um die Anmeldung des Temperatursensors zu starten klickt Ihr – wie im vorherigen Schritt – auf „Add Accessory“ und dann auf „Don’t Have a Code or Can’t Scan“.
detector de movimiento
Um die Anmeldung des Bewegungsmelders zu starten klickt Ihr – wie im vorherigen Schritt – auf „Add Accessory“ und dann auf „Don’t Have a Code or Can’t Scan“.
Quizás ya lo hayas notado: con este nodo iOS tienes todo tipo de opciones. Simplemente prueba algo. Si tienes alguna pregunta, no dudes en dejarla en los comentarios.
Diviértete con el proyecto.
Espero que todo te haya funcionado como se describe. Si no es así, o si tiene alguna pregunta o sugerencia, hágamelo saber en los comentarios. Si es necesario, lo añadiré al artículo.
Las ideas para nuevos proyectos siempre son bienvenidas. 🙂
PS Muchos de estos proyectos, especialmente los proyectos de hardware, cuestan mucho tiempo y dinero. Por supuesto que hago esto porque lo disfruto, pero si crees que es genial que comparta la información contigo, me encantaría hacer una pequeña donación al fondo del café. 🙂
Hola nerd,
sitio genial y proyectos geniales! Ya he implementado algunas cosas en mi hogar inteligente (KNX, puente a HomeKit, Node Red, etc.) y todavía tengo mucho planeado. Estuve tratando de usar HomeKit Bridge de Node Red por un tiempo. También instalo y configuro los nodos para poder configurar un dispositivo en la aplicación HomeKit como prueba. Desafortunadamente, todo no es estable, la conexión se interrumpe regularmente y Node Red también se reinicia regularmente, es decir, algo en el nodo puente de Homekit provoca el bloqueo. ¿También tienes este problema o tienes una idea de cuál podría ser la razón?
Saludos turner
hola gimnasta,
gracias 🙂
Lamentablemente no se exactamente cual puede ser el motivo. Sin embargo, en el pasado tuve el problema de que mi instalación de NodeRed se reiniciaba por alguna razón. Para facilitar un poco la depuración, creé un flujo que guarda el último diario del proceso de NodeRed después de reiniciar NodeRed. Entonces puede ver bastante bien en qué punto NodeRed se bloqueó y corrigió el error. 🙂
Puedes encontrar información al respecto aquí: https://nerdiy.de/howto-nodered-automatisches-speichern-des-nodered-journals-nach-dem-start-von-nodered-zu-debugging-zwecken/
Atentamente
Fabian
Hola Fab,
sitio realmente genial. Actualmente estoy trabajando en el flujo de los termostatos de calefacción, la importación también funcionó maravillosamente. Estoy un poco atascado en este momento y tengo algunas preguntas:
1. ¿Puedo usar cualquier termostato de calefacción o tiene que ser compatible con Apple Homkit ya que estoy simulando un Homekit?
2. ¿Cómo "sabe" Node red que tengo un termostato, no tiene que ser transferido al WiFi de alguna manera?
3. Dependiendo del termostato, ¿necesito el puente adecuado o se puede hacer sin el puente adecuado?
Gracias de antemano por sus respuestas, como dije, no sé qué hacer a continuación.
Tal vez también pueda enviarme un correo electrónico con instrucciones detalladas sobre cómo proceder con el nuevo termostato de principio a fin.
Estaré encantado de saber de ti.
LG 🙂
Hola, Daniel,
1. En principio, puede ser cualquier termostato de calefacción, sí. Por supuesto, debe ser compatible con NodeRed o poder controlarse de alguna otra manera. 🙂
2. Según el tipo de termostato que tengas, se integra a través de DECT (con el Fritzbox), zigbee u otro estándar. A veces también se necesita una puerta de enlace adecuada.
3. Si ya tienes una FritzBox, te recomiendo uno de los termostatos de radiador que sea compatible con la FritzBox. La información (incluyendo cómo integrarla) se puede encontrar aquí, por ejemplo: https://nerdiy.de/howto-nodered-fritzbox-heizkoerperthermostat-aus-nodered-steuern/
Espero que esto ayude. De lo contrario, por favor hágamelo saber. 🙂
Atentamente
Fabian