Testing a Z-Wave device to verify it is receiving power

Posted on
Sat Jun 08, 2019 9:52 am
ken_jacobs offline
Posts: 188
Joined: Jul 23, 2005

Testing a Z-Wave device to verify it is receiving power

How can I test a Z-Wave GE outdoor switch to verify that it has power? I need to trigger an email if power has been lost.

Posted on
Sat Jun 08, 2019 12:15 pm
peszko offline
Posts: 311
Joined: Mar 07, 2012

Re: Testing a Z-Wave device to verify it is receiving power

I would periodically send a status request and look for a response. If you get an error back its unreachable. Either no power, or other issues. You could send an email on that.

Posted on
Sat Jun 08, 2019 12:51 pm
ken_jacobs offline
Posts: 188
Joined: Jul 23, 2005

Re: Testing a Z-Wave device to verify it is receiving power

The problem seems to be that the trigger activity only looks at the state of the device, not error status. Perhaps a Python approach is required.

Posted on
Sat Jun 08, 2019 1:07 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Testing a Z-Wave device to verify it is receiving power

Yeah, you could do something like this periodically to execute an Action Group if a ping command fails to the device.

Code: Select all
result = indigo.device.ping(DEV_ID_HERE, suppressLogging=True)
if not result["Success"]:
  indigo.server.log("ping failed", isError=True)
  indigo.actionGroup.execute(ACTION_GROUP_ID_HERE)

Image

Posted on
Sat Jun 08, 2019 2:04 pm
ken_jacobs offline
Posts: 188
Joined: Jul 23, 2005

Re: Testing a Z-Wave device to verify it is receiving power

I guess I need a little more Python help. I ran the following as an embedded script and got the error below.

Code: Select all
result = indigo.device.ping(Water_Feature, suppressLogging=True)
if not result["Success"]:
  indigo.server.log("ping failed", isError=True)
  indigo.actionGroup.execute (Sump_Pump_Power_Failure)

Code: Select all
 Script Error                    embedded script: global name 'Water_Feature' is not defined

Posted on
Sat Jun 08, 2019 2:06 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Testing a Z-Wave device to verify it is receiving power

result = indigo.device.ping(DEV_ID_HERE, suppressLogging=True)

DEV_ID_HERE needs to be the device ID, not the name.

Right-click the device in Indigo, and "Copy python reference" or something like that.

Paste that in instead.

Posted on
Sat Jun 08, 2019 2:18 pm
FlyingDiver offline
User avatar
Posts: 7217
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Testing a Z-Wave device to verify it is receiving power

Well, it can be the name, but it needs to be a string.

Code: Select all
result = indigo.device.ping("Water_Feature", suppressLogging=True)

Using the ID is better, in case you change the name.

But the rest of that code is suspect, depending on how you indent it. Use the 'Code' tags when you post Python code.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Jun 08, 2019 2:59 pm
ken_jacobs offline
Posts: 188
Joined: Jul 23, 2005

Re: Testing a Z-Wave device to verify it is receiving power

OK, I have made a little progress. The script below now generates the following error.

Code: Select all
result = indigo.device.ping(indigo.devices[1637128522] # "Water Feature", suppressLogging=True)
if not result["Success"]:
  indigo.server.log("ping failed", isError=True)
  indigo.actionGroup.execute(Sump_Pump_Power_Failure)

Code: Select all
   Script Error                    embedded script: invalid syntax
   Script Error                    around line 2 - "if not result["Success"]:"

Posted on
Sat Jun 08, 2019 3:02 pm
FlyingDiver offline
User avatar
Posts: 7217
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Testing a Z-Wave device to verify it is receiving power

Use the code tags. As I said, you have an indentation error, but we can't tell you how to fix it.

Python uses indentation to delineate code blocks, so your logic will depend on the indentation.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Jun 08, 2019 3:50 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Testing a Z-Wave device to verify it is receiving power

Change this line from:

result = indigo.device.ping(indigo.devices[1637128522] # "Water Feature", suppressLogging=True)

to:

result = indigo.device.ping(1637128522, suppressLogging=True)

Image

Posted on
Sat Jun 08, 2019 4:06 pm
FlyingDiver offline
User avatar
Posts: 7217
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Testing a Z-Wave device to verify it is receiving power

Heh. I didn't notice that he put the comment inside the function call. Oops. But there's still a syntax/logic error.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Jun 08, 2019 4:17 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Testing a Z-Wave device to verify it is receiving power

FlyingDiver wrote:
Heh. I didn't notice that he put the comment inside the function call. Oops. But there's still a syntax/logic error.

True, my eyes missed that one. Fixed. :-)

Image

Posted on
Sat Jun 08, 2019 4:18 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Testing a Z-Wave device to verify it is receiving power

And found another problem. Post edited again to hopefully show the correct line.

Image

Posted on
Sat Jun 08, 2019 6:55 pm
ken_jacobs offline
Posts: 188
Joined: Jul 23, 2005

Re: Testing a Z-Wave device to verify it is receiving power

OK, here's the latest;

The script

Code: Select all
result = indigo.device.ping(indigo.devices(1637128522,suppressLogging=True)
if not result["Success"]:
  indigo.server.log("ping failed", isError=True)
  indigo.actionGroup.execute(1684269810)

The error

Code: Select all
   Script Error                    embedded script: invalid syntax
   Script Error                    around line 2 - "if not result["Success"]:"

Posted on
Sat Jun 08, 2019 6:58 pm
FlyingDiver offline
User avatar
Posts: 7217
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Testing a Z-Wave device to verify it is receiving power

You have unbalanced parenthesis on the line before.

Use the code from Matt's post above.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Who is online

Users browsing this forum: No registered users and 7 guests

cron