core/homeassistant/components/light/insteon_local.py

99 lines
2.6 KiB
Python
Raw Normal View History

Insteon local (#5088) * platform set-up begin components * lights seem to be getting set up properly, not sure why they aren't being added... * typo * Dependencies line * toggle working * toggle working * added the switch to insteon_local First commit hope to test tonight or in the morning * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * move dependency declaration before import? * Move dependencies in Switch * Update insteon_local.py * wait for response * switched the while to an if switched the while 'cmd2' not in resp: to an if 'cmd2' not in resp: this seems to have the updater working * Switched the while sleep loop to an if switched the wile cmd2 not ins resp to be if cmd2 not in resp seems to be working. * Update insteon_local.py * import statement Updated the import statement to import the instance of the insteon_local component not the hub Instance. * updated import and the device assignment update the import to import the instance of the insteon_local component not the hub. * more changes to support the import change * more changes to support the import change * change to hass.data and add loop logic * && * Update insteon_local.py * Update insteon_local.py * logic fixes and throttle * reduce polling time * brightness support * import util * hound fixes * requirements file * more hound fixes * newline * newline weirdness * lint fixes * more lint fixes * switch state * Update insteon_local.py * log cmd2 for debugging * assume success * remove check for none * fix comments * fix comments again * fix comments, add fixed version of lib, add support for timeout, add support for port, handle invalid login and connection problems * fix logging exception * fix hounceci-bot errors * fix hounceci-bot errors * requirements fix * unique-id changes * make dimmer off use saved ramp rate * configurator working for lights * configurator working for switches? * configurator working for switches? * include model names and fix lint errors * lint fix * fix exception order * lint fixes * fix lint errors * update to use insteon local 0.38 * fix device id * move status check to library * move status check to library * add SKU to setup * lint fixes * requirements * linting
2017-01-08 23:33:35 +00:00
"""
Support for Insteon dimmers via local hub control.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/light.insteon_local/
"""
import logging
from datetime import timedelta
2017-01-14 17:42:45 +00:00
from homeassistant.components.light import (
ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light)
Insteon local (#5088) * platform set-up begin components * lights seem to be getting set up properly, not sure why they aren't being added... * typo * Dependencies line * toggle working * toggle working * added the switch to insteon_local First commit hope to test tonight or in the morning * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * move dependency declaration before import? * Move dependencies in Switch * Update insteon_local.py * wait for response * switched the while to an if switched the while 'cmd2' not in resp: to an if 'cmd2' not in resp: this seems to have the updater working * Switched the while sleep loop to an if switched the wile cmd2 not ins resp to be if cmd2 not in resp seems to be working. * Update insteon_local.py * import statement Updated the import statement to import the instance of the insteon_local component not the hub Instance. * updated import and the device assignment update the import to import the instance of the insteon_local component not the hub. * more changes to support the import change * more changes to support the import change * change to hass.data and add loop logic * && * Update insteon_local.py * Update insteon_local.py * logic fixes and throttle * reduce polling time * brightness support * import util * hound fixes * requirements file * more hound fixes * newline * newline weirdness * lint fixes * more lint fixes * switch state * Update insteon_local.py * log cmd2 for debugging * assume success * remove check for none * fix comments * fix comments again * fix comments, add fixed version of lib, add support for timeout, add support for port, handle invalid login and connection problems * fix logging exception * fix hounceci-bot errors * fix hounceci-bot errors * requirements fix * unique-id changes * make dimmer off use saved ramp rate * configurator working for lights * configurator working for switches? * configurator working for switches? * include model names and fix lint errors * lint fix * fix exception order * lint fixes * fix lint errors * update to use insteon local 0.38 * fix device id * move status check to library * move status check to library * add SKU to setup * lint fixes * requirements * linting
2017-01-08 23:33:35 +00:00
import homeassistant.util as util
2017-01-14 17:42:45 +00:00
_CONFIGURING = {}
_LOGGER = logging.getLogger(__name__)
Insteon local (#5088) * platform set-up begin components * lights seem to be getting set up properly, not sure why they aren't being added... * typo * Dependencies line * toggle working * toggle working * added the switch to insteon_local First commit hope to test tonight or in the morning * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * move dependency declaration before import? * Move dependencies in Switch * Update insteon_local.py * wait for response * switched the while to an if switched the while 'cmd2' not in resp: to an if 'cmd2' not in resp: this seems to have the updater working * Switched the while sleep loop to an if switched the wile cmd2 not ins resp to be if cmd2 not in resp seems to be working. * Update insteon_local.py * import statement Updated the import statement to import the instance of the insteon_local component not the hub Instance. * updated import and the device assignment update the import to import the instance of the insteon_local component not the hub. * more changes to support the import change * more changes to support the import change * change to hass.data and add loop logic * && * Update insteon_local.py * Update insteon_local.py * logic fixes and throttle * reduce polling time * brightness support * import util * hound fixes * requirements file * more hound fixes * newline * newline weirdness * lint fixes * more lint fixes * switch state * Update insteon_local.py * log cmd2 for debugging * assume success * remove check for none * fix comments * fix comments again * fix comments, add fixed version of lib, add support for timeout, add support for port, handle invalid login and connection problems * fix logging exception * fix hounceci-bot errors * fix hounceci-bot errors * requirements fix * unique-id changes * make dimmer off use saved ramp rate * configurator working for lights * configurator working for switches? * configurator working for switches? * include model names and fix lint errors * lint fix * fix exception order * lint fixes * fix lint errors * update to use insteon local 0.38 * fix device id * move status check to library * move status check to library * add SKU to setup * lint fixes * requirements * linting
2017-01-08 23:33:35 +00:00
DEPENDENCIES = ['insteon_local']
2017-01-14 17:42:45 +00:00
DOMAIN = 'light'
Insteon local (#5088) * platform set-up begin components * lights seem to be getting set up properly, not sure why they aren't being added... * typo * Dependencies line * toggle working * toggle working * added the switch to insteon_local First commit hope to test tonight or in the morning * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * move dependency declaration before import? * Move dependencies in Switch * Update insteon_local.py * wait for response * switched the while to an if switched the while 'cmd2' not in resp: to an if 'cmd2' not in resp: this seems to have the updater working * Switched the while sleep loop to an if switched the wile cmd2 not ins resp to be if cmd2 not in resp seems to be working. * Update insteon_local.py * import statement Updated the import statement to import the instance of the insteon_local component not the hub Instance. * updated import and the device assignment update the import to import the instance of the insteon_local component not the hub. * more changes to support the import change * more changes to support the import change * change to hass.data and add loop logic * && * Update insteon_local.py * Update insteon_local.py * logic fixes and throttle * reduce polling time * brightness support * import util * hound fixes * requirements file * more hound fixes * newline * newline weirdness * lint fixes * more lint fixes * switch state * Update insteon_local.py * log cmd2 for debugging * assume success * remove check for none * fix comments * fix comments again * fix comments, add fixed version of lib, add support for timeout, add support for port, handle invalid login and connection problems * fix logging exception * fix hounceci-bot errors * fix hounceci-bot errors * requirements fix * unique-id changes * make dimmer off use saved ramp rate * configurator working for lights * configurator working for switches? * configurator working for switches? * include model names and fix lint errors * lint fix * fix exception order * lint fixes * fix lint errors * update to use insteon local 0.38 * fix device id * move status check to library * move status check to library * add SKU to setup * lint fixes * requirements * linting
2017-01-08 23:33:35 +00:00
MIN_TIME_BETWEEN_FORCED_SCANS = timedelta(milliseconds=100)
2017-01-14 17:42:45 +00:00
MIN_TIME_BETWEEN_SCANS = timedelta(seconds=5)
Insteon local (#5088) * platform set-up begin components * lights seem to be getting set up properly, not sure why they aren't being added... * typo * Dependencies line * toggle working * toggle working * added the switch to insteon_local First commit hope to test tonight or in the morning * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * move dependency declaration before import? * Move dependencies in Switch * Update insteon_local.py * wait for response * switched the while to an if switched the while 'cmd2' not in resp: to an if 'cmd2' not in resp: this seems to have the updater working * Switched the while sleep loop to an if switched the wile cmd2 not ins resp to be if cmd2 not in resp seems to be working. * Update insteon_local.py * import statement Updated the import statement to import the instance of the insteon_local component not the hub Instance. * updated import and the device assignment update the import to import the instance of the insteon_local component not the hub. * more changes to support the import change * more changes to support the import change * change to hass.data and add loop logic * && * Update insteon_local.py * Update insteon_local.py * logic fixes and throttle * reduce polling time * brightness support * import util * hound fixes * requirements file * more hound fixes * newline * newline weirdness * lint fixes * more lint fixes * switch state * Update insteon_local.py * log cmd2 for debugging * assume success * remove check for none * fix comments * fix comments again * fix comments, add fixed version of lib, add support for timeout, add support for port, handle invalid login and connection problems * fix logging exception * fix hounceci-bot errors * fix hounceci-bot errors * requirements fix * unique-id changes * make dimmer off use saved ramp rate * configurator working for lights * configurator working for switches? * configurator working for switches? * include model names and fix lint errors * lint fix * fix exception order * lint fixes * fix lint errors * update to use insteon local 0.38 * fix device id * move status check to library * move status check to library * add SKU to setup * lint fixes * requirements * linting
2017-01-08 23:33:35 +00:00
2017-01-14 17:42:45 +00:00
SUPPORT_INSTEON_LOCAL = SUPPORT_BRIGHTNESS
Insteon local (#5088) * platform set-up begin components * lights seem to be getting set up properly, not sure why they aren't being added... * typo * Dependencies line * toggle working * toggle working * added the switch to insteon_local First commit hope to test tonight or in the morning * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * move dependency declaration before import? * Move dependencies in Switch * Update insteon_local.py * wait for response * switched the while to an if switched the while 'cmd2' not in resp: to an if 'cmd2' not in resp: this seems to have the updater working * Switched the while sleep loop to an if switched the wile cmd2 not ins resp to be if cmd2 not in resp seems to be working. * Update insteon_local.py * import statement Updated the import statement to import the instance of the insteon_local component not the hub Instance. * updated import and the device assignment update the import to import the instance of the insteon_local component not the hub. * more changes to support the import change * more changes to support the import change * change to hass.data and add loop logic * && * Update insteon_local.py * Update insteon_local.py * logic fixes and throttle * reduce polling time * brightness support * import util * hound fixes * requirements file * more hound fixes * newline * newline weirdness * lint fixes * more lint fixes * switch state * Update insteon_local.py * log cmd2 for debugging * assume success * remove check for none * fix comments * fix comments again * fix comments, add fixed version of lib, add support for timeout, add support for port, handle invalid login and connection problems * fix logging exception * fix hounceci-bot errors * fix hounceci-bot errors * requirements fix * unique-id changes * make dimmer off use saved ramp rate * configurator working for lights * configurator working for switches? * configurator working for switches? * include model names and fix lint errors * lint fix * fix exception order * lint fixes * fix lint errors * update to use insteon local 0.38 * fix device id * move status check to library * move status check to library * add SKU to setup * lint fixes * requirements * linting
2017-01-08 23:33:35 +00:00
def setup_platform(hass, config, add_devices, discovery_info=None):
2017-01-14 17:42:45 +00:00
"""Set up the Insteon local light platform."""
Insteon local (#5088) * platform set-up begin components * lights seem to be getting set up properly, not sure why they aren't being added... * typo * Dependencies line * toggle working * toggle working * added the switch to insteon_local First commit hope to test tonight or in the morning * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * move dependency declaration before import? * Move dependencies in Switch * Update insteon_local.py * wait for response * switched the while to an if switched the while 'cmd2' not in resp: to an if 'cmd2' not in resp: this seems to have the updater working * Switched the while sleep loop to an if switched the wile cmd2 not ins resp to be if cmd2 not in resp seems to be working. * Update insteon_local.py * import statement Updated the import statement to import the instance of the insteon_local component not the hub Instance. * updated import and the device assignment update the import to import the instance of the insteon_local component not the hub. * more changes to support the import change * more changes to support the import change * change to hass.data and add loop logic * && * Update insteon_local.py * Update insteon_local.py * logic fixes and throttle * reduce polling time * brightness support * import util * hound fixes * requirements file * more hound fixes * newline * newline weirdness * lint fixes * more lint fixes * switch state * Update insteon_local.py * log cmd2 for debugging * assume success * remove check for none * fix comments * fix comments again * fix comments, add fixed version of lib, add support for timeout, add support for port, handle invalid login and connection problems * fix logging exception * fix hounceci-bot errors * fix hounceci-bot errors * requirements fix * unique-id changes * make dimmer off use saved ramp rate * configurator working for lights * configurator working for switches? * configurator working for switches? * include model names and fix lint errors * lint fix * fix exception order * lint fixes * fix lint errors * update to use insteon local 0.38 * fix device id * move status check to library * move status check to library * add SKU to setup * lint fixes * requirements * linting
2017-01-08 23:33:35 +00:00
insteonhub = hass.data['insteon_local']
2018-01-08 17:18:10 +00:00
if discovery_info is None:
Insteon local (#5088) * platform set-up begin components * lights seem to be getting set up properly, not sure why they aren't being added... * typo * Dependencies line * toggle working * toggle working * added the switch to insteon_local First commit hope to test tonight or in the morning * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * move dependency declaration before import? * Move dependencies in Switch * Update insteon_local.py * wait for response * switched the while to an if switched the while 'cmd2' not in resp: to an if 'cmd2' not in resp: this seems to have the updater working * Switched the while sleep loop to an if switched the wile cmd2 not ins resp to be if cmd2 not in resp seems to be working. * Update insteon_local.py * import statement Updated the import statement to import the instance of the insteon_local component not the hub Instance. * updated import and the device assignment update the import to import the instance of the insteon_local component not the hub. * more changes to support the import change * more changes to support the import change * change to hass.data and add loop logic * && * Update insteon_local.py * Update insteon_local.py * logic fixes and throttle * reduce polling time * brightness support * import util * hound fixes * requirements file * more hound fixes * newline * newline weirdness * lint fixes * more lint fixes * switch state * Update insteon_local.py * log cmd2 for debugging * assume success * remove check for none * fix comments * fix comments again * fix comments, add fixed version of lib, add support for timeout, add support for port, handle invalid login and connection problems * fix logging exception * fix hounceci-bot errors * fix hounceci-bot errors * requirements fix * unique-id changes * make dimmer off use saved ramp rate * configurator working for lights * configurator working for switches? * configurator working for switches? * include model names and fix lint errors * lint fix * fix exception order * lint fixes * fix lint errors * update to use insteon local 0.38 * fix device id * move status check to library * move status check to library * add SKU to setup * lint fixes * requirements * linting
2017-01-08 23:33:35 +00:00
return
2018-01-08 17:18:10 +00:00
linked = discovery_info['linked']
device_list = []
for device_id in linked:
if linked[device_id]['cat_type'] == 'dimmer':
device = insteonhub.dimmer(device_id)
device_list.append(
InsteonLocalDimmerDevice(device)
)
Insteon local (#5088) * platform set-up begin components * lights seem to be getting set up properly, not sure why they aren't being added... * typo * Dependencies line * toggle working * toggle working * added the switch to insteon_local First commit hope to test tonight or in the morning * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * move dependency declaration before import? * Move dependencies in Switch * Update insteon_local.py * wait for response * switched the while to an if switched the while 'cmd2' not in resp: to an if 'cmd2' not in resp: this seems to have the updater working * Switched the while sleep loop to an if switched the wile cmd2 not ins resp to be if cmd2 not in resp seems to be working. * Update insteon_local.py * import statement Updated the import statement to import the instance of the insteon_local component not the hub Instance. * updated import and the device assignment update the import to import the instance of the insteon_local component not the hub. * more changes to support the import change * more changes to support the import change * change to hass.data and add loop logic * && * Update insteon_local.py * Update insteon_local.py * logic fixes and throttle * reduce polling time * brightness support * import util * hound fixes * requirements file * more hound fixes * newline * newline weirdness * lint fixes * more lint fixes * switch state * Update insteon_local.py * log cmd2 for debugging * assume success * remove check for none * fix comments * fix comments again * fix comments, add fixed version of lib, add support for timeout, add support for port, handle invalid login and connection problems * fix logging exception * fix hounceci-bot errors * fix hounceci-bot errors * requirements fix * unique-id changes * make dimmer off use saved ramp rate * configurator working for lights * configurator working for switches? * configurator working for switches? * include model names and fix lint errors * lint fix * fix exception order * lint fixes * fix lint errors * update to use insteon local 0.38 * fix device id * move status check to library * move status check to library * add SKU to setup * lint fixes * requirements * linting
2017-01-08 23:33:35 +00:00
2018-01-08 17:18:10 +00:00
add_devices(device_list)
Insteon local (#5088) * platform set-up begin components * lights seem to be getting set up properly, not sure why they aren't being added... * typo * Dependencies line * toggle working * toggle working * added the switch to insteon_local First commit hope to test tonight or in the morning * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * move dependency declaration before import? * Move dependencies in Switch * Update insteon_local.py * wait for response * switched the while to an if switched the while 'cmd2' not in resp: to an if 'cmd2' not in resp: this seems to have the updater working * Switched the while sleep loop to an if switched the wile cmd2 not ins resp to be if cmd2 not in resp seems to be working. * Update insteon_local.py * import statement Updated the import statement to import the instance of the insteon_local component not the hub Instance. * updated import and the device assignment update the import to import the instance of the insteon_local component not the hub. * more changes to support the import change * more changes to support the import change * change to hass.data and add loop logic * && * Update insteon_local.py * Update insteon_local.py * logic fixes and throttle * reduce polling time * brightness support * import util * hound fixes * requirements file * more hound fixes * newline * newline weirdness * lint fixes * more lint fixes * switch state * Update insteon_local.py * log cmd2 for debugging * assume success * remove check for none * fix comments * fix comments again * fix comments, add fixed version of lib, add support for timeout, add support for port, handle invalid login and connection problems * fix logging exception * fix hounceci-bot errors * fix hounceci-bot errors * requirements fix * unique-id changes * make dimmer off use saved ramp rate * configurator working for lights * configurator working for switches? * configurator working for switches? * include model names and fix lint errors * lint fix * fix exception order * lint fixes * fix lint errors * update to use insteon local 0.38 * fix device id * move status check to library * move status check to library * add SKU to setup * lint fixes * requirements * linting
2017-01-08 23:33:35 +00:00
class InsteonLocalDimmerDevice(Light):
"""An abstract Class for an Insteon node."""
2018-01-08 17:18:10 +00:00
def __init__(self, node):
Insteon local (#5088) * platform set-up begin components * lights seem to be getting set up properly, not sure why they aren't being added... * typo * Dependencies line * toggle working * toggle working * added the switch to insteon_local First commit hope to test tonight or in the morning * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * move dependency declaration before import? * Move dependencies in Switch * Update insteon_local.py * wait for response * switched the while to an if switched the while 'cmd2' not in resp: to an if 'cmd2' not in resp: this seems to have the updater working * Switched the while sleep loop to an if switched the wile cmd2 not ins resp to be if cmd2 not in resp seems to be working. * Update insteon_local.py * import statement Updated the import statement to import the instance of the insteon_local component not the hub Instance. * updated import and the device assignment update the import to import the instance of the insteon_local component not the hub. * more changes to support the import change * more changes to support the import change * change to hass.data and add loop logic * && * Update insteon_local.py * Update insteon_local.py * logic fixes and throttle * reduce polling time * brightness support * import util * hound fixes * requirements file * more hound fixes * newline * newline weirdness * lint fixes * more lint fixes * switch state * Update insteon_local.py * log cmd2 for debugging * assume success * remove check for none * fix comments * fix comments again * fix comments, add fixed version of lib, add support for timeout, add support for port, handle invalid login and connection problems * fix logging exception * fix hounceci-bot errors * fix hounceci-bot errors * requirements fix * unique-id changes * make dimmer off use saved ramp rate * configurator working for lights * configurator working for switches? * configurator working for switches? * include model names and fix lint errors * lint fix * fix exception order * lint fixes * fix lint errors * update to use insteon local 0.38 * fix device id * move status check to library * move status check to library * add SKU to setup * lint fixes * requirements * linting
2017-01-08 23:33:35 +00:00
"""Initialize the device."""
self.node = node
self._value = 0
@property
def name(self):
"""Return the name of the node."""
2018-01-08 17:18:10 +00:00
return self.node.device_id
Insteon local (#5088) * platform set-up begin components * lights seem to be getting set up properly, not sure why they aren't being added... * typo * Dependencies line * toggle working * toggle working * added the switch to insteon_local First commit hope to test tonight or in the morning * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * move dependency declaration before import? * Move dependencies in Switch * Update insteon_local.py * wait for response * switched the while to an if switched the while 'cmd2' not in resp: to an if 'cmd2' not in resp: this seems to have the updater working * Switched the while sleep loop to an if switched the wile cmd2 not ins resp to be if cmd2 not in resp seems to be working. * Update insteon_local.py * import statement Updated the import statement to import the instance of the insteon_local component not the hub Instance. * updated import and the device assignment update the import to import the instance of the insteon_local component not the hub. * more changes to support the import change * more changes to support the import change * change to hass.data and add loop logic * && * Update insteon_local.py * Update insteon_local.py * logic fixes and throttle * reduce polling time * brightness support * import util * hound fixes * requirements file * more hound fixes * newline * newline weirdness * lint fixes * more lint fixes * switch state * Update insteon_local.py * log cmd2 for debugging * assume success * remove check for none * fix comments * fix comments again * fix comments, add fixed version of lib, add support for timeout, add support for port, handle invalid login and connection problems * fix logging exception * fix hounceci-bot errors * fix hounceci-bot errors * requirements fix * unique-id changes * make dimmer off use saved ramp rate * configurator working for lights * configurator working for switches? * configurator working for switches? * include model names and fix lint errors * lint fix * fix exception order * lint fixes * fix lint errors * update to use insteon local 0.38 * fix device id * move status check to library * move status check to library * add SKU to setup * lint fixes * requirements * linting
2017-01-08 23:33:35 +00:00
@property
def unique_id(self):
2017-01-14 17:42:45 +00:00
"""Return the ID of this Insteon node."""
return self.node.device_id
Insteon local (#5088) * platform set-up begin components * lights seem to be getting set up properly, not sure why they aren't being added... * typo * Dependencies line * toggle working * toggle working * added the switch to insteon_local First commit hope to test tonight or in the morning * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * move dependency declaration before import? * Move dependencies in Switch * Update insteon_local.py * wait for response * switched the while to an if switched the while 'cmd2' not in resp: to an if 'cmd2' not in resp: this seems to have the updater working * Switched the while sleep loop to an if switched the wile cmd2 not ins resp to be if cmd2 not in resp seems to be working. * Update insteon_local.py * import statement Updated the import statement to import the instance of the insteon_local component not the hub Instance. * updated import and the device assignment update the import to import the instance of the insteon_local component not the hub. * more changes to support the import change * more changes to support the import change * change to hass.data and add loop logic * && * Update insteon_local.py * Update insteon_local.py * logic fixes and throttle * reduce polling time * brightness support * import util * hound fixes * requirements file * more hound fixes * newline * newline weirdness * lint fixes * more lint fixes * switch state * Update insteon_local.py * log cmd2 for debugging * assume success * remove check for none * fix comments * fix comments again * fix comments, add fixed version of lib, add support for timeout, add support for port, handle invalid login and connection problems * fix logging exception * fix hounceci-bot errors * fix hounceci-bot errors * requirements fix * unique-id changes * make dimmer off use saved ramp rate * configurator working for lights * configurator working for switches? * configurator working for switches? * include model names and fix lint errors * lint fix * fix exception order * lint fixes * fix lint errors * update to use insteon local 0.38 * fix device id * move status check to library * move status check to library * add SKU to setup * lint fixes * requirements * linting
2017-01-08 23:33:35 +00:00
@property
def brightness(self):
"""Return the brightness of this light between 0..255."""
return self._value
@util.Throttle(MIN_TIME_BETWEEN_SCANS, MIN_TIME_BETWEEN_FORCED_SCANS)
def update(self):
"""Update state of the light."""
resp = self.node.status(0)
while 'error' in resp and resp['error'] is True:
resp = self.node.status(0)
Insteon local (#5088) * platform set-up begin components * lights seem to be getting set up properly, not sure why they aren't being added... * typo * Dependencies line * toggle working * toggle working * added the switch to insteon_local First commit hope to test tonight or in the morning * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * move dependency declaration before import? * Move dependencies in Switch * Update insteon_local.py * wait for response * switched the while to an if switched the while 'cmd2' not in resp: to an if 'cmd2' not in resp: this seems to have the updater working * Switched the while sleep loop to an if switched the wile cmd2 not ins resp to be if cmd2 not in resp seems to be working. * Update insteon_local.py * import statement Updated the import statement to import the instance of the insteon_local component not the hub Instance. * updated import and the device assignment update the import to import the instance of the insteon_local component not the hub. * more changes to support the import change * more changes to support the import change * change to hass.data and add loop logic * && * Update insteon_local.py * Update insteon_local.py * logic fixes and throttle * reduce polling time * brightness support * import util * hound fixes * requirements file * more hound fixes * newline * newline weirdness * lint fixes * more lint fixes * switch state * Update insteon_local.py * log cmd2 for debugging * assume success * remove check for none * fix comments * fix comments again * fix comments, add fixed version of lib, add support for timeout, add support for port, handle invalid login and connection problems * fix logging exception * fix hounceci-bot errors * fix hounceci-bot errors * requirements fix * unique-id changes * make dimmer off use saved ramp rate * configurator working for lights * configurator working for switches? * configurator working for switches? * include model names and fix lint errors * lint fix * fix exception order * lint fixes * fix lint errors * update to use insteon local 0.38 * fix device id * move status check to library * move status check to library * add SKU to setup * lint fixes * requirements * linting
2017-01-08 23:33:35 +00:00
if 'cmd2' in resp:
self._value = int(resp['cmd2'], 16)
@property
def is_on(self):
"""Return the boolean response if the node is on."""
return self._value != 0
@property
def supported_features(self):
"""Flag supported features."""
return SUPPORT_INSTEON_LOCAL
def turn_on(self, **kwargs):
"""Turn device on."""
brightness = 100
if ATTR_BRIGHTNESS in kwargs:
brightness = int(kwargs[ATTR_BRIGHTNESS]) / 255 * 100
self.node.change_level(brightness)
Insteon local (#5088) * platform set-up begin components * lights seem to be getting set up properly, not sure why they aren't being added... * typo * Dependencies line * toggle working * toggle working * added the switch to insteon_local First commit hope to test tonight or in the morning * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * Update insteon_local.py * move dependency declaration before import? * Move dependencies in Switch * Update insteon_local.py * wait for response * switched the while to an if switched the while 'cmd2' not in resp: to an if 'cmd2' not in resp: this seems to have the updater working * Switched the while sleep loop to an if switched the wile cmd2 not ins resp to be if cmd2 not in resp seems to be working. * Update insteon_local.py * import statement Updated the import statement to import the instance of the insteon_local component not the hub Instance. * updated import and the device assignment update the import to import the instance of the insteon_local component not the hub. * more changes to support the import change * more changes to support the import change * change to hass.data and add loop logic * && * Update insteon_local.py * Update insteon_local.py * logic fixes and throttle * reduce polling time * brightness support * import util * hound fixes * requirements file * more hound fixes * newline * newline weirdness * lint fixes * more lint fixes * switch state * Update insteon_local.py * log cmd2 for debugging * assume success * remove check for none * fix comments * fix comments again * fix comments, add fixed version of lib, add support for timeout, add support for port, handle invalid login and connection problems * fix logging exception * fix hounceci-bot errors * fix hounceci-bot errors * requirements fix * unique-id changes * make dimmer off use saved ramp rate * configurator working for lights * configurator working for switches? * configurator working for switches? * include model names and fix lint errors * lint fix * fix exception order * lint fixes * fix lint errors * update to use insteon local 0.38 * fix device id * move status check to library * move status check to library * add SKU to setup * lint fixes * requirements * linting
2017-01-08 23:33:35 +00:00
def turn_off(self, **kwargs):
"""Turn device off."""
self.node.off()