This page is a spawn off my automation
page. If you ended up here via a search engine you can check out that
page too!
Okay, this page will be for examples and links to code I find and modify to
make things work because if you saw my front page (sorry) then you'd know I
suck at programming. The first few external links are for codebender.cc to provide working examples you can
modify. *Sad News* Codebender.cc is shutting down (at least to some degree).
Links will work until the end of 2016 by which time I will have moved
everything here to my own site.
This is a
working sketch for the esp8266 chip programmed through the Arduino
IDE. You'll need to follow a few steps to add support for the esp8266 to the
Arduino IDE (Google is your friend) but then you can copy/paste/modify the
sketch for your needs. This sketch is for acquiring data from a DHT11 sensor
and sending that information to a MQTT broker (which then puts it into
OpenHAB for me but that isn't a requirement to play with this)
This example
is for using a relay with a esp8266 board, same details as above.
A couple examples for the stuff show below via pastebin links - basic
sitemap and basic item and sitemap options.
And a link for a
temperature rule in OpenHAB to trigger an device based on the
temperature. I've since split this in two. The "off" section didn't appear
to be working correctly but having a separate on and off rule has
worked flawlessly.
Since the main focus of what I'm doing and playing with here are a few basic
examples for anyone starting out in OpenHAB. Below are two ways of show
items in a sitemap as well as how to configure those items:
*.items
Item type |
Item_Name |
"Human readable name" |
optional icon <> |
{binding + properties} |
Number Weather_Temperature "Outside Temperature [%.0f °F]" {
weather="locationId=home, type=temperature, property=current,
unit=fahrenheit" }
Number Weather_Humidity "Outside Humidity [%d%%]" {
weather="locationId=home, type=athmosphere, property=humidity" }
DateTime Date "Date [%1$tA, %1$tB.%1$td.%1$tY]" {
ntp="America/Los_Angeles:en_US" }
DateTime Sunrise "Sunrise [%1$tH:%1$tM]" {astro="planet=sun,
type=rise, property=start"}
DateTime Sunset "Sunset [%1$tH:%1$tM]" {astro="planet=sun,
type=set, property=end"}
*.sitemaps
Frame label="Date" {
Text item=Date
Text item=Sunrise
Text item=Sunset
}
Frame label="Weather" {
Text item=Weather_Temperature
Text item=Weather_Humidity
}
OR
*.items
Group Bedroom
Dimmer bedroomLight "Bedroom Light" (Bedroom)
{insteonplm="ab.cd.34:F00.00.01#dimmer"}
*.sitemap
Frame {
Group item=Bedroom label="Master Bedroom" icon="firstfloor"
}