My People Scripting Examples
My People Scripting Examples
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.
Bill
My Plugin: My People
My Plugin: My People
Re: My People Scripting Examples - Update state
Use this script to update the state of a MyPeople Person device....
Hint:
Code: Select all
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- Change deviceId # to the deviceId# of your device
All of the device states are called by "set" from a "field"
for userPinNumber setUserPinNumber userPinNumberField
for firstName setFirstName firstNameField
for phoneNumber1 setPhoneNumber1 phoneNumber1Field
etc.
Bill
My Plugin: My People
My Plugin: My People
Re: My People Scripting Examples - PIN Code use
This can be used with a control page keypad on any method where you can get a PIN number saved as a variable... This example is used in a trigger that fires when that variable changes.... In this example:
- Variable: "PWInput" [777599449] is the variable set from a control page keypad (or whatever method you choose to populate the variable)
Variable: "Outcome" [748482965] the variable that is updated at the end of the scrip with the name of the person.
Action Group (12345678) the action that is run with a successful PIN code.
Action Group (87654321) the action that is run with a failed PIN code.
Code: Select all
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 scriptBill
My Plugin: My People
My Plugin: My People
Re: My People Scripting Examples - Specific Now Showing
Use this script to set the "Now Showing" device to a specific device (record/person).
Notes:
Code: Select all
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- Change theRecord = "n" to the record number you want.
Change deviceId= 12345 to the deviceId of your "Now Showing" device created by the plugin
If you request a record greater than the number of records available 0-total, the action will set the requested number to 0 (the first record)
Bill
My Plugin: My People
My Plugin: My People
Re: My People Scripting Examples
Thank you for these!