Z-Wave support in HA - beta testers wanted

http://karpero.mine.nu/ha

Moderators: Daniel, tom_rosenback, Telldus

Daniel
Posts: 317
Joined: Fri Mar 17, 2023 9:45 am

Z-Wave support in HA - beta testers wanted

Post by Daniel »

Hi.
I've spent the christmas holiday coding on a plugin for HomeAutomation using openzwave (http://www.openzwave.com/). This was a bit more complicated than I originally thought since openzwave is just a library without any real tools for controlling it. Anyway, I've got to the point where this works for me in my environment, I can import devices from openzwave and I can control them.

Is there anyone here who would like to help me testing this? You'd need to have your own server (I'm running Linux here, I've actually got no idea how much tweaking my solution would need to run in Windows) with a connected z-wave controller (I have a Aeon Z-Stick S2 but I guess any controller would do) and some devices to control.

Please answer me in this thread or send me a pm if you're interested!

/Daniel
Senaste info och release om/av HomeAutomation hittas här http://karpero.mine.nu/ha
Latest info and release of HomeAutomation can be found here http://karpero.mine.nu/ha
Daniel
Posts: 317
Joined: Fri Mar 17, 2023 9:45 am

Re: Z-Wave support in HA - beta testers wanted

Post by Daniel »

Just for the record: I've now put up a file with files and instructions on the HomeAutomation download page (http://karpero.mine.nu/ha/index.php?page=download) for anyone who wants to test.

I now started using my Z-Wave luminance sensor in many of my schedules, works like a charm :D

/Daniel
Senaste info och release om/av HomeAutomation hittas här http://karpero.mine.nu/ha
Latest info and release of HomeAutomation can be found here http://karpero.mine.nu/ha
Ceasar
Posts: 10
Joined: Fri Mar 17, 2023 9:45 am

Re: Z-Wave support in HA - beta testers wanted

Post by Ceasar »

Hi
First thanks for your work on HA!
Been running for years and it's just running..
Sorry to wake an old thread ;-)

I'm running HA 3.0.1 with tellstick-duo & 1wire(only temp).
And I would like to start learning/using also zwave preferably on the HA system as I run the server on Linux.

Currently testing the existing zwave plugin.
I have an Aeon Z-Stick Gen5, and 2 zwave devices one Fibraro wall plug FGWPF-102, and one AeoTec Smart Energy Switch.
Both have energy consumption sensors I get input from both of these thru your parser, seems fine.
Aeon stick is not connected in the same server(but also Linux) so I use the plugin settings to redirect to correct ip address.
When I "Update from system plugins" to import devices only one devices is found, and that doesn't turn on or off using the normal device list in HA.
Maybe I have missed something or some changes are needed in the plugin or openzwave.

Below is output from "COMPLETELIST"
COMPLETELIST
Smart Energy Switch-Switch~2-0~1#Smart Energy Switch-Report type~2-1~#Smart Energy Switch-Blinking behavior~2-2~#Smart Energy Switch-Notification status~2-80~#Smart Energy Switch-Enable Wattage Reports~2-90~0#Smart Energy Switch-Wattage threshold~2-91~#Smart Energy Switch-Wattage threshold percent~2-92~#Smart Energy Switch-Default Group Reports~2-100~0#Smart Energy Switch-Report type G1~2-101~8#Smart Energy Switch-Report type G2~2-102~0#Smart Energy Switch-Report type G3~2-103~0#Smart Energy Switch-Default Group Time~2-110~0#Smart Energy Switch-Send interval G1~2-111~600#Smart Energy Switch-Send interval G2~2-112~600#Smart Energy Switch-Send interval G3~2-113~600#Smart Energy Switch-Device tag~2-254~#Smart Energy Switch-Reset device~2-255~0#Smart Energy Switch-Power~2-4~0#FGWPE Wall Plug-Switch~3-0~1#FGWPE Wall Plug-Always on function~3-1~#FGWPE Wall Plug-Remember device status after power failure~3-16~#FGWPE Wall Plug-Reaction to alarms~3-34~#FGWPE Wall Plug-Wall Plug's response to alarm frames~3-35~#FGWPE Wall Plug-Alarm duration~3-39~#FGWPE Wall Plug-Immediate power report~3-40~#FGWPE Wall Plug-Standard power load reporting~3-42~#FGWPE Wall Plug-Power reporting frequency~3-43~#FGWPE Wall Plug-Reporting changes in energy consumed by controlled devices~3-45~#FGWPE Wall Plug-Time period between reports on power load and energy consumption.~3-47~#FGWPE Wall Plug-Metering energy consumed by the Wall Plug itself~3-49~#FGWPE Wall Plug-DOWN value~3-50~#FGWPE Wall Plug-UP value~3-51~#FGWPE Wall Plug-Action in case of exceeding defined power values~3-52~#FGWPE Wall Plug-Power load, which when exceeded, makes the LED ring flash violet.~3-60~#FGWPE Wall Plug-LED ring illumination colour when controlled device is on~3-61~#FGWPE Wall Plug-LED ring illumination colour at the Z-Wave network alarm detection. ~3-63~#FGWPE Wall Plug-Oveload safety switch~3-70~#FGWPE Wall Plug-Power~3-4~5.3

