Where ist the error

Posted on
Sat May 21, 2022 4:30 pm
Bildhauer offline
Posts: 160
Joined: Sep 30, 2019
Location: 22113 Oststeinbek (near Hamburg), Germany

Where ist the error

Compiling th script:

Code: Select all
from time import sleep
vSuchTyp ='Open/Close Valve'
ignoreFolderId = indigo.devices.folders.getId("unbenutzt")
ScanFolderId = indigo.devices.folders.getId("Aussenbereich")
for dev in indigo.devices.iter("indigo.zwave"): #stop all devices first
   if dev.enabled and dev.folderId != ignoreFolderId and dev.model == vSuchTyp :
    indigo.server.log("Stoppe Sprenger: "+dev.name)+" ("+str(dev.id)+") läuft!")
   indigo.device.turnOff(dev.Id)
    sleep(2)
   


I'm getting "Inconsistent use of tabs and space in indentation"

Where is my mistake or how can I correct it?

Best regards

Bildhauer!

Posted on
Sat May 21, 2022 5:00 pm
DaveL17 offline
User avatar
Posts: 6756
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Where ist the error

The clue is in the error itself. In Python, I think it's best to use 4 spaces for each indention (there is debate about this, though). Both tabs and spaces are allowed; I always use spaces.

Code: Select all
from time import sleep
vSuchTyp ='Open/Close Valve'
ignoreFolderId = indigo.devices.folders.getId("unbenutzt")
ScanFolderId = indigo.devices.folders.getId("Aussenbereich")
for dev in indigo.devices.iter("indigo.zwave"): #stop all devices first
   if dev.enabled and dev.folderId != ignoreFolderId and dev.model == vSuchTyp :
      indigo.server.log("Stoppe Sprenger: "+dev.name)+" ("+str(dev.id)+") läuft!")
      indigo.device.turnOff(dev.Id)
      sleep(2)


EDIT: Some of my indentions are assumptions; they might not be right for your script.
Last edited by DaveL17 on Sun May 22, 2022 5:00 am, edited 1 time in total.

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

[My Plugins] - [My Forums]

Posted on
Sun May 22, 2022 4:43 am
Bildhauer offline
Posts: 160
Joined: Sep 30, 2019
Location: 22113 Oststeinbek (near Hamburg), Germany

Re: Where ist the error

Thx, Compiler shows no error any more!

Posted on
Sun May 22, 2022 3:54 pm
Bildhauer offline
Posts: 160
Joined: Sep 30, 2019
Location: 22113 Oststeinbek (near Hamburg), Germany

Re: Where ist the error

Ilf I'm running the change script it shows:

Script Stoppe Sprenger: Großer Rasensprenger rechts - Relay Switch 2 (1372594569) läuft!
Script Error embedded script error:
Script Error 'RelayDevice' object has no attribute 'Id'
Script Error Exception Traceback (most recent call shown last):

embedded script, line 8, at top level
AttributeError: 'RelayDevice' object has no attribute 'Id'

Any idea what the issue can be?

Best regards

Bildhauer
Last edited by Bildhauer on Sun May 22, 2022 3:59 pm, edited 1 time in total.

Posted on
Sun May 22, 2022 3:56 pm
FlyingDiver online
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Where ist the error

Bildhauer wrote:
Ilf I'm running the change script it shows:

Script Error embedded script error:
Script Error 'RelayDevice' object has no attribute 'Id'
Script Error Exception Traceback (most recent call shown last):

embedded script, line 8, at top level
AttributeError: 'RelayDevice' object has no attribute 'Id'

Any idea what the issue can be?


That needs to be "dev.id". Python is case sensitive.

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

Posted on
Sun May 22, 2022 4:00 pm
Bildhauer offline
Posts: 160
Joined: Sep 30, 2019
Location: 22113 Oststeinbek (near Hamburg), Germany

Re: Where ist the error

Thx!, sometimes it's so easy!!

8)

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 16 guests