Category Archives: Uncategorized

Setting Openhab2 Zwave to show debug logs

Start the openhab-cli console and set Zwave to debug

[root@host openhab2]# openhab-cli console

Logging in as openhab

                          __  _____    ____
  ____  ____  ___  ____  / / / /   |  / __ )
 / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  |
/ /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ /
\____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/
    /_/                        2.5.0-SNAPSHOT
                               Build #1507

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown openHAB.

openhab>log:set DEBUG org.openhab.binding.zwave
openhab> log:tail
20:40:32.065 [DEBUG] [rnal.protocol.ZWaveTransactionManager] - 

follow the log

openhab> log:tail
20:40:32.065 [DEBUG] [rnal.protocol.ZWaveTransactionManager] - 

This will also show up in the the text logs like /var/log/openhab2/openhab.log

Set back to the default

openhab> log:set INFO org.openhab.binding.zwave

Exit

openhab> logout

See https://www.openhab.org/docs/administration/console.html for more details about using the console

for more details about using the console

Visual indicator that the gargage door is open with Openhab2 and Homeseer HS-WD200+ zwave

I am using openhab2 running on a centos server in the house with a USB Zwave stick.

I have 2 Monoprice Z-Wave Garage Door Sensor, NO LOGO (D132) Monoprice Z-Wave Garage Door Sensors.

I have been using these excellent dimmers in the house HomeSeer HS-WD100+ Z-Wave Plus Scene Capable Wall Dimmer but recently changed one in the living room to HomeSeer HS-WD200+ Z-Wave Plus Scene Capable RGB Wall Dimmer which has the ability to set the LED color and if an LED will flash or not.

My goal was to have LED 7 flash red when garage door 1 is open, and LED 6 flash green when garage door 2 is open.

I am running openhab2 2.3.0 nightly snapshot openhab2-2.3.0.20180427191516-1.noarch. This may or may not work in earlier versions. I have the Z-Wave Binding installed, and in configuration -> system i have Item Linking – Simple Mode turned off.

Here are the relevant openhab items and rules.

items/motion.items

Group Motion

Number garage_door_1_battery “Garage 1 Battery” (Motion) {channel=”zwave:device:9d6ae427:node9:battery-level”}
Contact garage_door_1_motion “Garage 1 Motion [%s]” (Motion) {channel=”zwave:device:9d6ae427:node9:sensor_door”}
Switch garage_door_1_tamper “Garage 1 Tamper [%s]” (Motion) {channel=”zwave:device:9d6ae427:node9:alarm_burglar”}

Number garage_door_2_battery “Garage 2 Battery” (Motion) {channel=”zwave:device:9d6ae427:node11:batter-level”}
Contact garage_door_2_motion “Garage 2 Motion [%s]” (Motion) {channel=”zwave:device:9d6ae427:node11:sensor_door”}
Switch garage_door_2_tamper “Garage 2 Tamper [%s]” (Motion) {channel=”zwave:device:9d6ae427:node11:alarm_burglar”}

items/tv.items

Group GF (All)
Group BS (All)
Group US (All)
Group gSunset
Group g1am
Group g12midnight
Group gfLights

Dimmer light_tv_dimmer “TV light” (GF,gfLights) [ “Lighting” ] {channel=”zwave:device:9d6ae427:node20:switch_dimmer”}
Switch light_tv_switch “TV light switch” (GF,gfLights,gSunset,g1am) [ “Lighting” ] {channel=”zwave:device:9d6ae427:node20:switch_dimmer”}

Number tv_mode “TV Mode” {channel=”zwave:device:9d6ae427:node20:config_decimal_param13″}
Number tv_led1 “TV LED 1″ {channel=”zwave:device:9d6ae427:node20:config_decimal_param21”}
Number tv_led2 “TV LED 2″ {channel=”zwave:device:9d6ae427:node20:config_decimal_param22”}
Number tv_led3 “TV LED 3″ {channel=”zwave:device:9d6ae427:node20:config_decimal_param23”}
Number tv_led4 “TV LED 4″ {channel=”zwave:device:9d6ae427:node20:config_decimal_param24”}
Number tv_led5 “TV LED 5″ {channel=”zwave:device:9d6ae427:node20:config_decimal_param25”}
Number tv_led6 “TV LED 6″ {channel=”zwave:device:9d6ae427:node20:config_decimal_param26”}
Number tv_led7 “TV LED 7″ {channel=”zwave:device:9d6ae427:node20:config_decimal_param27”}
Number tv_blink_feq “TV Blink Frequency” {channel=”zwave:device:9d6ae427:node20:config_decimal_param30″}
Number tv_led_blink_status “TV Blink Status” {channel=”zwave:device:9d6ae427:node20:config_decimal_param31″}

rules/garage.rules

