Openhab2: Difference between revisions
No edit summary |
|||
(12 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Install Openhab | === Install Openhab === | ||
<pre>Just do it..</pre> | <pre>Just do it..</pre> | ||
Line 10: | Line 10: | ||
Install Z Wave Bindings | ===Install Z Wave Bindings=== | ||
<pre>PaperUI > Add Ons > Bindings > Z-wave Binding > install</pre> | <pre>PaperUI > Add Ons > Bindings > Z-wave Binding > install</pre> | ||
Once the Binding is installed, add the Z-wave binding as a Thing and verify that the serial port is correct. If the serial port is missing or will not be accepted, make sure you added openhab to the dialup group in the previous step. | |||
=== Add Items === | |||
* Within PaperUI, Things should begin showing up in the Inbox. | |||
* Add each thing using the naming convention : Location_Type_Target (ie. LivingRoom_Dimmer_AccentLights) | |||
* Click each thing and add the appropriate items for each channel | |||
== Device Naming == | |||
Using the simple convention of location, type, and target | |||
* Entry_Deadbolt | |||
* Entry_Proximity | |||
* Entry_Dimmer_AccentLights | |||
* Entry_Switch_EntryLights | |||
* GarageHall_Dimmer_GarageAccentLights | |||
== Rules == | |||
=== Accent Lighting Control === | |||
Turns on lights @ dusk, off at 10, on in the early morning, and then off again at sun up. | |||
<pre> | |||
// turn accent lights on at dusk | |||
rule "Accent Lights on @ Sunset" | |||
when | |||
Channel 'astro:sun:local:astroDusk#event' triggered START | |||
then | |||
logInfo("accent.rules", "Turning Lights On @ Sunset") | |||
Group_AccentLighting.sendCommand(ON) | |||
end | |||
rule "Accent Lights Off @ 10" | |||
when | |||
Time cron "0 0 22 ? * *" | |||
then | |||
logInfo("accent.rules", "Turning Lights Off @ 10") | |||
Group_AccentLighting.sendCommand(OFF) | |||
end | |||
// turn accent lights on at dusk | |||
rule "Accent Lights on @ Sunset" | |||
when | |||
Channel 'astro:sun:local:nauticDawn#event' triggered START | |||
then | |||
logInfo("accent.rules", "Turning Lights On @ Early Morning") | |||
Group_AccentLighting.sendCommand(ON) | |||
end | |||
// turn accent lights on at dusk | |||
rule "Accent Lights on @ Sunset" | |||
when | |||
Channel 'astro:sun:local:daylight#event' triggered START | |||
then | |||
logInfo("accent.rules", "Turning Lights Off @ Daylight") | |||
Group_AccentLighting.sendCommand(OFF) | |||
end | |||
</pre> | |||
=== Proximity @ Entryway === | |||
Triggers a light on motion and then deactivates after 3 minutes. | |||
<pre> | |||
var Timer timer = null | |||
rule "Handle PIR Events" | |||
when | |||
Item Entry_Proximity_BinarySensor received update | |||
then | |||
if (Entry_Proximity_BinarySensor.state == ON) | |||
{ | |||
if ( timer !== null ) | |||
{ | |||
timer.cancel | |||
timer = null; | |||
} | |||
Entry_Switch_EntryLights.sendCommand(ON) | |||
logInfo("entry.rules", "Starting a timer for 3 minutes") | |||
timer = createTimer( now.plusMinutes(3), [ | |||
logInfo("entry.rules", "Turnign entry proxmity off") | |||
Entry_Switch_EntryLights.sendCommand(OFF) | |||
Entry_Proximity_BinarySensor.sendCommand(OFF) | |||
timer = null | |||
]) | |||
} | |||
end</pre> |
Latest revision as of 00:04, 3 January 2019
Install Openhab
Just do it..
Allow Openhab to access Serial Devices by Adding 'openhab' to the Dialout Group
sudo vi /etc/group dialout:x:20:openhab
Install Z Wave Bindings
PaperUI > Add Ons > Bindings > Z-wave Binding > install
Once the Binding is installed, add the Z-wave binding as a Thing and verify that the serial port is correct. If the serial port is missing or will not be accepted, make sure you added openhab to the dialup group in the previous step.
Add Items
- Within PaperUI, Things should begin showing up in the Inbox.
- Add each thing using the naming convention : Location_Type_Target (ie. LivingRoom_Dimmer_AccentLights)
- Click each thing and add the appropriate items for each channel
Device Naming
Using the simple convention of location, type, and target
- Entry_Deadbolt
- Entry_Proximity
- Entry_Dimmer_AccentLights
- Entry_Switch_EntryLights
- GarageHall_Dimmer_GarageAccentLights
Rules
Accent Lighting Control
Turns on lights @ dusk, off at 10, on in the early morning, and then off again at sun up.
// turn accent lights on at dusk rule "Accent Lights on @ Sunset" when Channel 'astro:sun:local:astroDusk#event' triggered START then logInfo("accent.rules", "Turning Lights On @ Sunset") Group_AccentLighting.sendCommand(ON) end rule "Accent Lights Off @ 10" when Time cron "0 0 22 ? * *" then logInfo("accent.rules", "Turning Lights Off @ 10") Group_AccentLighting.sendCommand(OFF) end // turn accent lights on at dusk rule "Accent Lights on @ Sunset" when Channel 'astro:sun:local:nauticDawn#event' triggered START then logInfo("accent.rules", "Turning Lights On @ Early Morning") Group_AccentLighting.sendCommand(ON) end // turn accent lights on at dusk rule "Accent Lights on @ Sunset" when Channel 'astro:sun:local:daylight#event' triggered START then logInfo("accent.rules", "Turning Lights Off @ Daylight") Group_AccentLighting.sendCommand(OFF) end
Proximity @ Entryway
Triggers a light on motion and then deactivates after 3 minutes.
var Timer timer = null rule "Handle PIR Events" when Item Entry_Proximity_BinarySensor received update then if (Entry_Proximity_BinarySensor.state == ON) { if ( timer !== null ) { timer.cancel timer = null; } Entry_Switch_EntryLights.sendCommand(ON) logInfo("entry.rules", "Starting a timer for 3 minutes") timer = createTimer( now.plusMinutes(3), [ logInfo("entry.rules", "Turnign entry proxmity off") Entry_Switch_EntryLights.sendCommand(OFF) Entry_Proximity_BinarySensor.sendCommand(OFF) timer = null ]) } end