PyISY Library Reference¶
ISY Class¶
- class pyisy.isy.ISY(address, port, username, password, use_https=False, tls_ver=1.1, webroot='', websession=None, use_websocket=False)[source]¶
This is the main class that handles interaction with the ISY device.
address: String of the IP address of the ISY deviceport: String of the port over which the ISY is serving its APIusername: String of the administrator username for the ISYpassword: String of the administrator password for the ISYuse_https: [optional] Boolean of whether secured HTTP should be usedtls_ver: [optional] Number indicating the version of TLS encryption to use. Valid options are 1.1 or 1.2.- Variables
auto_reconnect – Boolean value that indicates if the class should auto-reconnect to the event stream if the connection is lost.
auto_update – Boolean value that controls the class’s subscription to the event stream that allows node, program values to be updated automatically.
connected – Read only boolean value indicating if the class is connected to the controller.
nodes –
pyisy.nodes.Nodes
manager that interacts with Insteon nodes and groups.programs – Program manager that interacts with ISY programs and i folders.
variables – Variable manager that interacts with ISY variables.
- property auto_update¶
Return the auto_update property.
- property connected¶
Return the status of the connection.
- property hostname¶
Return the hostname.
- async query(address=None)[source]¶
Query all the nodes or a specific node if an address is provided .
- Args:
address (string, optional): Node Address to query. Defaults to None.
- Returns:
boolean: Returns True on successful command, False on error.
Node Manager Class¶
- class pyisy.nodes.Nodes(isy, root=None, addresses=None, nnames=None, nparents=None, nobjs=None, ntypes=None, xml=None)[source]¶
This class handles the ISY nodes.
This class can be used as a dictionary to navigate through the controller’s structure to objects of type
pyisy.nodes.Node
andpyisy.nodes.Group
that represent objects on the controller.isy: ISY classroot: [optional] String representing the current navigation level’s IDaddresses: [optional] list of node idsnnames: [optional] list of node namesnparents: [optional] list of node parentsnobjs: [optional] list of node objectsntypes: [optional] list of node typesxml: [optional] String of xml data containing the configuration data- Variables
all_lower_nodes – Return all nodes beneath current level
children – A list of the object’s children.
has_children – Indicates if object has children
name – The name of the current folder in navigation.
- __init__(isy, root=None, addresses=None, nnames=None, nparents=None, nobjs=None, ntypes=None, xml=None)[source]¶
Initialize the Nodes ISY Node Manager class.
- __weakref__¶
list of weak references to the object (if defined)
- property all_lower_nodes¶
Return all nodes below the current root.
- property children¶
Return the children of the class.
- control_message_received(xmldoc)[source]¶
Pass Control events from an event stream message to nodes.
Used for sending out to subscribers.
- get_by_id(address)[source]¶
Get object with the given ID.
address: Integer representing node/group/folder id.
- get_by_index(i)[source]¶
Return the object at the given index in the list.
i: Integer representing index of node/group/folder.
- get_by_name(val)[source]¶
Get child object with the given name.
val: String representing name to look for.
- property has_children¶
Return if the root has children.
- insert(address, nname, nparent, nobj, ntype)[source]¶
Insert a new node into the lists.
address: node idnname: node namenparent: node parentnobj: node objectntype: node type
- property name¶
Return the name of the root.
- node_changed_received(xmldoc)[source]¶
Handle Node Change/Update events from an event stream message.
- async update(wait_time=0, xml=None)[source]¶
Update the status and properties of the nodes in the class.
This calls the “/rest/status” endpoint.
wait_time: [optional] Amount of seconds to wait before updating
Node Base Class¶
- class pyisy.nodes.nodebase.NodeBase(nodes, address, name, status, family_id=None, aux_properties=None, pnode=None)[source]¶
Base Object for Nodes and Groups/Scenes.
- __init__(nodes, address, name, status, family_id=None, aux_properties=None, pnode=None)[source]¶
Initialize a Node Base class.
- __weakref__¶
list of weak references to the object (if defined)
- property address¶
Return the Node ID.
- property aux_properties¶
Return the aux properties that were in the Node Definition.
- property description¶
Return the description of the node from it’s notes.
- property family¶
Return the ISY Family category.
- property folder¶
Return the folder of the current node as a property.
- async get_notes()[source]¶
Retrieve and parse the notes for a given node.
Notes are not retrieved unless explicitly requested by a call to this function.
- property is_load¶
Return the isLoad property of the node from it’s notes.
- property last_changed¶
Return the UTC Time of the last status change for this node.
- property last_update¶
Return the UTC Time of the last update for this node.
- property location¶
Return the location of the node from it’s notes.
- property name¶
Return the name of the Node.
- property primary_node¶
Return just the parent/primary node address.
This is similar to Node.parent_node but does not return the whole Node class, and will return itself if it is the primary node/group.
- async rename(new_name)[source]¶
Rename the node or group in the ISY.
Note: Feature was added in ISY v5.2.0, this will fail on earlier versions.
- property spoken¶
Return the text of the Spoken property inside the group notes.
- property status¶
Return the current node state.
- property status_feedback¶
Return information for a status change event.
- async turn_on(val=None)[source]¶
Turn the node on.
[optional] val: The value brightness value (0-255) for the node.
- update(event=None, wait_time=0, xmldoc=None)[source]¶
Update the group with values from the controller.
Node Class¶
- class pyisy.nodes.Node(nodes, address, name, state, aux_properties=None, zwave_props=None, node_def_id=None, pnode=None, device_type=None, enabled=None, node_server=None, protocol=None, family_id=None)[source]¶
This class handles ISY nodes.
parent: The node manager object.address: The Node ID.value: The current Node value.name: The node name.spoken: The string of the Notes Spoken field.notes: Notes from the ISYuom: Unit of Measure returned by the ISYprec: Precision of the Node (10^-prec)aux_properties: Additional Properties for the nodezwave_props: Z-Wave Properties from the devtype tag (used for Z-Wave Nodes.)node_def_id: Node Definition ID (used for ISY firmwares >=v5)pnode: Node ID of the primary nodedevice_type: device type.node_server: the parent node server slot usedprotocol: the device protocol used (z-wave, zigbee, insteon, node server)- Variables
status – A watched property that indicates the current status of the node.
has_children – Property indicating that there are no more children.
- __init__(nodes, address, name, state, aux_properties=None, zwave_props=None, node_def_id=None, pnode=None, device_type=None, enabled=None, node_server=None, protocol=None, family_id=None)[source]¶
Initialize a Node class.
- property dimmable¶
Return the best guess if this is a dimmable node.
DEPRECIATED: USE is_dimmable INSTEAD. Will be removed in future release.
- property enabled¶
Return if the device is enabled or not in the ISY.
- property formatted¶
Return the formatted value with units, if provided.
- get_command_value(uom, cmd)[source]¶
Check against the list of UOM States if this is a valid command.
- get_groups(controller=True, responder=True)[source]¶
Return the groups (scenes) of which this node is a member.
If controller is True, then the scene it controls is added to the list If responder is True, then the scenes it is a responder of are added to the list.
- property is_dimmable¶
Return the best guess if this is a dimmable node.
Check ISYv4 UOM, then Insteon and Z-Wave Types for dimmable types.
- property is_lock¶
Determine if this device is a door lock type.
- property is_thermostat¶
Determine if this device is a thermostat/climate control device.
- property node_def_id¶
Return the node definition id (used for ISYv5).
- property node_server¶
Return the node server parent slot (used for v5 Node Server devices).
- property parent_node¶
Return the parent node object of this node.
Typically this is for devices that are represented as multiple nodes in the ISY, such as door and leak sensors. Return None if there is no parent.
- property prec¶
Return the precision of the raw device value.
- property protocol¶
Return the device standard used (Z-Wave, Zigbee, Insteon, Node Server).
- async set_climate_setpoint_cool(val)[source]¶
Send a command to the device to set the system heat setpoint.
- async set_climate_setpoint_heat(val)[source]¶
Send a command to the device to set the system heat setpoint.
- async set_zwave_parameter(parameter, value, size)[source]¶
Set a Z-Wave Parameter on an end device via the ISY.
- property type¶
Return the device typecode (Used for Insteon).
- property uom¶
Return the unit of measurement for the device.
- async update(event=None, wait_time=0, xmldoc=None)[source]¶
Update the value of the node from the controller.
- property zwave_props¶
Return the Z-Wave Properties (used for Z-Wave devices).
Group Class¶
- class pyisy.nodes.Group(nodes, address, name, members=None, controllers=None, family_id='6', pnode=None)[source]¶
Interact with ISY groups (scenes).
nodes: The node manager object.address: The node ID.name: The node name.members: List of the members in this group.controllers: List of the controllers in this group.spoken: The string of the Notes Spoken field.- Variables
has_children – Boolean value indicating that group has no children.
members – List of the members of this group.
controllers – List of the controllers of this group.
name – The name of this group.
status – Watched property indicating the status of the group.
group_all_on – Watched property indicating if all devices in group are on.
- __init__(nodes, address, name, members=None, controllers=None, family_id='6', pnode=None)[source]¶
Initialize a Group class.
- property controllers¶
Get the controller nodes of the scene/group.
- property group_all_on¶
Return the current node state.
- property members¶
Get the members of the scene/group.
- property protocol¶
Return the protocol for this entity.
Program Manager Class¶
- class pyisy.programs.Programs(isy, root=None, addresses=None, pnames=None, pparents=None, pobjs=None, ptypes=None, xml=None)[source]¶
This class handles the ISY programs.
This class can be used as a dictionary to navigate through the controller’s structure to objects of type
pyisy.programs.Program
andpyisy.programs.Folder
(when requested) that represent objects on the controller.isy: The ISY device classroot: Program/Folder ID representing the current level of navigation.addresses: List of program and folder IDs.pnames: List of the program and folder names.pparents: List of the program and folder parent IDs.pobjs: List of program and folder objects.ptypes: List of the program and folder types.xml: XML string from the controller detailing the programs and folders.- Variables
all_lower_programs – A list of all programs below the current navigation level. Does not return folders.
children – A list of the children immediately below the current navigation level.
leaf – The child object representing the current item in navigation. This is useful for getting a folder to act as a program.
name – The name of the program at the current level of navigation.
- __getitem__(val)[source]¶
Navigate through the hierarchy using names or IDs.
val: Name or ID to navigate to.
- __init__(isy, root=None, addresses=None, pnames=None, pparents=None, pobjs=None, ptypes=None, xml=None)[source]¶
Initialize the Programs ISY programs manager class.
- __iter__()[source]¶
Return an iterator that iterates through all the programs.
Does not iterate folders. Only Programs that are beneath the current folder in navigation.
- __weakref__¶
list of weak references to the object (if defined)
- property all_lower_programs¶
Return all lower programs in a path.
- property children¶
Return the children of the class.
- get_by_id(address)[source]¶
Get a program/folder with the given ID.
address: The program/folder ID to look for.
- get_by_name(val)[source]¶
Get a child program/folder with the given name.
val: The name of the child program/folder to look for.
- insert(address, pname, pparent, pobj, ptype)[source]¶
Insert a new program or folder into the manager.
address: The ID of the program or folder.pname: The name of the program or folder.pparent: The parent of the program or folder.pobj: The object representing the program or folder.ptype: The type of the item being added (program/folder).
- property leaf¶
Return the leaf property.
- property name¶
Return the name of the path.
- parse(xml)[source]¶
Parse the XML from the controller and updates the state of the manager.
xml: XML string from the controller.
Folder Class¶
- class pyisy.programs.Folder(programs, address, pname, pstatus, plastup)[source]¶
Object representing a program folder on the ISY device.
programs: The folder manager object.address: The folder ID.pname: The folder name.pstatus: The current folder status.- Variables
dtype – Returns the type of the object (folder).
status – Watched property representing the current status of the folder.
- __weakref__¶
list of weak references to the object (if defined)
- property address¶
Return the program or folder ID.
- property last_changed¶
Return the last time the program was changed in this module.
- property last_update¶
Return the last time the program was updated.
- property leaf¶
Get the leaf property.
- property name¶
Return the name of the Node.
- property protocol¶
Return the protocol for this entity.
- property status¶
Return the current node state.
- property status_feedback¶
Return information for a status change event.
Program Class¶
- class pyisy.programs.Program(programs, address, pname, pstatus, plastup, plastrun, plastfin, penabled, pstartrun, prunning)[source]¶
Class representing a program on the ISY controller.
programs: The program manager object.address: The ID of the program.pname: The name of the program.pstatus: The current status of the program.plastup: The last time the program was updated.plastrun: The last time the program was run.plastfin: The last time the program finished running.penabled: Boolean value showing if the program is enabled on the controller.pstartrun: Boolean value showing if the if the program runs on controller start up.prunning: Boolean value showing if the current program is running on the controller.- __init__(programs, address, pname, pstatus, plastup, plastrun, plastfin, penabled, pstartrun, prunning)[source]¶
Initialize a Program class.
- __str__()¶
Return a string representation of the node.
- __weakref__¶
list of weak references to the object (if defined)
- property address¶
Return the program or folder ID.
- async disable()¶
Send command to the program/folder to enable it.
- async enable()¶
Send command to the program/folder to enable it.
- property enabled¶
Return if the program is enabled on the controller.
- property last_changed¶
Return the last time the program was changed in this module.
- property last_finished¶
Return the last time the program finished running.
- property last_run¶
Return the last time the program was run.
- property last_update¶
Return the last time the program was updated.
- property leaf¶
Get the leaf property.
- property name¶
Return the name of the Node.
- property protocol¶
Return the protocol for this entity.
- property ran_else¶
Return the Ran Else property for this program.
- property ran_then¶
Return the Ran Then property for this program.
- async run()¶
Send a run command to the program/folder.
- property run_at_startup¶
Return if the program runs on controller start up.
- async run_else()¶
Send a runElse command to the program/folder.
- async run_then()¶
Send a runThen command to the program/folder.
- property running¶
Return if the current program is running on the controller.
- async send_cmd(command)¶
Run the appropriate clause of the object.
- property status¶
Return the current node state.
- property status_feedback¶
Return information for a status change event.
- async stop()¶
Send a stop command to the program/folder.
Variable Manager Class¶
- class pyisy.variables.Variables(isy, root=None, vids=None, vnames=None, vobjs=None, def_xml=None, var_xml=None)[source]¶
This class handles the ISY variables.
This class can be used as a dictionary to navigate through the controller’s structure to objects of type
pyisy.variables.Variable
that represent objects on the controller.isy: The ISY object.root: The ID of the current level of navigation.vids: List of variable IDs from the controller.vnames: List of variable names form the controller.vobjs: List of variable objects.xml: XML string from the controller detailing the device’s variables.- Variables
children – List of the children below the current level of navigation.
- __getitem__(val)[source]¶
Navigate through the variables by ID or name.
val: Name or ID for navigation.
- __init__(isy, root=None, vids=None, vnames=None, vobjs=None, def_xml=None, var_xml=None)[source]¶
Initialize a Variables ISY Variable Manager class.
- __weakref__¶
list of weak references to the object (if defined)
- property children¶
Get the children of the class.
- get_by_name(val)[source]¶
Get a variable with the given name.
val: The name of the variable to look for.
Variable Class¶
- class pyisy.variables.Variable(variables, vid, vtype, vname, init, status, ts, prec)[source]¶
Object representing a variable on the controller.
variables: The variable manager object.vid: List of variable IDs.vtype: List of variable types.init: List of values that variables initialize to when the controller starts.val: The current variable value.ts: The timestamp for the last time the variable was edited.- Variables
init – Watched property that represents the value the variable initializes to when the controller boots.
lastEdit – Watched property that indicates the last time the variable was edited.
val – Watched property that represents the value of the variable.
- __init__(variables, vid, vtype, vname, init, status, ts, prec)[source]¶
Initialize a Variable class.
- __weakref__¶
list of weak references to the object (if defined)
- property address¶
Return the formatted Variable Type and ID.
- property init¶
Return the initial state.
- property last_changed¶
Return the UTC Time of the last status change for this node.
- property last_edited¶
Return the last edit time.
- property last_update¶
Return the UTC Time of the last update for this node.
- property name¶
Return the Variable Name.
- property prec¶
Return the Variable Precision.
- property protocol¶
Return the protocol for this entity.
- async set_init(val)[source]¶
Set the initial value for the variable after the controller boots.
val: The value to have the variable initialize to.
- async set_value(val, init=False)[source]¶
Set the value of the variable.
val: The value to set the variable to.
- property status¶
Return the current node state.
- property status_feedback¶
Return information for a status change event.
- async update(wait_time=0)[source]¶
Update the object with the variable’s parameters from the controller.
wait_time: Seconds to wait before updating.
- property vid¶
Return the Variable ID.
Clock Class¶
- class pyisy.clock.Clock(isy, xml=None)[source]¶
ISY Clock class cobject.
- DESCRIPTION:
This class handles the ISY clock/location info.
- ATTRIBUTES:
isy: The ISY device class last_called: the time of the last call to /rest/time tz_offset: The Time Zone Offset of the ISY dst: Daylight Savings Time Enabled or not latitude: ISY Device Latitude longitude: ISY Device Longitude sunrise: ISY Calculated Sunrise sunset: ISY Calculated Sunset military: If the clock is military time or not.
- __init__(isy, xml=None)[source]¶
Initialize the network resources class.
isy: ISY class xml: String of xml data containing the configuration data
- __weakref__¶
list of weak references to the object (if defined)
- property dst¶
Confirm if DST is enabled or not on the ISY.
- property last_called¶
Get the time of the last call to /rest/time in UTC.
- property latitude¶
Provide the latitude information from the isy.
- property longitude¶
Provide the longitude information from the isy.
- property military¶
Confirm if military time is in use or not on the isy.
- property sunrise¶
Provide the sunrise information from the isy (UTC).
- property sunset¶
Provide the sunset information from the isy (UTC).
- property tz_offset¶
Provide the Time Zone Offset from the isy in Hours.
NetworkResources Class¶
- class pyisy.networking.NetworkResources(isy, xml=None)[source]¶
Network Resources class cobject.
- DESCRIPTION:
This class handles the ISY networking module.
- USAGE:
This object may be used in a similar way as a dictionary with the either networking command names or ids being used as keys and the ISY networking command class will be returned.
- EXAMPLE:
# a = networking[‘test function’] # a.run()
- ATTRIBUTES:
isy: The ISY device class addresses: List of net command ids nnames: List of net command names nobjs: List of net command objects
- __init__(isy, xml=None)[source]¶
Initialize the network resources class.
isy: ISY class xml: String of xml data containing the configuration data
- __weakref__¶
list of weak references to the object (if defined)
- get_by_id(val)[source]¶
Return command object being given a command id.
val: Integer representing command id
- get_by_index(val)[source]¶
Return command object being given a command index.
val: Integer representing command index in List
- get_by_name(val)[source]¶
Return command object being given a command name.
val: String representing command name
NetworkCommand Class¶
- class pyisy.networking.NetworkCommand(network_resources, address)[source]¶
Network Command Class.
- DESCRIPTION:
This class handles individual networking commands.
- ATTRIBUTES:
network_resources: The networkin resources class
- __init__(network_resources, address)[source]¶
Initialize network command class.
network_resources: NetworkResources class address: Integer of the command id
- __weakref__¶
list of weak references to the object (if defined)
- property address¶
Return the Resource ID for the Network Resource.
Connection Class¶
- class pyisy.connection.Connection(address, port, username, password, use_https=False, tls_ver=1.1, webroot='', websession=None)[source]¶
Connection object to manage connection to and interaction with ISY.
- __init__(address, port, username, password, use_https=False, tls_ver=1.1, webroot='', websession=None)[source]¶
Initialize the Connection object.
- __weakref__¶
list of weak references to the object (if defined)
- property connection_info¶
Return the connection info required to connect to the ISY.