rule "G1Open"
when
Item garage_door_1_motion changed to OPEN
then
logInfo("TEST","G1 ON")
tv_mode.sendCommand(1)
tv_blink_feq.sendCommand(1)
tv_led7.sendCommand(1)

var Integer state = (tv_led_blink_status.state as DecimalType).intValue
var Integer mask = state.bitwiseOr(64)
tv_led_blink_status.sendCommand(mask)
end

rule “G1Closed”
when
Item garage_door_1_motion changed to CLOSED
then
logInfo(“TEST”, “G1 OFF”)
var Integer state = (tv_led_blink_status.state as DecimalType).intValue
var Integer mask = state.bitwiseXor(64)
if (mask == 0){
tv_mode.sendCommand(0)
}
tv_led7.sendCommand(0)
tv_led_blink_status.sendCommand(mask)
end

rule “G2Open”
when
Item garage_door_2_motion changed to OPEN
then
logInfo(“TEST”,”G2 ON”)
tv_mode.sendCommand(1)
tv_blink_feq.sendCommand(1)
tv_led6.sendCommand(2)

var Integer state = (tv_led_blink_status.state as DecimalType).intValue
var Integer mask = state.bitwiseOr(32)
tv_led_blink_status.sendCommand(mask)
end

rule “G2Closed”
when
Item garage_door_2_motion changed to CLOSED
then
logInfo(“TEST”, “G2 OFF”)
var Integer state = (tv_led_blink_status.state as DecimalType).intValue
var Integer mask = state.bitwiseXor(32)
if (mask == 0) {
tv_mode.sendCommand(0)
}
tv_led6.sendCommand(0)
tv_led_blink_status.sendCommand(mask)
end

Note: [ “Lighting” ] is for the alexa bridge, gSunset, g1am, g12midnight are used to by other rules to turn on lights at sunset and turn off at 1am or midnight. gfLights is used by the scene controller so if you double tap the Homeseer switch it turns off all the light lights on the ground floor. I have included that below as a bonus.

items/scene.items

Number TVScene "TV Scene" { channel="zwave:device:9d6ae427:node20:scene_number" }
Number SofaScene "Sofa Scene" { channel="zwave:device:9d6ae427:node18:scene_number" }
Number DiningScene "Dining Scene" { channel="zwave:device:9d6ae427:node17:scene_number" }

rules/scene.rules

rule "Mushroom Pushing"
when
Item SofaScene received update
then
if (SofaScene.state == 1.0) {
logInfo("Test", "Mushroom 1x pushed")
}
if (SofaScene.state == 1.1) {
logInfo("Test", "Mushroom leave alone")
}
if (SofaScene.state == 1.2) {
logInfo("Test", "Mushroom kept in")
}
if (SofaScene.state == 1.3) {
logInfo("Test", "Mushroom 2x pushed")
gfLights.members.forEach(Switch|
sendCommand(Switch, OFF)
)

}
if (SofaScene.state == 1.4) {
logInfo(“Test”, “Mushroom 3x pushed”)
}
if (SofaScene.state == 1.5) {
logInfo(“Test”, “Mushroom 4x pushed”)
}
if (SofaScene.state == 1.6) {
logInfo(“Test”, “Mushroom 5x pushed”)
}
end
rule “TVScene Pushing”
when
Item TVScene received update
then
if (TVScene.state == 1.0) {
logInfo(“Test”, “Mushroom 1x pushed”)
}
if (TVScene.state == 1.1) {
logInfo(“Test”, “Mushroom leave alone”)
}
if (TVScene.state == 1.2) {
logInfo(“Test”, “Mushroom kept in”)
}
if (TVScene.state == 1.3) {
logInfo(“Test”, “Mushroom 2x pushed”)
gfLights.members.forEach(Switch|
sendCommand(Switch, OFF)
)

}
if (TVScene.state == 1.4) {
logInfo(“Test”, “Mushroom 3x pushed”)
}
if (TVScene.state == 1.5) {
logInfo(“Test”, “Mushroom 4x pushed”)
}
if (TVScene.state == 1.6) {
logInfo(“Test”, “Mushroom 5x pushed”)
}
end
rule “DiningScene Pushing”
when
Item DiningScene received update
then
if (DiningScene.state == 1.0) {
logInfo(“Test”, “Mushroom 1x pushed”)
}
if (DiningScene.state == 1.1) {
logInfo(“Test”, “Mushroom leave alone”)
}
if (DiningScene.state == 1.2) {
logInfo(“Test”, “Mushroom kept in”)
}
if (DiningScene.state == 1.3) {
logInfo(“Test”, “Mushroom 2x pushed”)
gfLights.members.forEach(Switch|
sendCommand(Switch, OFF)
)

}
if (DiningScene.state == 1.4) {
logInfo(“Test”, “Mushroom 3x pushed”)
}
if (DiningScene.state == 1.5) {
logInfo(“Test”, “Mushroom 4x pushed”)
}
if (DiningScene.state == 1.6) {
logInfo(“Test”, “Mushroom 5x pushed”)
}
end

