I have wired the most important lights in a star shape, so all wires lead to a electric panel
There I have a hardware step-by-step relay that turns the lights on/off according to a push-button input (hardware push buttons on walls)
Now I want to controll the lights using my Raspberry PI2 and OpenHAB2
Right now I am working to set-up push-buttons in my sitemap to use GPIO pins to turn the lights on/off. It’s not working very well atm, I will post it later
However I have another problem that needs solving: as I also control the lights from the physical push-buttons on walls, I need to monitor and update the lights status in OpenHAB2.
How about using the search function first ?
The GPIO binding should do what you’re looking for.
There’s also scripts like this
They’re meant to run on a non-openHAB Pi and report /allow for remote control via MQTT because not everybody has attached all of his lights to the central Pi running OH.
Thank you, I have been searching for the last 2 days, but probably I searched for wrong text.
I will look at the link and hopefully I can learn from it
The GPIO binding should suffice in terms of status and control. You could also use MQTT for the GPIO bindings if your OH server is not hosted on the Raspberry Pi that controls the inputs/outputs, as Markus already suggested.
Be careful though with the outputs (relays) - depending on the type of load (resistive, inductive, or capacitive) and power, the relays should be chosen accordingly.
OH is on the raspberry pi. Is there any reason why I should host it elsewhere?
I plan to use relays for Arduino, they have optocouplers and they draw very low mA - I guess that’s the primary concern, right?
Nothing wrong with that. It just means that you need to have cables going from everywhere to your Pi.
If you deploy Arduinos anyway, you could have them speak MQTT, then you just need a single cable (or WiFi) towards the Pi to transmit MQTT over IP. Same as to deploy another ‘slave’ Pi to run a script.
I got involved when I installed the electrical wires, so the most important ones are routed in a central panel where I can control them.
I struggled with arduino webserver, it’s very limited because of the low memory. I managed to do this with arduino: http://sanpetru.4est.ro:8201/
I published the code for this, so it’s available
the data is parsed by cacti runnin on a linux box and producing these graphs:
I was planning on implementing buttons on arduino, but seems so much nicer on OpenHab, so I decided to switch to raspberry pi + openhab.
I haven’t red about MQTT yet, I probably will if need to communicate with other boards like arduino
I use arduino for all I/O (generally nano) and a radio network to move data back to a raspberry pi (via ethernet arduino gateway). The pi runs OH. The radio are very cheap (less than cost of nano) and this gives a very versatile system and low cost system. It also limits the risk of I/O issues, e.g. noise pickup, earth loops etc crashing the system.
wow, there’s a lot of reading on the instructables link. but that’s good
the radio parts arrived and I’ll continue my work, I’ve decided to do as you did, a arduino gateway