Plugwise Binding: Looking for testers of Scan, Sense, Stealth, Switch support

I have forked the Plugwise Binding and added support to it for some additional Plugwise devices:

  • Scan
  • Sense
  • Stealth
  • Switch

Now I am looking for people who can provide feedback or are willing to test the updated plugin before I put in a pull request. The changes should be backwards compatible with your existing configurations.

More information regarding configuration can be found in issue #4565 on GitHub:

@Wouter I have installed your binding on a Pine A64 with Openhab2.
I get the following messages in the log:
2016-08-05 17:56:16.685 [ERROR] [org.openhab.binding.plugwise ] - FrameworkEvent ERROR - org.openhab.binding.plugwise
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.plugwise [212]
Unresolved requirement: Import-Package: gnu.io

at org.eclipse.osgi.container.Module.start(Module.java:434)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1562)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]

Do you understand what is wrong ?

@gert_konemann
It looks like it is missing the ā€˜Serial Bindingā€™ dependency which is required for serial communications with the Stick.

Usually you can install this dependency on openHAB 2.0 via Paper UI > Extensions > Bindings

When you have the offline distribution it should be pre-downloaded and available. For the online distribution it may need internet access.

The offline distribution is the most foolproof distribution in my opinion. But it may be to big to fit on your device of course.

When you use the binding on openHAB 2.0 you can run into issues when you start renaming or removing devices from the plugwise.cfg. The best way to resolve this is to issue the following command on the openHAB 2.0 console:

config:delete Plugwise

and then restart openHAB 2.0.

If youā€™re new to openHAB (or not upgrade savvy) here are some instructions on how to quickly get my test version of the Plugwise Binding running. If you have an existing openHAB installation you can also create a new directory with openHAB for testing. Both installations can coexist peacefully, as long as they are not running at the same time.

For a more in depth version of the openHAB installation see: http://www.openhab.org/getting-started/index.html

Because openHAB depends on Java, make sure it is installed. To verify it is setup properly, issue ā€˜java -versionā€™ on the command line. When it says version 1.7.0 or higher, continue below.


openHAB 1.8

Version 1.8.3 is the latest stable openHAB version. It works well but may not look as fancy or be as user friendly as openHAB 2.0.

Downloads

File extraction

  • Extract all files from distribution-1.8.3-runtime.zip to a new directory (referred to as OH1_HOME from now on)
  • Extract org.openhab.binding.serial-1.8.3.jar from distribution-1.8.3-addons.zip to OH1_HOME/addons
  • Extract org.openhab.binding.plugwise-1.9.0-SNAPSHOT.jar from openhab-plugwise-binding-issue-4565-test-20160814.zip to OH1_HOME/addons
  • Extract plugwise.items from openhab-plugwise-binding-issue-4565-test-20160814.zip to OH1_HOME/configurations/items/plugwise.items
  • Extract default.sitemap from openhab-plugwise-binding-issue-4565-test-20160814.zip to OH1_HOME/configurations/sitemaps/default.sitemap

Configuration

  • Use the default openHAB configuration as starting point by copying OH1_HOME/configurations/openhab_default.cfg to OH1_HOME/configurations/openhab.cfg
  • Open OH1_HOME/configurations/openhab.cfg in your favorite text editor, find the Plugwise section and replace it with that of plugwise.cfg from openhab-plugwise-binding-issue-4565-test-20160814.zip
  • Update plugwise:stick.port to the serial port of your Stick. On Windows this is the COM port, e.g.: COM1
  • Replace the MAC of plugwise:lamp.mac with that of your Circle+
  • Replace the MACs of the other devices with one that matches the device type
  • Save your changes to the file

Note 1: The MACs are stickered to the back of devices. The binding uses full MACs i.e. also the fine print on the sticker. If you donā€™t want to get off your chair, climb up ladders and unplug devices all across your home, causing all sorts of havoc; you can also find them in Source. Open Settings > Appliances . Then double click on an appliance. Click on the little Circle icon to the right of the short Address to see the details of a module and the full MAC (Address). Similarly the MACs of a Scan, Sense and Switch can also be obtained from the Appliances screen by double clicking them in the ā€˜Sensors and other modulesā€™ list.

