Python Coding Help Please

Posted on
Fri Oct 13, 2017 8:32 am
CliveS offline
Posts: 402
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Python Coding Help Please

UPDATE
I now have this working but I have had better days at the dentist than trying to sort this out, hats off to those that write these plugin's for us, especially Nick who I borrowed 99% of his plugin from.

CliveS

I am slowly (and possibly very badly) trying to rework the IP9258.plugin by @NickSmith to work with the
Aviosys IP9258S, IP9258HP 4 port switches and the IP9258SD 8 port switch but am stuck
trying to set the PDU Outlet to either 4 or 8 depending on the Power Strip Model.

The python code at present works but I would like to be able to change the 8 for a 4 when the
4 Port switches are chosen.

My grasp of Python is “beginner” but learn by example !!, so any help would be appreciated.

    ########################################
    def validateDeviceConfigUi(self, valuesDict, typeId, devId):
    # validate supplied values
    outletNum = int(valuesDict["outlet"])
    if outletNum < 1 or outletNum > 8:
    self.errorLog(u"Error: Outlet \"%s\" must be between 1 & 8 " % str(outletNum))
    errorDict = indigo.Dict()
    errorDict["outlet"] = "The value of this field must be between 1 & 8"
    return (False, valuesDict, errorDict)
    else:
    return True
    ########################################
Power Strip Model.png
Power Strip Model.png (133.17 KiB) Viewed 373 times

CliveS

Indigo 7.3.1 : MacOS High Sierra 10.13.6 : Mac mini Server (Mid 2011) : 2 GHz Core i7. : 8 GB. : 2 x 256GB Samsung EVO SSD
----------------------------------------------------------------------------------
The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer

Posted on
Tue Oct 17, 2017 9:42 am
jay (support) offline
Site Admin
User avatar
Posts: 15543
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Python Coding Help Please

Glad you got it working. Let us know if you run into any other issues.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest