Plugwise Plugs component

From the log entries it looks like the processing of the timeout acknowledge message. It should resent the request but probably causes a silent crash of the send daemon. I’ll get a look into this asap.

In meantime you might try to temporarily disable this specific device.

@brefra thanks again for this wonderful component! it really made my switch from Domoticz to HA that much easier. No more need to manually add the circles to the config :smiley:
i would love to see this included in HA !

for other users which are setting this up i have a hint, which i hope will help some people before they run into strange problems, since one good thing to note is that while you can use /dev/ttyUSB0 this can lead to problems when you use multiple serial USB devices, because they’re assigned at boot and aren’t always in the same order.
if you run the following command on the HA server: ls -lah /dev/serial/by-id/
it should return something like this:

~ $ ls -lah /dev/serial/by-id/
total 0      
drwxr-xr-x    2 root     root          60 Apr 22 18:38 .
drwxr-xr-x    3 root     root          60 Apr 22 18:38 ..
crw-rw----    1 root     audio     188,   0 Apr 22 18:38 usb-FTDI_FT232R_USB_UART_A8009iRW-if00-port0

since the “Sticks” probably use the same chips it’s probable that it gives the exact same output.
you should then use /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A8009iRW-if00-port0
for setting up the integration.

if you already set it up with /dev/ttyUSB0 you can change that in the core.config_entries file

nano /root/config/.storage/core.config_entries

then press Ctrl+W (search), type plugwise and press ENTER
then replace /dev/ttyUSB0 with /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A8009iRW-if00-port0
and restart HA

@koter84 that’s interesting. If I use this way to address the stick, I can also remove and re-insert it without rebooting. Currently, the stick comes back as /dev/ttyUSB1 when I reinsert it and I need to reboot for it to be /dev/ttyUSB0 again.

By the way, my stick is listed as: usb-FTDI_FT232R_USB_UART_A5013Y63-if00-port0 so there seems to be some uniqueness to it :wink:

I will test this now

I use the serial_id too. Definitely something that should be mentioned in the documentation.

Happened again today. Seems to be a recurring issue after 2 or 3 days following a reboot. I don’t think I can disable the circle for which it seems to fail as this is the Circle+ which is essential if I’m not mistaken?

Wil try to remove then reinsert the stick next time it happens, to see if that also helps.

Thanks for the feedback. It is possible to disable all sensors & switch of the circle+ in Hass. It keeps the other devices working but won’t update the state of the circle+ anymore, which seems to causing an communication issue in your situation.
The Circle+ is only required for network linking and discovery (during Hass startup) It’s not required to allow the stick to communicate directly with the other devices when they are properly reachable throughout the zigbee network. I.e you can still switch circles without having the Circle+ plugged in. :grinning:

I’m busy to add some additional code to make library (especially the worker threads) more reliable and hopefully fixes your problem too. It will make the config flow in, and restarts of, Hass to be more reliable. Please be patient :wink:

Just wondering: Do you have a stealth device and is it working in the latest version?

Waiting patiently :wink:

Yes I do have a couple of Shields. They are however detected as circles in HA and work the same as far as I have seen. If there is anything you need me to test specifically, let me know.

Is there a way to use this great Plugwise component without a Circle+?

Mine Circle+ is death but the other Circle’s work fine with Plugwise-2-py. Is there a way to manually add the Circle’s mac addresses?

I managed to get the integration working by following @hapklaar’s instructions (thanks!) here: Plugwise Plugs component. This way you can even add it as an integration.

Great work @brefra, auto discovery is working, stealth also works as described by “hapklaar”.

I would recommend changing the installations instructions from manual (which does not work on hass.io) to the above linked.

What does not work: renaming a device (through the integration) does not update the entity names.

Thanks for the hard work!

Hi @brefra,

How are the plans now, do you think you can get it to a native integration? Or release it for HACS?

I’m really looking forward to it. Or will it take more time and should I install it as a custom component?

Thanks, looks good!!

It is still my intention to get it added as a native integration in Hass core. I personally don’t see any reason for making it available at HACS first as the final goal is to get it natively in Hass. I prefer to spend my time on getting it right from the beginning.

Before I’m ready to do this I want to improve the library with some kind of recovery feature. At the moment when one of the worker threads crashes (due to an unexpected error) the integration completely stops working. In those cases recovery is only possible by a full restart.