/Br Stefan
Daniel
Posts: 317
Joined: Fri Mar 17, 2023 9:45 am

Re: Z-Wave support in HA - beta testers wanted

Post by Daniel »

Hi.
The code is pretty much only tested on my hardware, so I guess there's some difference between your switches and mine that makes them not work. Can't say I've looked much at the code last year so I actually don't remember everything about how it works. But I'll give it a shot.

It looks like the AeoTec switch gets id 2 and the Fibaro one is 3. Which of the devices do you see in HA?

What do you get when you send the command "SWITCHLIST" (should return a list of just the switches)?

You should be able to turn the switches on/off by sending "SETVALUE~2-0~1" (for turning the AeoTec switch on), "SETVALUE~2-0~0" (for turning it back off), "SETVALUE~3-0~0" or "SETVALUE~3-0~1" (for turning the Fibaro switch off/on). Does any of those work?

Also I could use your /var/log/ozwssha.log. It doesn't contain anything sensitive, so you could just put it in a pastebin somewhere.

/Daniel
Senaste info och release om/av HomeAutomation hittas här http://karpero.mine.nu/ha
Latest info and release of HomeAutomation can be found here http://karpero.mine.nu/ha
Ceasar
Posts: 10
Joined: Fri Mar 17, 2023 9:45 am

Re: Z-Wave support in HA - beta testers wanted

Post by Ceasar »

Hi
I can't really tell but I think it's the Fibraro one or the first one seen.
The device name is empty and the "systemdeviceid" is empty in the mysql db / devices table.
So maybe the formatting to add them fails somewhere.
I tried to remove one device(from zwave controller) and only test with adding one switch to HA no change, still empty and no systemdeviceid.
Also tried to manually add value to "systemdeviceid" for the openzwave device, no change, but I don't really know what exactly is looked for (3,3-0 etc..).

But when detecting sensors both are found and data is received verified from Fibraro but not Aeotech switch(I think this is an diffrent problem with the settings in the device how energy reports are displayed not HA).

Output for SWITCHLIST after readd of "smart Energy Switch" got 4 instead of 2
SWITCHLIST
FGWPE Wall Plug-Switch~3-0~1#Smart Energy Switch-Switch~4-0~0

Yes manually it works to turn on & off no problem here.
SETVALUE~3-0~0 // device 3 off
SETVALUE~3-0~1 // device 3 on

SETVALUE~4-0~0 // device 4 off
SETVALUE~4-0~1 // device 4 on

Attached is "/var/log/ozwssha.log"
I see no attempts to turnon turnoff initiated from HA only my manual commands.
https://www.dropbox.com/s/ccg5w8yc3sbzk ... a.log?dl=0

/Br Stefan
Daniel
Posts: 317
Joined: Fri Mar 17, 2023 9:45 am

Re: Z-Wave support in HA - beta testers wanted

Post by Daniel »

