Has anyone ever had experience on integrating Xbee S2 module and arduino with OpenHab? How to get value from sensors and how to control relays, switches?
Can anyone show me how can I implement such thing above?
It’d be a great,great help
Thanks inadvance
I use the serial binding with one of my arduino’s and setup the Xbee as a serial bridge. I have my arduino code in github, it sends messages to openHAB and also parse commands sent to it. This openHAB rule reads the serial port messages and parses it to update an item.
items
Contact Doors "Doors [MAP(en.map):%s]" <door>
String DoorStatus "Door Status [%s]" { serial="COM99" }
rules:
rule "Door update"
when
Item DoorStatus received update
then
var String buffer = DoorStatus.state.toString
if(buffer.contains("Door_Opened"))
{
postUpdate(Doors,"OPEN")
}else{
postUpdate(Doors,"CLOSED")
}
end
The 1.8 serial binding supports regex but I have not attempted to use it. I have switched most of my arduinos to use ethernet shields or ESP8266 and communication over MQTT.