Note 2: When you changed the device IDs (lamp, fan, etc.), make sure you update the references to them in OH1_HOME/configurations/items/plugwise.items

Running and testing

  • Start the runtime by executing OH1_HOME/start.sh (or OH1_HOME\start.bat) on Windows
  • Open the following URL in your browser: http://<openHAB address or hostname>:8080
  • To stop the runtime press CTRL+C in the openHAB console

openHAB 2.0

Version 2.0 is the beta openHAB version. It may be a little buggy but it looks better with itā€™s Basic UI and Paper UI. Another major feature is that it is possible to configure things and bindings through the UI instead of editing files. Though this is not yet supported by the current Plugwise Binding.

Downloads

File extraction

  • Extract all files from openhab-offline-2.0.0-SNAPSHOT.zip to a new directory (referred to as OH2_HOME from now on)
  • Extract org.openhab.binding.plugwise-1.9.0-SNAPSHOT.jar from openhab-plugwise-binding-issue-4565-test-20160814.zip to OH2_HOME/addons
  • Extract plugwise.items from openhab-plugwise-binding-issue-4565-test-20160814.zip to OH2_HOME/conf/items/plugwise.items
  • Extract plugwise.cfg from openhab-plugwise-binding-issue-4565-test-20160814.zip to OH2_HOME/conf/services/plugwise.cfg
  • Extract default.sitemap from openhab-plugwise-binding-issue-4565-test-20160814.zip to OH2_HOME/conf/sitemaps/_default.sitemap <= make sure the file starts with the underscore so it is used as default sitemap

Configuration

  • Open OH2_HOME/conf/services/plugwise.cfg in your favorite text editor
  • Update plugwise:stick.port to the serial port of your Stick. On Windows this is the COM port, e.g.: COM1
  • Replace the MAC of plugwise:lamp.mac with that of your Circle+
  • Replace the MACs of the other devices with one that matches the device type
  • Save your changes to the file

Note 1: The MACs are stickered to the back of devices. The binding uses full MACs i.e. also the fine print on the sticker. If you donā€™t want to get off your chair, climb up ladders and unplug devices all across your home, causing all sorts of havoc; you can also find them in Source. Open Settings > Appliances. Then double click on an appliance. Click on the little Circle icon to the right of the short Address to see the details of a module and the full MAC (Address). Similarly the MACs of a Scan, Sense and Switch can also be obtained from the Appliances screen by double clicking them in the ā€˜Sensors and other modulesā€™ list.

Note 2: When you changed the device IDs (lamp, fan, etc.), make sure you update the references to them in OH2_HOME/conf/items/plugwise.items.

Running and testing

  • Start the runtime by executing OH2_HOME/start.sh (or OH2_HOME\start.bat) on Windows
  • Open the following URL in your browser: http://<openHAB address or hostname>:8080
  • (First run only) Install the Serial Binding via Paper UI > Extensions > Bindings, and click back until you return to the UI selection screen.
  • Choose either Basic UI or Classic UI to start testing
  • To stop the runtime press CTRL+D in the openHAB console

Known openHAB 2.0 issues you will likely run into

  • When you rename or remove devices from plugwise.cfg they are still persisted in openHAB. To fix this enter config:delete Plugwise in the openHAB console and restart openHAB. This will clear the persisted Plugwise configuration and reload it from plugwise.cfg
  • When items are updated in Basic UI they lose their formatting or show incorrect colors/icons, see: https://github.com/eclipse/smarthome/issues/640

Plugwise binding configuration

For more information on how to configure the Plugwise binding see:

@wborn
That was the problem. I installed the serial binding with the paperui and after a reboot the items are shown in the classicui. As I have only circles, I cannot not test the other devices. Thanks for your work,
Gert

The binding code has been reworked after submitting the pull request.

A pre-compiled version of the updated binding is available in:
openhab-plugwise-binding-issue-4565-test-20160814.zip