In the meantime you’re welcome to use it as an custom integration by manually copying the contents of this zip file to you custom_components folder. The only downside of this is no auto upgrade.

To clarify: the instructions at the github repository is for using the library standalone without Hass.

You could make your repo HACS-compatible by creating a 2nd repo which contain your custom_component files? Then the users can manually add your repo to HACS in their HA system.
That’s the way we do it with our plugwise-beta custom_component. I’m happy to help where needed.

It works for me, but only for the first five of nine circles.
Even when i put the raspi 3b with Home Assistant next to the other circles (which all happen to be upstairs), it still won’t recognize them. Source does recognize the whole network.
What could i do / where do i start, to troubleshoot this?
Btw. i am new to HA (just installed it today).

Gr Bram.

Hi Bram,

I think you will need to reset the Circles that don’t work. See here: http://domoticx.com/plugwise-circles-toevoegen-aan-de-huidige-set-up/
Does this help?

Bouwe, thanks reseting using the procedure in the link worked indeed.
For others: after the reset i had to add the circle with Source again. In my exisiting Source configuration, i added circles in Setup. Than waited for the circle to be found and finished setup. Than restart HASS.

1 Like

Great work on this new Plugwise Integration!
I’ve been using cyberjunky custom component without problems the last couple of months. But it was time to finally upgrade my HASS from 0.93 to the newest version (yeah a bit overdue, but wasn’t actively changing my setup for a while, and if it ain’t broken :stuck_out_tongue: ).
After upgrading to 0.109 my Plugwise devices no longer showed up so decided to test out your integration.
I removed all the old plugwise stuff, copied your custom component in, restarted HASS and tried to add the integration but was met with the following error during config: “The Plugwise stick connection failed”.
I checked and the /dev/ttyUSB0 device is available in my hass docker container. In the hass log there isn’t really anything usefull, only plugwise related warning is this:
2020-05-11 14:54:10 WARNING (MainThread) [homeassistant.helpers.translation] plugwise_stick: the '.translations' directory has been moved, the new name is 'translations', starting with Home Assistant 0.111 your translations will no longer load if you do not move/rename this

Is there anything else I can try/test? Would love to get this working again :slight_smile:

You should have a /dev/ttyUSBx for the integration to connect to the Stick. To me it looks like this is the reason why both integrations don’t work.
You might try to disconnect and reconnect the USB stick and have a look if it appears back.

I’m busy to finishing up the configflow code so it is possible to select the available device from a selection list (which automatically configures the integration to use the /dev/serial/by-id/... device link) I also added some more specific error handling and fixed the mentioned translation warning message too.
I’ll be able to submit a request to add this integration to the Hass codebase somewhere in the next few days. With some luck it could be available in next (or the one after) Hass release.

Anything you’d like us to test in the mean time? :wink:

PS even after disabling the circle+ in config that had connection issues, I still need to reboot the server every 2 days to keep getting telemetry from the stick/plugs.

I’ve managed to submit the first request (#25713) to get the Plugwise USB-stick integration added as native integration in Hass.
It’s currently waiting for review/approval from the core developers.

The Hass integration points to an updated library which contains a rewrite of threads (@hapklaar hopefully this will reveal the issue you have),
better exception handling and a fix to a failure of power calculation when calibration is missing (only happens during startup)

To be inline to the Hass codebase it uses a different storage key, so the new integration is a “braking change” if you switch from the custom_component to the new integration.

At the moment I’m not able (no access to my machine) to release an updated custom component yet, but will do this asap.

The updated custom component files are available here.
If the configuration exists from previous version, please remove the old integration first or manually change the referencekey of the plugwise_stick domain from port in to usb_path at the .\storage\core.config_entries file, like below:-.

"data": {
    "port": "/dev/......"
},

in to

"data": {
    "usb_path": "/dev/......"
},

@brefra I just installed your new version. I have a Stealth+ and a Circle.
The Circle works fine, for the Stealth+, shown as a Circle+, all values are shown as “unknown” after updating to the latest files and adding the integration again.

Before, when running the first code that you had made available in the HA-PR, with the switch still there, it was working, showing all zero values as the Stealth+ is not connected to any load.