Skip to content

Commit

Permalink
add group LWRF switch, by adding virtual switch and corresponding rul…
Browse files Browse the repository at this point in the history
…e in .rules config file
  • Loading branch information
glynhudson committed Feb 5, 2016
1 parent b5b5a9f commit a6dce46
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
7 changes: 4 additions & 3 deletions Readme.md
Expand Up @@ -51,6 +51,7 @@ Download openHAB addons (http://www.openhab.org/getting-started/downloads.html),
$ sudo ln -s /home/pi/oem_openHab/openhab.cfg /etc/openhab/configurations/
$ sudo ln -s /home/pi/oem_openHab/oem.items /etc/openhab/configurations/items/default.items
$ sudo ln -s /home/pi/oem_openHab/oem.sitemap /etc/openhab/configurations/sitemaps/oem.sitemap
$ sudo ln -s /home/pi/oem_openHab/oem.rules /etc/openhab/configurations/sitemaps/oem.rules
$ sudo /etc/init.d/openhab restart

Then browse to:
Expand Down Expand Up @@ -99,17 +100,17 @@ View log:
$ tail /var/log/openhab/openhab.log
$ tail /var/log/openhab/event.log
To enable verbose debug mode cheange debug to 'yes' in:
To enable verbose debug mode cheange debug to 'yes' in:

sudo nano /etc/default/openhab

Note: it's not recomended to leave debug turned on by default as its very verbose and will fill up your logs!
Note: it's not recomended to leave debug turned on by default as its very verbose and will fill up your logs!

By default openHAB logs all events to /var/log/openhab/event.log, this is very verbose and filles up /var/log quickly as events also appear in syslog and daemon log. To disable event log:

sudo nano /etc/openhab/logback.xml

Change "runtime.busevents" loglevel from "INFO" to "WARN"
Change "runtime.busevents" loglevel from "INFO" to "WARN"

<logger name="runtime.busevents" level="WARN" additivity="false">

Expand Down
1 change: 1 addition & 0 deletions oem.items
Expand Up @@ -23,6 +23,7 @@ Number emonth_t23 "Temperature [%.1f°C]" { mqtt="<[mosquitto:emonhub/rx/
Number emonth_h23 "Humidity [%.1f RH]" { mqtt="<[mosquitto:emonhub/rx/23/values:state:REGEX(.*,.*,(.*),.*,.*)]" }

/* LWRF Devices */
Switch lwrf_all "All LWRF"
Switch lwrf0 "LWRF Socket 0" {mqtt=">[mosquitto:lwrf:command:ON:0 1],>[mosquitto:lwrf:command:OFF:0 0]"}
Switch lwrf1 "LWRF Socket 1" {mqtt=">[mosquitto:lwrf:command:ON:1 1],>[mosquitto:lwrf:command:OFF:1 0]"}
Switch lwrf2 "LWRF Socket 2" {mqtt=">[mosquitto:lwrf:command:ON:2 1],>[mosquitto:lwrf:command:OFF:2 0]"}
Expand Down
12 changes: 12 additions & 0 deletions oem.rules
@@ -0,0 +1,12 @@
//rules

rule "Switch all LWRF sockets"
when
Item lwrf_all received command
then
lwrf0.sendCommand(receivedCommand)
lwrf1.sendCommand(receivedCommand)
lwrf2.sendCommand(receivedCommand)
lwrf3.sendCommand(receivedCommand)
lwrf4.sendCommand(receivedCommand)
end
11 changes: 6 additions & 5 deletions oem.sitemap
Expand Up @@ -28,11 +28,12 @@ sitemap default label="OpenEnergyMonitor"
Frame label="Control" {
Text label="LWRF Plug Control" icon="socket"{
Frame label="Light Wave RF"{
Switch item=lwrf0 label="LWRF Plug 0"
Switch item=lwrf1 label="LWRF Plug 1"
Switch item=lwrf2 label="LWRF Plug 2"
Switch item=lwrf3 label="LWRF Plug 3"
Switch item=lwrf4 label="LWRF Plug 4"
Switch item=lwrf_all label="All" mappings=[OFF="All Off", ON="All On"]
Switch item=lwrf0 label="LWRF Plug 0"
Switch item=lwrf1 label="LWRF Plug 1"
Switch item=lwrf2 label="LWRF Plug 2"
Switch item=lwrf3 label="LWRF Plug 3"
Switch item=lwrf4 label="LWRF Plug 4"
}
}

Expand Down

0 comments on commit a6dce46

Please sign in to comment.