Optimise Z-wave network via script?

Posted on
Thu Dec 29, 2016 6:48 am
RedYuriPrime offline
Posts: 58
Joined: Oct 14, 2014
Location: Oxford

Optimise Z-wave network via script?

Can the new optimisation function in v7 be called from a python script? :D

With a large network, and the benefit of slowly rebuilding outwards with powered devices, and then optimising the battery devices, it would be really useful to manage the process from a script, calling individual devices in the above sequence as defined for your particular network. 8)

Z-wave system with 80+ devices, Indigo7 on a dedicated MacMini
Controlling lighting, heating, hotwater, security; but still a lot to learn ... :shock:

Posted on
Thu Dec 29, 2016 11:35 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Optimise Z-wave network via script?

Yes, but there are limitations:

Code: Select all
# Start a Z-Wave network optimization
indigo.zwave.startNetworkOptimize(nodeId)
# (nodeId argument is optional - if not specified then the entire network will be optimized)

# And to stop a previously started Z-Wave network optimization
indigo.zwave.stopNetworkOptimize()

The limitation being that there isn't currently any queuing mechanism for calling startNetworkOptimize() multiple times. That is, if you call it multiple times and the previous optimization isn't finished then it will be cancelled. Unfortunately, there isn't currently an API or property exposed to be able to tell if an optimization is currently running. So there isn't a good way to (from a script) wait for the optimization to finish before calling it again. The only approach would be to wait N minutes, where N is a number you approximate to be large enough for the optimization to finish.

Image

Posted on
Thu Dec 29, 2016 12:23 pm
RedYuriPrime offline
Posts: 58
Joined: Oct 14, 2014
Location: Oxford

Re: Optimise Z-wave network via script?

Matt, really helpful reply ... thank you. :D

It does raise another question in my mind - what options are there for monitoring and responding directly to the output put into the log, as the status of the optimisation process is written to the log. I guess this could be written as a user defined script but is there anything embedded in Indigo.
A more general but related question, is there any way of filtering the log within Indigo itself, rather than just in Indigo Touch, and in particular a way of flagging and responding to red error lines (e.g. send a warning email with a copy of the offending error).

Really liking Indigo 7. :D :D
Regards,
Geoff

Z-wave system with 80+ devices, Indigo7 on a dedicated MacMini
Controlling lighting, heating, hotwater, security; but still a lot to learn ... :shock:

Posted on
Sat Dec 31, 2016 3:30 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Optimise Z-wave network via script?

This forum thread has some information on how a plugin can subscribe to log messages.

We have lots of logging requests on our feature request list (including improved filtering), but no ETA as to when they will be implemented.

Image

Posted on
Sun Mar 12, 2017 7:38 am
davinci offline

Re: Optimise Z-wave network via script?

How can I update only not battery powered devices or a list of devices?

This only triggers for "device 1":

Code: Select all
indigo.zwave.startNetworkOptimize(1,2,3)



OK, this works (not sure about the wait time...):
:D
Code: Select all
id = 0
import time


for device in indigo.devices:
    if device.batteryLevel == None and device.enabled and str(device.protocol) == "ZWave":
        indigo.server.log(str(device.protocol))
        id_old = id
        id = device.address
        if id != id_old:
            indigo.zwave.startNetworkOptimize(id)
            time.sleep(60)

Posted on
Sun Mar 12, 2017 12:35 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Optimise Z-wave network via script?

There isn't a great way to do this currently, short of trying to guess a long enough sleep interval as you've done. On the feature request list already is to improve the startNetworkOptimize() or at least provide an attribute on the zwave object so you can see if it is currently optimizing the network (so you can poll the value every few seconds to know when you can start the next optimization).

Image

Posted on
Sun Mar 12, 2017 12:55 pm
davinci offline

Re: Optimise Z-wave network via script?

It would also be good to retry when failed.

Posted on
Sun Dec 30, 2018 1:21 pm
richo offline
Posts: 158
Joined: Nov 25, 2014
Location: Pomorskie, Poland

Re: Optimise Z-wave network via script?

Any news on the feature to see if the optimisation is active?

Ryszard

Posted on
Sun Dec 30, 2018 10:12 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Optimise Z-wave network via script?

Still on the feature request / ToDo list. It is pending some additional plumbing being added that will allow better script <-> plugin (and plugin<->plugin) communication.

Image

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 26 guests