1. You need to register and have an login account for openHAB. If you haven’t already signed up for free openhab account. You can sign-up from https://myopenhab.org/. In case you are not planning to control your home devices over internet (any where you have internet connection) then you can skip this step. (If you skip this step you will be able to control your devices only on your local wifi.)
2. Configure OpenHab cloud interface (Skip this step if you just want device control on local wifi). Connect to openhab dashboard of your automation local home server by typing <Your server IP address>:8080 in internet browser address bar. (In case you don’t know the IP Address of your automation server you can find it by opening a terminal on your server and type in "$ifconfig
" command )
3. Using the documentation available here https://www.openhab.org/docs/tutorial/configuration.html add and configure MQTT binding
4. Using documentation available here https://www.openhab.org/docs/configuration/sitemaps.html#concepts create a sitemap
Sample file /etc/openhab2/sitemaps/gh_automation.sitemap
sitemap gh_automation label="GH AUTOMATION" { //Begin sitemap
Frame { //Begin mainframe
//Garage
Group item=Garage {
Frame label="Door" {
Text item=gr_door_State icon=Garagedoor
Switch item=gr_door_Cmd icon=garagedoorclosed visibility=[gr_door_State==Close] labelcolor=[gr_door_State==Close="green"] valuecolor=[gr_door_State==Close="green"] mappings=[ON="Open"] label="Garage door action"
Switch item=gr_door_Cmd icon=garagedooropen visibility=[gr_door_State==Open] labelcolor=[gr_door_State==Open="red"] valuecolor=[gr_door_State==Open="red"] mappings=[OFF="Close"] label="Garage door action"
Text item=gr_door_Msg
}
} // end Garage
//Bonus Room
Group item=Bonusroom {
Frame label="LED" {
Colorpicker item=br_led_color
Switch item=br_led_power
Slider item=br_led_slide
Slider item=br_led_slide2
}
} //End Bonus Room
//Airconditioner - Items defined in ecobee.items
Group item=AirConditioner {
Frame label="ecobee thermostat" {
Text item=actualTemperature
Text item=actualHumidity
Switch item=hvacMode label="hvac mode" mappings=[heat=Heat,cool=Cool,auto=Auto,off=Off]
Text item=currentClimateRef
Switch item=desiredComf mappings=[sleep=Sleep,wakeup=Wake,home=Home,away=Away,smart6=Gym,resume=Resume]
Setpoint item=desiredTemp label="Desired Temp [%.1f °F]" minValue=50 maxValue=80 step=1 visibility=[hvacMode==heat,hvacMode==cool]
Setpoint item=desiredHeat label="Heat [%.1f °F]" minValue=50 maxValue=80 step=1 visibility=[hvacMode==auto]
Setpoint item=desiredCool label="Cool [%.1f °F]" minValue=50 maxValue=80 step=1 visibility=[hvacMode==auto]
Switch item=desiredFan mappings=[on=On,auto=Auto] // for rule supported in 1.9
}
Frame label="Ecobee Hallway Sensor" {
Text item=hallwayTemperature
Text item=hallwayOccupancy
}
Frame label="Ecobee Thermostat details"{
Group item=ecobee label="Thermostat details"{
Frame label="ecobee thermostat"{
Text item=eb_identifier
Text item=eb_name
Text item=eb_thermostatRev
Text item=eb_isRegistered
Text item=eb_modelNumber
Text item=eb_brand
Text item=eb_features
Text item=eb_lastModified
Text item=eb_thermostatTime
Text item=eb_utcTime
Text item=eb_equipmentStatus
Text item=eb_version_thermostat
Text item=eb_program_currentClimateRef
}
}
}
} //end Airconditioner
} //end Main frame
} //end sitemap
5. Using documentation available here https://www.openhab.org/docs/configuration/items.html create items
Sample /etc/openhab2/items/gh_automation.items
//GH Automation Items definitions
//itemtype itemname ["labeltext"] [<iconname>] [(group1, group2, ...)] [{bindingconfig}]
Group Home "GH AUTOMATION" <house>
//Rooms
Group Garage "Garage" <garage> (Home)
Group Bonusroom "BonusRoom" <screen> (Home)
Group AirConditioner "AirConditioner" (Home)
//Garage
String gr_door_State "Current door status[%s]" (Garage) {mqtt="<[localBroker:GH/out/GarageDoor:state:default]",autoupdate="false"}
Switch gr_door_Cmd "Door command" (Garage) {mqtt=">[localBroker:GH/in/GarageDoor:command:ON:Open],>[localBroker:GH/in/GarageDoor:command:OFF:Close]"}
String gr_door_Msg "[%s]" (Garage) {mqtt="<[localBroker:GH/out/GarageDoor/State:state:default]",autoupdate="false"}
//BonusRoom
Switch br_led_power "Power" (Bonusroom) {channel="wifiled:wifiled:0a039cc8:power"}
Dimmer br_led_slide "Dimmer" (Bonusroom) {channel="wifiled:wifiled:0a039cc8:white"}
Dimmer br_led_slide2 "Dimmer2" (Bonusroom) {channel="wifiled:wifiled:0a039cc8:white2"}
Color br_led_color "Color" (Bonusroom) {channel="wifiled:wifiled:0a039cc8:color"}
//Group:Contact:OR(OPEN, CLOSED) GarageDoor_State "Door" <door> (Garage)
//Group:Switch:OR(ON, OFF) GarageDoor_Cmd "Light" <light> (Garage)