Script Error control page "0 Common" script error in file fDoorRFID OPEN.py:
Script Error No module named 'commands'
Script Error Exception Traceback (most recent call shown last):
fDoorRFID OPEN.py, line 12, at top level
fDoorRFID OPEN.py, line 38, in <module>
ModuleNotFoundError: No module named 'commands'
The script referred to has been purged of tabs, and there is no mention of 'commands'., but for the record, "fDoorRFID OPEN.py) follows:
- Code: Select all
# opens fDoor if fDoor interlock variable is true; interlock true for 1 sec
import time
fDoorInterlock = indigo.variables[911502153].getValue(bool)
hseStatus = indigo.variables[1176596514].getValue(bool)
if hseStatus:
indigo.variable.updateValue(911502153, value = "True") #set to true enabling operation of door latch
fDoorInterlock = indigo.variables[911502153].getValue(bool)
if fDoorInterlock:
exec(open("/Library/Application Support/Perceptive Automation/Scripts/RFID-Access-Control.py").read())
fDoorInterlock = indigo.variables[911502153].getValue(bool)
time.sleep(1)
indigo.variable.updateValue(911502153, value = "False") #set to false
The script invoked, "RFID-Access-Control.py", has also been purged of tabs, and does mention "commands" on line 38:
- Code: Select all
"""
This script requires the following Indigo variables:
lastTagRead, lastFrontDoorDeniedTime, lastFrontDoorEntryName,
lastFrontDoorEntryTag & lastFrontDoorEntryTime
In Indigo, you must create A Phidgets Standalone Controller device and
an Indigo Digital Output Device (on the 4 relay board) to control the
door solenoid.
"""
# Enter the name of the Phidgets RFID Reader device created in Indigo...
RFIDReaderDevice = "z fDoorRFID_Reader"
# ... and the name of the device that controls the front door latch.
doorLatchDevice = "1 fHallFdoorLatch"
# Solenoid close duration in seconds
solenoidCloseTime = 3
# path to tag and history files
rfidFilesPath = "/Users/rss/Documents/phidgets/"
# Tag file name
rfidTagFile = "690-RFID-tags.txt"
# History file name
rfidHistFile = "RFID-history.txt"
# Set debug to True if necessary for testing
debug = True
###################################################################
######## Do not change anything below this line ########
###################################################################
import indigo
import datetime
import commands
lastTagRead = indigo.devices[RFIDReaderDevice].states["currentTag"]
now = datetime.datetime.now()
lastTime = now.strftime("%B %d, %H:%M:%S")
indigo.variable.updateValue("lastTagRead", lastTagRead)
if debug: indigo.server.speak('red a tag')
grepReturn = (commands.getstatusoutput("/usr/bin/grep " + lastTagRead + " " + rfidFilesPath + rfidTagFile))
grepResult = grepReturn[0]
if grepResult != 0:
historyLine = lastTagRead + ", DENIED 0000000000: N/A," + lastTime
indigo.server.log(u"UNKNOWN TAG %s read. Access Denied." % (lastTagRead), type="RFID Access", isError=True)
indigo.variable.updateValue("lastFrontDoorDeniedTime", lastTime)
if debug: indigo.server.speak("Unknown tag, red")
else:
tagSearch = grepReturn[1]
tagNum = tagSearch.split(':')[0]
tagName = tagSearch.split(':')[1]
tagDescr = tagSearch.split(':')[2]
if debug: indigo.server.log(u"Tag Search: result code=%s" % (grepResult), type="RFID debug")
indigo.server.log(u"Front door entry: name=%s, Descr=%s " % (tagName, tagDescr), type="RFID Access")
if debug: indigo.server.speak("file red, and user name " + tagName + " found")
indigo.device.turnOn(doorLatchDevice, duration=solenoidCloseTime)
indigo.variable.updateValue("lastFrontDoorEntryName", tagName)
indigo.variable.updateValue("lastFrontDoorEntryTag", tagDescr)
indigo.variable.updateValue("lastFrontDoorEntryTime", lastTime)
historyLine = lastTagRead + ", " + tagName + ": " + tagDescr + ", " + lastTime
historyResult = (commands.getstatusoutput("/bin/echo " + historyLine + " >>" + rfidFilesPath + rfidHistFile))
This script was written for me, and is way beyond my very limited python skillls.
I'd be very grateful for any suggestions.
Bob