Where is the error

Posted on
Sat Jul 24, 2021 5:48 pm
Bildhauer offline
Posts: 160
Joined: Sep 30, 2019
Location: 22113 Oststeinbek (near Hamburg), Germany

Where is the error

I've written the following script to open a valve, let it run von vWartezeit seconds and then to switch it of:

Code: Select all
from time import sleep
vSuchTyp ='Open/Close Valve'
vTyp=''
vWartezeit = 5
vWartezeit = indigo.variables[954340795]
# indigo.variables[954340795] # "vDauerBerechnungMinuten"
ignoreFolderId = indigo.devices.folders.getId("unbenutzt")
ScanFolderId = indigo.devices.folders.getId("Aussenbereich")
for dev in indigo.devices.iter("indigo.zwave"):
   if dev.enabled and dev.folderId != ignoreFolderId and dev.model == vSuchTyp :
    indigo.device.turnOn(dev.id)
   sleep(vWartezeit)
   indigo.device.turnOff(dev.id)



In " sleep(vWartezeit)" Python is telling me that a float is required. Where is my mistake?

Thanks in advance

Bildhauer
Last edited by Bildhauer on Sat Jul 24, 2021 6:10 pm, edited 1 time in total.

Posted on
Sat Jul 24, 2021 6:06 pm
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Where is the error

Use the CODE tags so we can see your indentation.

This line is wrong:

Code: Select all
vWartezeit = indigo.variables[954340795]


It should be:

Code: Select all
vWartezeit = indigo.variables[954340795].getValue(float)


https://wiki.indigodomo.com/doku.php?id ... d_examples
Last edited by FlyingDiver on Sat Jul 24, 2021 6:08 pm, edited 1 time in total.

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

Posted on
Sat Jul 24, 2021 6:07 pm
Bildhauer offline
Posts: 160
Joined: Sep 30, 2019
Location: 22113 Oststeinbek (near Hamburg), Germany

Re: Where is the error

Code: Select all
from time import sleep
vSuchTyp ='Open/Close Valve'
vTyp=''
vWartezeit = 5
vWartezeit = indigo.variables[954340795]
# indigo.variables[954340795] # "vDauerBerechnungMinuten"
ignoreFolderId = indigo.devices.folders.getId("unbenutzt")
ScanFolderId = indigo.devices.folders.getId("Aussenbereich")
for dev in indigo.devices.iter("indigo.zwave"):
if dev.enabled and dev.folderId != ignoreFolderId and dev.model == vSuchTyp :
indigo.device.turnOn(dev.id)
sleep(vWartezeit)
indigo.device.turnOff(dev.id)

Posted on
Sat Jul 24, 2021 6:08 pm
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Where is the error

See post above.

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

Posted on
Sat Jul 24, 2021 6:09 pm
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Where is the error

And this section is also broken because there's no indentation:

Code: Select all
for dev in indigo.devices.iter("indigo.zwave"):
if dev.enabled and dev.folderId != ignoreFolderId and dev.model == vSuchTyp :
indigo.device.turnOn(dev.id)
sleep(vWartezeit)
indigo.device.turnOff(dev.id)

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

Posted on
Sat Jul 24, 2021 6:13 pm
Bildhauer offline
Posts: 160
Joined: Sep 30, 2019
Location: 22113 Oststeinbek (near Hamburg), Germany

Re: Where is the error

Grat. Thanks a lot!
FlyingDiver wrote:
Use the CODE tags so we can see your indentation.

This line is wrong:

Code: Select all
vWartezeit = indigo.variables[954340795]


It should be:

Code: Select all
vWartezeit = indigo.variables[954340795].getValue(float)


https://wiki.indigodomo.com/doku.php?id ... d_examples

Posted on
Sun Jul 25, 2021 3:57 am
Bildhauer offline
Posts: 160
Joined: Sep 30, 2019
Location: 22113 Oststeinbek (near Hamburg), Germany

Re: Where is the error

Hello,

I changed the script as follows:

