Install Openhab 2 on my raspberry pi , and create site map + items + rules …I tried to control an LED local and remote using my raspberry pi GPIO and It is working .
Setup MQTT on my raspberry pi tested and working .
I got an Arduino mega 2560 + Ethernet shield , I’ve added some sensors and write and upload sketch to get input from the sensors and use them to trigger some LED for testing
Now I want to take an input form the sensor and write some rules based on that input …
For example I have motion sensor (PIR) , I want to control a light
if there is motion the light turns on
else light off , and I want to update the light Item to on or off
another Idea is to see if the light switched by the user via openhab and sensor delay for 5 min then will push notification to the user "light is on for some time and there is no one in the room , you better turn it off "
Ok thanks for the info. So now, you have rPi, openHab and the Arduino. Is your Arduino updating your MQTT topic? Is it publishing the sensor data?
When your Arduino GPIO is triggered (interrupt) or you’re polling (digital read), as soon as you have the data, you need your Arduino to publish that data to your MQTT. Assuming your openHAB is subscribed, you should be able to make a rule for it. Can you post your item and rules, if any?