Hello,
I have connected a button to my UniPi. I've connected it to I04 (Which turns on in the UniPi Control Panel when I am using Pin: 16, GPIO4) and then I've made a simple flow to try and read the state of the input and turn on relay 1 based on the output. The "TestRelay1" injectors both work.
Here is my flow (Exported code at the bottom):
![]()
When the flow is deployed to the Pi, the UniPi control panel shows Input 4 as on, but the flow shows it as 0. Neither recognise the button being pressed, even though the led on the UniPi does change state.
Before deployment, the control panel was recognising the button being pressed just fine.
Is there something wrong with my flow? What is the best way for me to read the Digital inputs on my UniPi through node-red?
Any help is greatly appreciated.
Matt
(Sorry if I haven't adhered to this groups posting conventions, let me know if I have done something wrong!)
Export code:
[{"id":"300b989c.e8de08","type":"websocket-client","path":"ws://
127.0.0.1/ws","wholemsg":"false"},{"id":"b40c4a71.fbf9a","type":"websocket out","name":"","server":"","client":"300b989c.e8de08","x":883,"y":300,"z":"903f246b.4a7b8","wires":[]},{"id":"bebdaeaf.8b774","type":"function","name":"GetState","func":"state = msg.payload;\nmsg= {};\n\nmsg.payload = {\"dev\":\"relay\",\"circuit\":\"1\",\"value\": state}\n\nreturn msg;","outputs":1,"valid":true,"x":636,"y":300,"z":"903f246b.4a7b8","wires":[["b40c4a71.fbf9a","2af3cdc0.a80f42"]]},{"id":"2af3cdc0.a80f42","type":"debug","name":"","active":false,"console":"false","complete":"payload","x":833,"y":245,"z":"903f246b.4a7b8","wires":[]},{"id":"905700c0.a31b88","type":"debug","name":"","active":true,"console":"false","complete":"false","x":637,"y":193,"z":"903f246b.4a7b8","wires":[]},{"id":"42b06efd.165be","type":"inject","name":"TestRelay1 - On","topic":"","payload":"1","payloadType":"string","repeat":"","crontab":"","once":false,"x":419,"y":389,"z":"903f246b.4a7b8","wires":[["bebdaeaf.8b774"]]},{"id":"8fefce24.ba2368","type":"inject","name":"TestRelay1 - Off","topic":"","payload":"0","payloadType":"string","repeat":"","crontab":"","once":false,"x":418,"y":440,"z":"903f246b.4a7b8","wires":[["bebdaeaf.8b774"]]},{"id":"882a3be.93f3ec8","type":"rpi-gpio in","name":"","pin":"16","intype":"tri","read":false,"x":379,"y":243,"z":"903f246b.4a7b8","wires":[["bebdaeaf.8b774","905700c0.a31b88"]]}]