Code: Select all
from time import sleep
vSuchTyp ='Open/Close Valve'
vWartezeitSekunden = indigo.variables[954340795].getValue(float)*60
# indigo.variables[954340795] # "vDauerBerechnungMinuten"
ignoreFolderId = indigo.devices.folders.getId("unbenutzt")
ScanFolderId = indigo.devices.folders.getId("Aussenbereich")
for dev in indigo.devices.iter("indigo.zwave"):
   if dev.enabled and dev.folderId != ignoreFolderId and dev.model == vSuchTyp :
    indigo.device.turnOn(dev.id)
   indigo.server.log("Wartezeit: "+str(vWartezeitSekunden)+ "Sprenger "+dev.name +" ("+ str(dev.id) +") läuft!")
   sleep(vWartezeitSekunden)
   indigo.device.turnOff(dev.id)
    sleep(2)



Now I m getting the message "process (pid 90264) failed to quit after polite request -- forcing it to quit now". It's doing the first round of the loop only for approx.30 sec. goes to the second loop and does not going to the next loop. vDauerBerechnungMinuten is set to 15 so each loop should take 15 minutes

Posted on
Sun Jul 25, 2021 4:04 am
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: Where is the error

A script can only run for 10 secs then it is killed by Indigo.


Sent from my iPhone using Tapatalk

Posted on
Sun Jul 25, 2021 4:29 am
DaveL17 offline
User avatar
Posts: 6756
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Where is the error

To be clear, an embedded script must complete within 10 seconds. A linked script doesn't have this limitation..

Save the script to a file and then run it from there.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Sun Jul 25, 2021 4:30 am
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: Where is the error

DaveL17 wrote:
To be clear, an embedded script must complete within 10 seconds. A linked script doesn't have this limitation..

Save the script to a file and then run it from there.
Dave, you are up early.


Sent from my iPhone using Tapatalk

Posted on
Sun Jul 25, 2021 4:48 am
DaveL17 offline
User avatar
Posts: 6756
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Where is the error

kw123 wrote:
Dave, you are up early.

As are you. Unless you're in Deutschland. :)

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Sun Jul 25, 2021 4:50 am
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Where is the error

DaveL17 wrote:
kw123 wrote:
Dave, you are up early.

As are you. Unless you're in Deutschland. :)
Ja. Visiting first grandson born on 21.7.21 or 7/21/21**

** = 7/3x7/3x7 in prime numbers - a good pin
Sent from my iPhone using Tapatalk
Last edited by kw123 on Sun Jul 25, 2021 5:31 am, edited 1 time in total.

Posted on
Sun Jul 25, 2021 5:06 am
DaveL17 offline
User avatar
Posts: 6756
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Where is the error

Congratulations Grandpa!!!

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Sun Jul 25, 2021 5:27 am
Bildhauer offline
Posts: 160
Joined: Sep 30, 2019
Location: 22113 Oststeinbek (near Hamburg), Germany

Re: Where is the error

Thx,

I done as described. The script now is:

from time import sleep
vSuchTyp ='Open/Close Valve'
vWartezeitSekunden = indigo.variables[954340795].getValue(float)*60
# indigo.variables[954340795] # "vDauerBerechnungMinuten"
ignoreFolderId = indigo.devices.folders.getId("unbenutzt")
ScanFolderId = indigo.devices.folders.getId("Aussenbereich")
for dev in indigo.devices.iter("indigo.zwave"):
if dev.enabled and dev.folderId != ignoreFolderId and dev.model == vSuchTyp :
indigo.device.turnOn(dev.id)
indigo.server.log("Wartezeit: "+str(vWartezeitSekunden) + " Sprenger "+dev.name +" ("+ str(dev.id) +") läuft!")
sleep(vWartezeitSekunden)
indigo.device.turnOff(dev.id)
sleep(2)

Now I'm getting errors at
Code: Select all
indigo.server.log("Wartezeit: "+str(vWartezeitSekunden) + " Sprenger "+dev.name +" ("+ str(dev.id) +") läuft!")


What would be the correct line to have an entry in a log?

Best regards

Bildhauer

Posted on
Sun Jul 25, 2021 5:32 am
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: Where is the error

What kind of error. Compile or at runtime.


Sent from my iPhone using Tapatalk

Who is online

Users browsing this forum: No registered users and 16 guests