Notable changes are:

  • Log levels have been tuned; to see which devices are added by the binding set the log level to debug
  • Performance/accuracy improvements by removing needless string serialization/deserialization when posting updates. This has also increased the timestamp accuracy.

It would be really helpful when people report their findings with this updated version of the binding so the pull request can be merged.

@gert_konemann
Maybe you also want to test my updated Plugwise binding and check for regressions so it can be merged?

There do not seem to be a lot of active Plugwise binding users around here. :neutral_face:

Indeed Wouter, there is no response. I can only hope that you use it yourself. I have tested your binding with 2 circles in a seperate Zigby network with openHAB2. I could switch both circles on and off, but the power measurements worked only on one circle. I have to do some tests with the full network to see if this problem is bound to one circle, but I did not have the time to do so yet. In my operational network I use openHAB1 with the Plugwise Source software and poll it with the openHAB http binding. This works well, but I want to get rid of the Windows machine for Source. The old Plugwise binding was never reliable enough in my network with 22 circles. Therefore I still hope for a better one. I think that a reliable binding can convince more users to migrate to openHAB.

Gert

@gert_konemann
Thanks a lot for testing! Seems like we are in the same boat as I also have an aging Windows machine running Source that I want to get rid off. Instead of upgrading the Windows machine I spent the money on a Raspberry Pi and a second Plugwise Stick for development. Still have to test what happens when I use it with my ā€œproductionā€ Stick, which also has a respectable number of Circles like your network has.

Hi @wborn and @gert_konemann,
Iā€™m using this extended plugin as well in a small network of Stick, 8circles, 1 stealth and it seems to work fine.
Only thing I ran into was the ā€˜clockā€™ item for the circle plus which worked fine with the previous version and not so much with this one :wink:
Since I donā€™t rely on that too much, I disabled that item.
If itā€™s stable I wouldnā€™t mind moving to OH2(was the only plugin I use that wasnā€™t ready yet).

@j.hoekstra
Thanks for the feedback Jos! Iā€™ve done some testing and the ā€˜clockā€™ item seems to work fine for me with both OH1 and OH2.

This is how I use a clock item in my configuration:

String Fan_Clock "Clock [%s]" <clock> { plugwise="[fan:clock:15]" }

When the updated binding has been merged, I will also create a pull request for adding the Plugwise Binding to OH2 by default.

@wborn: this is how I use it:

/*Circleplus*/
Switch Plugwise_circleplus_switch       "circleplus"                                                            { plugwise="[ON:circleplus:state:15], [OFF:circleplus:state:15]" }
//String Plugwise_circleplus_clock        "circleplus_clock [%s]"`                                              { plugwise="[circleplus:clock:60]" }// do not enable, disables communication
Number Plugwise_circleplus_kwh          "circleplus_kwh [%.3f kWh]"                                             { plugwise="[circleplus:lasthour:60]" }
DateTime Plugwise_circleplus_kwh_stmp   "circleplus_kwh_stmp [%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS]"             { plugwise="[circleplus:lasthour-stamp:60]" }
Number Plugwise_circleplus_pwr          "circleplus_power [%.1f W]"                                             { plugwise="[circleplus:power:10]" }
DateTime Plugwise_circleplus_pwr_stmp   "circleplus_power_stamp  [%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS]"         { plugwise="[circleplus:power-stamp:60]" }
DateTime Plugwise_circleplus_rtl_clk    "circleplus_rt_clock[%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS]"              { plugwise="[circleplus:realtime-clock:10]" }

When I enable clock on the circleplus, I loose access to the other plugs like switching and powerusage. The circleplus is still switchable, but no other usage-data is available. Iā€™m guessing itā€™s a setup error, but couldnā€™t find anything about it in the documentation.
For me swtiching off the clock item for the circleplus is the easiest way to make all plugs function again and clock items on ā€˜slaveā€™ plugs work just fine in UTC.

@j.hoekstra
Iā€™ll try to reproduce it with the same configuration that you are using.