Updating Exchange distribution lists if you use a apple mac

I use a Apple Mac with outlook 2016 (v15). One of the problems i have is that I can’t update Exchange based email distribution lists. I haven’t been able find a way to do this from outlook but you can update them using Microsofts Exchange Web (OWA)  that most companies run for employees.

I believe this is office 365 version of OWA, other versions may be different

If you have access to OWA (Outlook Web App), then after you log in

Click on Options, then See All options in the top right hand corner

Click on Groups

 

Enter the name of the group in the right hand section of the screen that says “Public Groups | OWN

When the group shows up, double click on it

Click on membership

Then you can click on the add or remove, to edit the list.

 

Comparing Garmin Edge 305 to Nexus 6P with strava

Today i recorded the same route from both a garmin edge 305 and using strava on my nexus 6p. The Garmin appears to win. The Garmin on on a flybar mount on front of my bike and the phone was in a ziplock bag  in my back jersey pocket, so it might be interesting to do some further testing with it in a similar position to the garmin. The garmin data is fed to garmin connect, which is in turn fed into strava.

Nexus 5P and Strava



Garmin 305

The garmin output appears to be less jaggy and follows the road or the path more accurately

I also have an ANT+ usb adaptor on the phone and the heart rate monitor was emmm poor

Nexus 6p

Garmin Edge 305

I had thought about switching to just using my phone, but the garmin is giving me consistently  better gps mapping.

Uploading ride with GPS routes to garmin 305

My goal was to be able to get turn notifications on routes so i don’t have to constantly look at cue sheets.

This is a work in progress and may change

First create your route on ridewithgps.

Then click on the export tab, choose GPX Route (.gpx)

Open the .gpx file in Garmin Base Camp and right click on the route name and say send to device.

On the Garmin Edge 305 it should now show up under Navigation -> Routes

Garmin Edge 305

The case on my Garmin edge 305 has been separating for while now, and today during a ride it completely came apart. I was doing some research to see what kind of glue i should use to reattach it, but I also noticed that this unit is a little different from the ones on the Garmin Edge repair blogs like https://bikepathwarrior.blogspot.com/2011/09/repairing-garmin-edge-205-or-305.html and https://www.jimcarson.com/2009/replacing-the-battery-in-a-garmin-edge-305/

The edge 305 had issues with the daughter board with the battery disconnecting from the garmin when it was bumped. So I was a little surprised why mine continued to work while the case was separated. My unit is a replacement unit from Garmin so it looks like it has had some modifications before they sent it to me

So the first thing to notice is that the black and red wire from the battery are soldered onto the main board and don’t rely on the jumper board and spring connectors

IMG_20160710_160538

Then there appears to be a red shim between the daughter board and the back case.

IMG_20160710_160549

This unit has obviously been worked on since the foil had already been moved to get at the components under it, I just lifted it to show what was under it, i didn’t work the foil loose it was already like that.

IMG_20160710_160613

another of the main board

IMG_20160710_161927

and the battery
IMG_20160710_160636

I am tempted to see if i can get a replacement battery before i reseal the unit.

Create a linux partition bigger than 2TB

If you use fdisk to create a partition on your disc that is larger than 2TB you will only see the first 2TB of the disc. Instead you should use parted.

sudo parted /dev/sdb
GNU Parted 2.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt                                                      
Warning: The existing disk label on /dev/sdb will be destroyed and all data on
this disk will be lost. Do you want to continue?
Yes/No? yes                                                               
(parted) mkpart primary ext4 0% 100%
(parted) p                                                                
Model: ATA WDC WD60EFRX-68M (scsi)
Disk /dev/sdb: 6001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  6001GB  6001GB               primary
sudo mkfs.ext4 /dev/sdb1

Extending a lennox icomfort thermostat: part 2

I setup up an android emulator, side loaded the icomfort app, installed charles proxy, installed the cert from charles proxy, started the emulator with an http proxy, then started sniffing the https traffic. This all took me a while to get all working, but after a lot of banging of heads i finally started to get the unencrypted packets from the app.

The website and the android app use a completely different API. i converted my first attempt at a logging app to the same API that android uses and now have a much cleaner app. Have a look at https://github.com/bruman/ruby-icomfort for the full code.

I added a lot of debug statements so you can see the json that gets passed back and forward, then it starts print

"date, Cool_Set_Point, Head_Set_Point, Indoor_temp, Fan_Mode, Indoor_Humidity, System_Status, Operation_Mode"
"/Date(1416870002787+0000)/,78.0,68.0,71.0,auto,47,idle,heat or cool"

part 1 of my post about interfacing with the icomfort