Homekit relay to foutain and light bulb

Hej All you :slight_smile:
What I have:

  • Raspi3
  • 2 x 2relays
  • Camera
  • Speaker, Microphone and USB-soundcard
  • 3 x waterpump
  • 1 x LED-light bulp
  • DHT22 sensor ( tempereture and humidity

Using Homekit and SIRI

  • Everything is working fine, though. When it should be on the pump or LED-light is off and on off it´s on.
    I just can´t find waht is wrong with my system.

function:
msg.payload = msg.payload.On;
return msg;

complete debug
msg : Object
object
payload: object
hap: object
_msgid: "a22214ae.ae1808"

-lm-

Take a look at what you have posted and see if you think it is enough to understand your issue.

You've explained what is wrong, but not what your flow is.
It would be better to export and paste your flow ( see this guide first How to share code or flow json)

It's great that you pasted a copy of a message, but to be useful you would need to show us the entire message not just that it contains objects.

1 Like

Hej !

  • ukmoose, thanks but I do not know how to do / or did not understand what you wrote. Node Red ias new for me and real programming is also stange to me.
  • so I really don´t know how to ask this and how. But I just want help.

-lm-

To be able to help you, you need to tell us what you have done.

What does your flow in Node-RED look like? You can export your flow
Menu > Export > Clipboard

Hej!

thanks :slight_smile:

[{"id":"fc7876a5.09926","type":"tab","label":"Lämpötila ja ilman kosteus","disabled":false,"info":""},{"id":"16e128e6.e878d7","type":"rpi-dht22","z":"fc7876a5.09926","name":"Lämpö ja Kosteus","topic":"rpi-dht22","dht":22,"pintype":"1","pin":"15","x":450,"y":180,"wires":[["13bc6745.baf009","8f996438.3cbbe","b5f85e6f.aaf968"]]},{"id":"d0895dca.070fc8","type":"inject","z":"fc7876a5.09926","name":"","topic":"","payload":"","payloadType":"date","repeat":"5","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":180,"wires":[["16e128e6.e878d7"]]},{"id":"b5f85e6f.aaf968","type":"debug","z":"fc7876a5.09926","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":670,"y":180,"wires":},{"id":"a84af806.df17e","type":"homekit-service","z":"fc7876a5.09926","accessory":"f9bd398a.76b53","name":"Puutalon lämpömittari","serviceName":"TemperatureSensor","x":520,"y":260,"wires":[]},{"id":"446e8979.3566e8","type":"homekit-service","z":"fc7876a5.09926","accessory":"6215a5f1.88e37c","name":"Puutalon kosteus","serviceName":"HumiditySensor","x":510,"y":320,"wires":[]},{"id":"13bc6745.baf009","type":"function","z":"fc7876a5.09926","name":"Curent temperature","func":"msg.payload = {\n CurrentTemperature: parseFloat(msg.payload)\n}\nreturn msg;","outputs":1,"noerr":0,"x":290,"y":260,"wires":[["a84af806.df17e"]]},{"id":"8f996438.3cbbe","type":"function","z":"fc7876a5.09926","name":"Convert humidity","func":"msg.payload = {\n CurrentRelativeHumidity: parseInt(msg.humidity)\n}\nreturn msg;","outputs":1,"noerr":0,"x":290,"y":320,"wires":[["446e8979.3566e8"]]},{"id":"61474acc.92125c","type":"debug","z":"fc7876a5.09926","name":"Valo","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":770,"y":500,"wires":},{"id":"2a4e91bb.29d8be","type":"homekit-service","z":"fc7876a5.09926","accessory":"22e963d2.7242a4","name":"Paljupumppu","serviceName":"Switch","x":110,"y":397,"wires":[["6f5ef835.f5ee18","ef0762d3.efc7b8"]]},{"id":"6f5ef835.f5ee18","type":"function","z":"fc7876a5.09926","name":"On","func":"msg.payload = msg.payload.On;\nreturn msg;","outputs":1,"noerr":0,"x":290,"y":397,"wires":[["906ead7d.b129c8"]]},{"id":"906ead7d.b129c8","type":"rpi-gpio out","z":"fc7876a5.09926","name":"","pin":"8","set":false,"level":"0","freq":"","out":"out","x":470,"y":397,"wires":},{"id":"a67ca95f.4ff3b","type":"homekit-service","z":"fc7876a5.09926","accessory":"30107ac8.d8dc5e","name":"Ovaalinpumppu","serviceName":"Switch","x":120,"y":457,"wires":[["e247b8b5.70def8"]]},{"id":"bfafefd9.59fa5","type":"homekit-service","z":"fc7876a5.09926","accessory":"ff6ef24b.71c46","name":"Pyöreänpumppu","serviceName":"Switch","x":130,"y":517,"wires":[["3430902b.1b63"]]},{"id":"e247b8b5.70def8","type":"function","z":"fc7876a5.09926","name":"On","func":"msg.payload = msg.payload.On;\nreturn msg;","outputs":1,"noerr":0,"x":293,"y":457,"wires":[["b3be8b31.b41db"]]},{"id":"3430902b.1b63","type":"function","z":"fc7876a5.09926","name":"On","func":"msg.payload = msg.payload.On;\nreturn msg;","outputs":1,"noerr":0,"x":293,"y":517,"wires":[["a8dfc83e.950428"]]},{"id":"b3be8b31.b41db","type":"rpi-gpio out","z":"fc7876a5.09926","name":"","pin":"10","set":"","level":"0","freq":"","out":"out","x":481,"y":457,"wires":},{"id":"a8dfc83e.950428","type":"rpi-gpio out","z":"fc7876a5.09926","name":"","pin":"11","set":"","level":"0","freq":"","out":"out","x":482,"y":517,"wires":},{"id":"21d21043.8a5ee8","type":"homekit-service","z":"fc7876a5.09926","accessory":"3beb1015.867aa","name":"Takapihanyövalo","serviceName":"Lightbulb","x":130,"y":576,"wires":[["379c1f8e.a1c998","61474acc.92125c"]]},{"id":"379c1f8e.a1c998","type":"function","z":"fc7876a5.09926","name":"On","func":"msg.payload = msg.payload.On;\nreturn msg;","outputs":1,"noerr":0,"x":292,"y":576,"wires":[["ead795c0.51e1f8"]]},{"id":"ead795c0.51e1f8","type":"rpi-gpio out","z":"fc7876a5.09926","name":"","pin":"12","set":"","level":"0","freq":"","out":"out","x":484,"y":576,"wires":},{"id":"ef0762d3.efc7b8","type":"debug","z":"fc7876a5.09926","name":"Pumput","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":740,"y":360,"wires":},{"id":"f9bd398a.76b53","type":"homekit-accessory","z":"","accessoryName":"Lämpömittari","pinCode":"845-25-672","port":"","manufacturer":"Tilattu Kiinasta","model":"DHT22","serialNo":"Hajuakaan ei oo","accessoryType":"10"},{"id":"6215a5f1.88e37c","type":"homekit-accessory","z":"","accessoryName":"Kosteus mittari","pinCode":"845-25-673","port":"","manufacturer":"Kiinasta tilattu","model":"DHT22","serialNo":"Mikän mahtaa olla","accessoryType":"10"},{"id":"22e963d2.7242a4","type":"homekit-accessory","z":"","accessoryName":"Paljupumppu","pinCode":"845-25-701","port":"","manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","accessoryType":"30"},{"id":"30107ac8.d8dc5e","type":"homekit-accessory","z":"","accessoryName":"Ovaalinpumppu","pinCode":"845-25-702","port":"","manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","accessoryType":"8"},{"id":"ff6ef24b.71c46","type":"homekit-accessory","z":"","accessoryName":"Pyöreänpumppu","pinCode":"845-25-703","port":"","manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","accessoryType":"8"},{"id":"3beb1015.867aa","type":"homekit-accessory","z":"","accessoryName":"Takapihanyövalo","pinCode":"845-25-810","port":"","manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","accessoryType":"5"}]

-lm-

Export your flow again and follow this post.

Hej!

  • I hope its right now
[{"id":"fc7876a5.09926","type":"tab","label":"Lämpötila ja ilman kosteus","disabled":false,"info":""},{"id":"16e128e6.e878d7","type":"rpi-dht22","z":"fc7876a5.09926","name":"Lämpö ja Kosteus","topic":"rpi-dht22","dht":22,"pintype":"1","pin":"15","x":450,"y":180,"wires":[["13bc6745.baf009","8f996438.3cbbe","b5f85e6f.aaf968"]]},{"id":"d0895dca.070fc8","type":"inject","z":"fc7876a5.09926","name":"","topic":"","payload":"","payloadType":"date","repeat":"5","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":180,"wires":[["16e128e6.e878d7"]]},{"id":"b5f85e6f.aaf968","type":"debug","z":"fc7876a5.09926","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":670,"y":180,"wires":[]},{"id":"a84af806.df17e","type":"homekit-service","z":"fc7876a5.09926","accessory":"f9bd398a.76b53","name":"Puutalon lämpömittari","serviceName":"TemperatureSensor","x":520,"y":260,"wires":[[]]},{"id":"446e8979.3566e8","type":"homekit-service","z":"fc7876a5.09926","accessory":"6215a5f1.88e37c","name":"Puutalon kosteus","serviceName":"HumiditySensor","x":510,"y":320,"wires":[[]]},{"id":"13bc6745.baf009","type":"function","z":"fc7876a5.09926","name":"Curent temperature","func":"msg.payload = {\n    CurrentTemperature: parseFloat(msg.payload)\n}\nreturn msg;","outputs":1,"noerr":0,"x":290,"y":260,"wires":[["a84af806.df17e"]]},{"id":"8f996438.3cbbe","type":"function","z":"fc7876a5.09926","name":"Convert humidity","func":"msg.payload = {\n    CurrentRelativeHumidity: parseInt(msg.humidity)\n}\nreturn msg;","outputs":1,"noerr":0,"x":290,"y":320,"wires":[["446e8979.3566e8"]]},{"id":"61474acc.92125c","type":"debug","z":"fc7876a5.09926","name":"Valo","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":770,"y":500,"wires":[]},{"id":"2a4e91bb.29d8be","type":"homekit-service","z":"fc7876a5.09926","accessory":"22e963d2.7242a4","name":"Paljupumppu","serviceName":"Switch","x":110,"y":397,"wires":[["6f5ef835.f5ee18","ef0762d3.efc7b8"]]},{"id":"6f5ef835.f5ee18","type":"function","z":"fc7876a5.09926","name":"On","func":"msg.payload = msg.payload.On;\nreturn msg;","outputs":1,"noerr":0,"x":290,"y":397,"wires":[["906ead7d.b129c8"]]},{"id":"906ead7d.b129c8","type":"rpi-gpio out","z":"fc7876a5.09926","name":"","pin":"8","set":false,"level":"0","freq":"","out":"out","x":470,"y":397,"wires":[]},{"id":"a67ca95f.4ff3b","type":"homekit-service","z":"fc7876a5.09926","accessory":"30107ac8.d8dc5e","name":"Ovaalinpumppu","serviceName":"Switch","x":120,"y":457,"wires":[["e247b8b5.70def8"]]},{"id":"bfafefd9.59fa5","type":"homekit-service","z":"fc7876a5.09926","accessory":"ff6ef24b.71c46","name":"Pyöreänpumppu","serviceName":"Switch","x":130,"y":517,"wires":[["3430902b.1b63"]]},{"id":"e247b8b5.70def8","type":"function","z":"fc7876a5.09926","name":"On","func":"msg.payload = msg.payload.On;\nreturn msg;","outputs":1,"noerr":0,"x":293,"y":457,"wires":[["b3be8b31.b41db"]]},{"id":"3430902b.1b63","type":"function","z":"fc7876a5.09926","name":"On","func":"msg.payload = msg.payload.On;\nreturn msg;","outputs":1,"noerr":0,"x":293,"y":517,"wires":[["a8dfc83e.950428"]]},{"id":"b3be8b31.b41db","type":"rpi-gpio out","z":"fc7876a5.09926","name":"","pin":"10","set":"","level":"0","freq":"","out":"out","x":481,"y":457,"wires":[]},{"id":"a8dfc83e.950428","type":"rpi-gpio out","z":"fc7876a5.09926","name":"","pin":"11","set":"","level":"0","freq":"","out":"out","x":482,"y":517,"wires":[]},{"id":"21d21043.8a5ee8","type":"homekit-service","z":"fc7876a5.09926","accessory":"3beb1015.867aa","name":"Takapihanyövalo","serviceName":"Lightbulb","x":130,"y":576,"wires":[["379c1f8e.a1c998","61474acc.92125c"]]},{"id":"379c1f8e.a1c998","type":"function","z":"fc7876a5.09926","name":"On","func":"msg.payload = msg.payload.On;\nreturn msg;","outputs":1,"noerr":0,"x":292,"y":576,"wires":[["ead795c0.51e1f8"]]},{"id":"ead795c0.51e1f8","type":"rpi-gpio out","z":"fc7876a5.09926","name":"","pin":"12","set":"","level":"0","freq":"","out":"out","x":484,"y":576,"wires":[]},{"id":"ef0762d3.efc7b8","type":"debug","z":"fc7876a5.09926","name":"Pumput","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":740,"y":360,"wires":[]},{"id":"f9bd398a.76b53","type":"homekit-accessory","z":"","accessoryName":"Lämpömittari","pinCode":"845-25-672","port":"","manufacturer":"Tilattu Kiinasta","model":"DHT22","serialNo":"Hajuakaan ei oo","accessoryType":"10"},{"id":"6215a5f1.88e37c","type":"homekit-accessory","z":"","accessoryName":"Kosteus mittari","pinCode":"845-25-673","port":"","manufacturer":"Kiinasta tilattu","model":"DHT22","serialNo":"Mikän mahtaa olla","accessoryType":"10"},{"id":"22e963d2.7242a4","type":"homekit-accessory","z":"","accessoryName":"Paljupumppu","pinCode":"845-25-701","port":"","manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","accessoryType":"30"},{"id":"30107ac8.d8dc5e","type":"homekit-accessory","z":"","accessoryName":"Ovaalinpumppu","pinCode":"845-25-702","port":"","manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","accessoryType":"8"},{"id":"ff6ef24b.71c46","type":"homekit-accessory","z":"","accessoryName":"Pyöreänpumppu","pinCode":"845-25-703","port":"","manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","accessoryType":"8"},{"id":"3beb1015.867aa","type":"homekit-accessory","z":"","accessoryName":"Takapihanyövalo","pinCode":"845-25-810","port":"","manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","accessoryType":"5"}]

Which of the many homekit nodes are you using?

Hej!

  • hope this img helps

-lm.

What is the problem ?

Hej!

  • when I use those 4 ( xpumppu and valo) on is off and off is on.
  • I don't know how to change that.
  • now I have it like
msg.payload = msg.payload.On;
return msg;

What is the name of the homekit node you have installed?

Node-red-contrib-?????????

There are 8, which one????
https://flows.nodered.org/?term=homekit&type=node&num_pages=1

Also, show us a message for your debug “Pumput”
when you click On

and when you click Off

Hej !

  • node-red-contrib-homekit

Click On

{"payload":{"On":true},"hap":{"oldValue":false,"newValue":true,"context":{"keepalive":true,"1.33":true},"characteristic":{"displayName":"On","UUID":"00000025-0000-1000-8000-0026BB765291","iid":33,"value":true,"status":null,"eventOnlyCharacteristic":false,"props":{"format":"bool","unit":null,"minValue":null,"maxValue":null,"minStep":null,"perms":["pr","pw","ev"]},"subscriptions":2,"_events":{},"_eventsCount":1}},"_msgid":"a88de520.3a7368"}

Click Off

{"payload":{"On":false},"hap":{"oldValue":true,"newValue":false,"context":{"keepalive":true,"1.33":true},"characteristic":{"displayName":"On","UUID":"00000025-0000-1000-8000-0026BB765291","iid":33,"value":false,"status":null,"eventOnlyCharacteristic":false,"props":{"format":"bool","unit":null,"minValue":null,"maxValue":null,"minStep":null,"perms":["pr","pw","ev"]},"subscriptions":2,"_events":{},"_eventsCount":1}},"_msgid":"c661f32b.678cb"}

-lm-

  • node-red-contrib-homekit

updated almost 3 years ago, is this node still working properly ?

Hej!

  • yes its working in my other RasPi´s
  • there is also RedMatic-HomeKit,,, never try that before.

Easiest is probably to use your function node to change true to false and false to true

if (msg.payload.On === true){
   msg.payload = false
}
else { msg.payload = true}
return msg;

Hej!

  • Thank you for answering to me .. Now I have been looking what is wrong with my system. It seems to be my GPIO cable, ´cause it´s the same in Dashboard, so "true" and "false" is ok. :slight_smile: but my cables are not.

It´s in my backyard so I have to wait when is not so cold ...

-lm-