The following would also be very helpful for reproduction:

  • the exact version of openHAB you are using
  • any Plugwise related errors/warnings/stacktraces that are logged in the OpenHab console

@j.hoekstra
There seems to be a grave accent ` in your Plugwise_circleplus_clock item declaration. It is hard to see because it is so tiny. :slight_smile:

//String Plugwise_circleplus_clock        "circleplus_clock [%s]"`                                              { plugwise="[circleplus:clock:60]" }// do not enable, disables communication
//=========================================grave-accent-location=^

When I use it like that, it also stops parsing the rest of the items at my machine. When I remove the grave accent, the rest of the items are properly loaded again. Unfortunately OH does not throw any syntax errors for it.

Is it also present in your .items file or only in this post?

iā€™m happy to say also in my items :wink:
Sorry for the noise regarding this, guess itā€™s a good time to start using the designer for errors like these. :wink:

@j.hoekstra
Nice to know that things are working again and it was not due to regressions! I also found it using with the syntax validation of the OH designer . :slight_smile:

Thanks for testing everyone!

In the mean time:

  • the feature has been merged into the openHAB 1.9.0 repository.
  • another issue was fixed: NullPointerException may occur when concurrent threads get PlugwiseDevice from Stick (#4648)
  • the plugin is now available in openHAB 2.0 (#4644).
  • the Plugwise Binding wiki has been updated to include this feature and includes details for openHAB 2.0.

If you want to use the latest version of the binding with the bugfix for openHAB 1.8 you can grab it from the openHAB build server.

I run with this configuration
221 ACTIVE org.openhab.binding.serial_1.8.3
222 ACTIVE org.openhab.binding.plugwise_1.9.0.201608141534
on openhab 1.8.3. Circle and circle +. Windows 7 64bits
It is just not stable. I donā€™t know if it has to do with the patch.
I guess not, but I get error protocol every 15 minutes more or less which makes the plugin stop.
I have to restart it.

Seems in the code that no exception is thrown.
Has it got to do with some config parameter

@frederic does version 1.8.3 of the Plugwise Binding work correctly for you?

If you are a new user of the binding, and version 1.8.3 also does not work, it could be that the firmware in your Circles needs to be updated. The binding only works correctly with Plugwise protocol version 2. The Source shows the firmware of your Circles in the left panel of Settings > Appliances. When you scroll it horizontally it should show a firmware version from the year 2011.

Iā€™ve made some additional fixes in a newer version of the Plugwise binding that you could try as well. You can download it from the openHAB build server.

When this does not help. You can also increase the log level of the Plugwise binding in configurations\logback.xml by adding the following logger:

	<logger name="org.openhab.binding.plugwise" level="DEBUG" />

You may need to restart openHAB before it logs something. That may give some clues about why things donā€™t work for you. Maybe you can attach a logfile or quote some stacktraces when you need more help?

Hi!

I am a newbie with OpenHAB.
What I got to work so far is hue and homematic with Amazon Echo.
But IĀ“m facing issues with Plugwise.
I would like to be able to switch them ON and OFF via OpenHAB and maybe see the power consuption.
But I donĀ“ t get it. I installed the USB Stick and I can see it in dev/ttyUSB0
In installed on OH2 the Plugwise Binding.
So, from here I am lost.

What do I have to do now?
I tried do modify the plugwise.cfg in /etc/openhab2/services/plugwise.cfg
It looks lik this:

############################## Plugwise Binding #######################################

plugwise:stick.port=/dev/ttyUSB0

plugwise:stick.interval=150

plugwise:pioneer.mac=000D6F0000D34542
plugwise:poineer.type=circle

plugwise:blueray.mac=000D6F0000D34283
plugwise:blueray.type=circle

plugwise:fritzbox.mac=000D6F0000B1B65B
plugwise:blueray.type=circleplus

I did a restart of teh raspberry.
Then I made a new file in /etc/openhab2/items called ā€œplugwise.itemsā€ (Do I need this?)
But IĀ“ m not sure what to put in to be able to switch a plug ON or OFF.

Cann you give me a short example fpr one plug. e.g. with mac 000D6F0000D34542