How to update all VirtualDevice values?

Discussions about Z-Way software and Z-Wave technology in general
kickus
Posts: 33
Joined: 13 Aug 2014 14:33

How to update all VirtualDevice values?

Post by kickus »

I'm parsing out the values from the virtual device values from the /ZAutomation/api/v1/devices page (since it has a convenient format). I will regularly collect measured electricity data (via polling), and the data will be logged elsewhere.

I'm aware that the virtual device values contains the some cached values, and an update of the values need be requested explicitely.

I know how to request update from each z-wave device separately by sending update commands to respective device. But the expert ui includes an interesting "update all" button, which function I would like to access through http request. How is it possible?

I'm accessing the data and http from a bash script. Can you advice me how to request update through a bash script?

The zway controller may have more recent measured values than the virtual device api includes, is it possible to access that data from virtual devices without requesting over the z-wave network?

Thanks in advance!
islipfd19
Posts: 126
Joined: 07 Jul 2014 03:35

Re: How to update all VirtualDevice values?

Post by islipfd19 »

I don't think you can request an update of the devices data without it going over the network. There is a sensors polling module in the HA UI. You can configure that to poll the sensor on a periodic basis.
kickus
Posts: 33
Joined: 13 Aug 2014 14:33

Re: How to update all VirtualDevice values?

Post by kickus »

Thanks a lot for the advice, I had not noticed the polling feature in the HA UI. That might be sufficient, I'll try.

I'm aware that it's not very elegant to poll a lot of z-wave sensors frequently, but since I need to plot energy consumption charts I have to get the data regularly. I have to stress the network a bit.
kickus
Posts: 33
Joined: 13 Aug 2014 14:33

Re: How to update all VirtualDevice values?

Post by kickus »

I'm aware that it's not a very elegant solution to use h-a periodical polling for many sensors with a high rate (1 min). But as my goal is to read the values to a linux shell script, I have not found better solutions than parsing the virtual device output.

Unfortunately I've experienced stability issues with this hack. The z-way controller jams or even completely crashes (process dies).

May anyone have some advice on how I could regularly read the measured values to bash more reliably?
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: How to update all VirtualDevice values?

Post by pz1 »

kickus wrote: Unfortunately I've experienced stability issues with this hack. The z-way controller jams or even completely crashes (process dies).
I have similar issue reported here on this forum
I thought it were memory problems. Complete crashes, where I found that even memory was overwritten, occured quite frequently because of frequent polling by my OpenRemote Client. I have shut that down, because I first want a stable situation with RaZberry software only without any HA functions defined. Hope to get some baseline performance from that.

I am glad more people are monitoring and reporting this now.
Since 29-12-2016 I am no longer a moderator for this forum
kickus
Posts: 33
Joined: 13 Aug 2014 14:33

Re: How to update all VirtualDevice values?

Post by kickus »

I agree, it seems to be similar issue. It's consuming memory until it dies.
dubliner
Posts: 3
Joined: 23 Sep 2014 22:08

Re: How to update all VirtualDevice values?

Post by dubliner »

kickus wrote:But the expert ui includes an interesting "update all" button, which function I would like to access through http request. How is it possible?

I'm accessing the data and http from a bash script. Can you advice me how to request update through a bash script?
Hey kickus, did you ever get an answer to this?

Cheers
islipfd19
Posts: 126
Joined: 07 Jul 2014 03:35

Re: How to update all VirtualDevice values?

Post by islipfd19 »

Are you looking for an update or the status? Here's what I'm doing to get the current status of a dummy device. The dummy device is generated from another device that was a bit more complex to pull data from (a flood sensor).

I use wget with the {-O -} option and the URL and assign it to a variable. I then use echo in another variable using the first and using awk to print what I need. Your solution will vary greatly. Depends upon what you are looking for. Then a simple IF statement to perform the logic.

Code: Select all

#!/bin/bash
page="$(wget -O - http://zwave-controller:8083/ZAutomation/api/v1/devices/DummyDevice_bn_36)"
eval=`echo $page | awk -F ":" '{print $7}' | awk -F "\"" '{print $2}' | tail -n 1`


if [ "$eval" = "on" ]; then
    echo "1"
else
    echo "0"
fi
kickus
Posts: 33
Joined: 13 Aug 2014 14:33

Re: How to update all VirtualDevice values?

Post by kickus »

dubliner wrote:
kickus wrote:But the expert ui includes an interesting "update all" button, which function I would like to access through http request. How is it possible?

I'm accessing the data and http from a bash script. Can you advice me how to request update through a bash script?
Hey kickus, did you ever get an answer to this?

Cheers
Hi dubliner
No, I haven't got any answer on that yet. Still hoping to get one. ;)
Cheers
kickus
Posts: 33
Joined: 13 Aug 2014 14:33

Re: How to update all VirtualDevice values?

Post by kickus »

islipfd19 wrote:Are you looking for an update or the status? Here's what I'm doing to get the current status of a dummy device. The dummy device is generated from another device that was a bit more complex to pull data from (a flood sensor).

I use wget with the {-O -} option and the URL and assign it to a variable. I then use echo in another variable using the first and using awk to print what I need. Your solution will vary greatly. Depends upon what you are looking for. Then a simple IF statement to perform the logic.

Code: Select all

#!/bin/bash
page="$(wget -O - http://zwave-controller:8083/ZAutomation/api/v1/devices/DummyDevice_bn_36)"
eval=`echo $page | awk -F ":" '{print $7}' | awk -F "\"" '{print $2}' | tail -n 1`


if [ "$eval" = "on" ]; then
    echo "1"
else
    echo "0"
fi
Thanks, it's a bit similar to my awk scripts that extracts status from my sensors. I'm however using the page http://localhost:8083/ZAutomation/api/v1/devices to read all devices at once. My problem is that the values will not get updated by themselves.

I'm looking for a way to request updates for all of them (like the update all button in expert ui). Until now, I've been using the home-ui automation to update the values.

Currently with slightly more experience of zway, I'm worried about this approach. The z-way controller seems to partly hang a few times a week. Some sensors does not get updates anymore (others does). It requires a cold reboot of the raspberry (a z-way-server restart or a soft reboot is not enough). That's a very serious problem for my intended use, since I will not have continuous physical access to the z-way raZberry.

I think someone mentioned that they've had problems with the home-ui automation implementation. I need to find a workaround. Any suggestions?

Cheers
Post Reply