My People Scripting Examples
Posted: Thu Dec 24, 2020 2:48 pm
I will try to post any scripting examples that work with the MyPeople plugin here to help others. Feel free to contribute if you have one that works.
Software Support and Home Automation Forum
https://forums.indigodomo.com/
import logging
myPeopleId = "com.whmoorejr.my-people"
myPeoplePlugin = indigo.server.getPlugin(myPeopleId)
if myPeoplePlugin.isEnabled():
newPinNumber = "5678"
myPeoplePlugin.executeAction("setUserPinNumber", deviceId=946349721, props={'userPinNumberField':newPinNumber})
else:
indigo.server.log("Didn't Work" , level=logging.WARNING) # log a failure message
import logging
login_name = "PIN fail" # if you change this, don't forget to update the if login_name == "PIN fail" below
password = indigo.variables[777599449].value # "PWInput"
theMessage = "Unsuccessful PIN Entry Attempt with PIN: " + password
for dev in indigo.devices.iter(filter="com.whmoorejr.my-people"):
MyPin = dev.states["userPinNumber"]
if MyPin == password:
login_name = dev.states["friendlyName"]
theMessage = "PIN Code Accepted, " + login_name + " is here."
# indigo.server.log(login_name + " can have soup!") # log a success PIN message
# indigo.actionGroup.execute(12345678) # run a success PIN action
if login_name == "PIN fail":
indigo.server.log("No Soup For You!", level=logging.WARNING) # log a failure message
# indigo.actionGroup.execute(87654321) # run a failure PIN action
indigo.variable.updateValue(748482965, value=login_name) # update variable with name of user with matching pin or "PIN Fail"
indigo.server.log(theMessage) # log the result of the script
import logging
myPeopleId = "com.whmoorejr.my-people"
myPeoplePlugin = indigo.server.getPlugin(myPeopleId)
if myPeoplePlugin.isEnabled():
theRecord = "1"
myPeoplePlugin.executeAction("nowShowingSpecific", deviceId= 1883703450, props={'nowShowingSpecificField':theRecord})
else:
indigo.server.log("Didn't Work" , level=logging.WARNING) # log a failure message