Sounds to me everything is working fine on the ozwssha side, the problem must be in the ha system plugin. Not really sure what I've changed since I rolled the zip on the download page, so I simply zipped the folder in my own homeautomation. Could you try replacing the files in your system/systemplugins/openzwave folder with these and test if it works better? The system plugin is still called 0.1, but it's not the same 0.1 :D

/Daniel
Attachments
haoz.zip
(2.75 KiB) Downloaded 434 times
Senaste info och release om/av HomeAutomation hittas här http://karpero.mine.nu/ha
Latest info and release of HomeAutomation can be found here http://karpero.mine.nu/ha
Ceasar
Posts: 10
Joined: Fri Mar 17, 2023 9:45 am

Re: Z-Wave support in HA - beta testers wanted

Post by Ceasar »

Thanks!
I tried your files. But got an "server error 500" seems related to web server/php when importing new devices.
I'm still on 3.0.1 so maybe 3.1 is needed.
Then restored the old version again and strangely enough it could now find both my switches, and on/off works on both.
Seems that only toggle isn't working(the house plan toggle f.ex), eg on/off works from device menu but not the toggle on the same menu.
/Br Stefan
Daniel
Posts: 317
Joined: Fri Mar 17, 2023 9:45 am

Re: Z-Wave support in HA - beta testers wanted

Post by Daniel »

That is weird. There shouldn't be any difference between toggle and on/off.

(5 minutes later) I can reproduce it here though. Kinda. When I click toggle my devices always turn on, regardless of their previous status. Is that what happens to you too? The same thing doesn't happen to my telldus devices, so I guess it's system plugin related. Investigating deeper...

By the way... Upgrading to 3.1 is a good thing to do. It is better :wink:

/Daniel
Senaste info och release om/av HomeAutomation hittas här http://karpero.mine.nu/ha
Latest info and release of HomeAutomation can be found here http://karpero.mine.nu/ha
Ceasar
Posts: 10
Joined: Fri Mar 17, 2023 9:45 am

Re: Z-Wave support in HA - beta testers wanted

Post by Ceasar »

Yep I get the same behavior you describe.
Found the issue with the Smart Energy Switch sensor output also, the device need the "multisensor reporting sent" settings activated (SETVALUE~4-101~2) ;-)
Seems there are a lot of possibilities/improvements with z-wave protocol.
Will work on 3.1 ;-)

Thanks for you help
/Stefan
Daniel
Posts: 317
Joined: Fri Mar 17, 2023 9:45 am

Re: Z-Wave support in HA - beta testers wanted

Post by Daniel »

Yep, the zwave protocol is very advanced. The stuff I'm using in my implementation is only the tip of the iceberg :D

I found the problem with the toggle. We've got a problem in our system plugin loading logic (more specifically there are always new instances of the classes created, so our private variables are constantly being created from scratch). I've done a workaround for it in the openzwave plugin, now toggling works for me. Could you try replacing system/systemplugins/openzwave/openzwave.plugin.php with the attached file and see if it does the trick for you too?

/Daniel
Attachments
openzwave.plugin.php.zip
(1.74 KiB) Downloaded 431 times
Senaste info och release om/av HomeAutomation hittas här http://karpero.mine.nu/ha
Latest info and release of HomeAutomation can be found here http://karpero.mine.nu/ha
Ceasar
Posts: 10
Joined: Fri Mar 17, 2023 9:45 am

Re: Z-Wave support in HA - beta testers wanted

Post by Ceasar »

Hi
Sadly it doesn't work for me, get undefined function on line 99.

get errors on the apache2 log file.
/var/log/apache2/error.log
[Sat Jan 09 20:20:23 2016] [error] [client 192.168.1.239] PHP Fatal error: Call to undefined function getSystemPluginLastUpdated() in /var/www/HomeAutomation/system/systemplugins/openzwave/openzwave.plugin.php on line 99, referer: http://192.168.1.20/HomeAutomation/inde ... ge=devices
[Sat Jan 09 20:20:27 2016] [error] [client 192.168.1.239] PHP Fatal error: Call to undefined function getSystemPluginLastUpdated() in /var/www/HomeAutomation/system/systemplugins/openzwave/openzwave.plugin.php on line 99, referer: http://192.168.1.20/HomeAutomation/inde ... =houseplan
[Sat Jan 09 20:20:29 2016] [error] [client 192.168.1.239] PHP Fatal error: Call to undefined function getSystemPluginLastUpdated() in /var/www/HomeAutomation/system/systemplugins/openzwave/openzwave.plugin.php on line 99, referer: http://192.168.1.20/HomeAutomation/inde ... ge=devices
[Sat Jan 09 20:20:41 2016] [error] [client 192.168.1.239] PHP Fatal error: Call to undefined function getSystemPluginLastUpdated() in /var/www/HomeAutomation/system/systemplugins/openzwave/openzwave.plugin.php on line 99, referer: http://192.168.1.20/HomeAutomation/inde ... =houseplan
[Sat Jan 09 20:20:44 2016] [error] [client 192.168.1.239] PHP Fatal error: Call to undefined function getSystemPluginLastUpdated() in /var/www/HomeAutomation/system/systemplugins/openzwave/openzwave.plugin.php on line 99, referer: http://192.168.1.20/HomeAutomation/inde ... ge=devices

/Br Stefan
Daniel
Posts: 317
Joined: Fri Mar 17, 2023 9:45 am

Re: Z-Wave support in HA - beta testers wanted

Post by Daniel »

Oh. The problem now is functions that didn't exist in 3.0. Could you try editing the file, changing the readStatuses() function to the following:

Code: Select all

    function readStatuses($devicesToRead = array())
    {
        $this->openzwaveDevices = $this->getOpenzwaveDevices();
        $readDevices = array();
        foreach ($this->openzwaveDevices as $device)
        {
            $device = explode("~", $device);
            foreach ($devicesToRead as $deviceToRead)
            {
                if ($device["1"] == $deviceToRead["systemdeviceid"])
                {
                    $deviceToRead["status"]->state = $device["2"];
                    $readDevices[] = $deviceToRead;
                }
            }
        }

        return $readDevices;
    }
(which means HA will ask zwave for status very often, but at least it should work)

/Daniel
Senaste info och release om/av HomeAutomation hittas här http://karpero.mine.nu/ha
Latest info and release of HomeAutomation can be found here http://karpero.mine.nu/ha
Ceasar
Posts: 10
Joined: Fri Mar 17, 2023 9:45 am

Re: Z-Wave support in HA - beta testers wanted

Post by Ceasar »

Yes works great now.
Toggle reacts instantly much faster than the tellstick tdtool commands.
Thanks a lot for your help!
Will upgrade to 3.1 as soon as I get some time ;-)
Thanks again!
/Stefan
Daniel
Posts: 317
Joined: Fri Mar 17, 2023 9:45 am

Re: Z-Wave support in HA - beta testers wanted

Post by Daniel »

Great! I probably should roll up these changes and release a new plugin version and call it 0.2. Will do that as soon as I get time.

/Daniel
Senaste info och release om/av HomeAutomation hittas här http://karpero.mine.nu/ha
Latest info and release of HomeAutomation can be found here http://karpero.mine.nu/ha
Daniel
Posts: 317
Joined: Fri Mar 17, 2023 9:45 am

Re: Z-Wave support in HA - beta testers wanted

Post by Daniel »

Hi all.
I just gave the zwave server some long needed love and uploaded it to http://karpero.mine.nu/ha. Please try it out and tell me how it works.

For the record for anyone already using it: I've redone how I create ID's for devices, the way I did it before they weren't really unique. So now the ID consists of four numbers instead of two (see the readme.txt for more elaboration on this). This means that the devices and sensors which you already have in your HA won't match the ones in the new ozwssha. Solution is to either wipe the old ones out and sync them back again or to change the ID's in the HA database. Tell me if you need help with the latter.

Also, if anyone is still using the parser for parsing z-wave sensors, stop it. ozwssha reports all sensor changes directly to the HA API, so that's not needed anymore.

/Daniel
Senaste info och release om/av HomeAutomation hittas här http://karpero.mine.nu/ha
Latest info and release of HomeAutomation can be found here http://karpero.mine.nu/ha
Post Reply