* Merge from current dev * Update for Sensor approach * Update reference to state classes * Reference stateKey correctly * Reference stateKey * Change deviceInfo to a dict * Pass state to properties method * Add state info to device_state_attributes * Update entity name to include state name * Update for on() off() vs light_on/off * Flag newnames option * Update configuration schema * Update configuration schema * Spell False correctly * Rename state to statekey * Rename statekey to stateKey * Call new device with stateKey and newname * Simplify use of newnames * Add workdir to save devices * Fix newnames config setup * Propogate OnOffSensor to VariableSensor change * Upgrade insteonplm version to 0.8.0 * Pass address rather than device object to platform * Set inteon_plm data variable to PLM * Consistant use of conn and plm * Consistant use of conn and plm * Proper reference to device and address * Fixed platform setup issues * Correct issue with missing _supported_features attr * Properly reference self._state vs self.state * Bump insteonplm version to 0.8.1 * Remove subplatform and map based on state name * Correct refrence to State * Correct reference to device.states * Bump insteonplm to 0.8.2 * Fix format errors * Fix format issues * Fix trailing whitespace * Correct format issues * Fix format issues * Fix format issues * Fixed format issues * Fixed format issues * Move imports inside classes * Simplify import of modules * Correct reference to OnOffSwitch_OutletTop and bottom * Remove unnessary references * Fix format issues * Code review adjustments * Fix format issue * Use new nameing format for groups that are not group 0x01 * Remove newname feature * Fix binary_sensor type to default to None * Fix device_class property to return the sensor type correctly. * rename _device and _state to avoid conflicts with Entity * Format long lines * Pylint clean up * Insteon_PLM * lint cleanup * Check device_override has address * 3.4 lint clean up * Changes per code review * Change discovered from a list of dict to a dict * Correct common_attributes usage * Change discovered from a list of dict to a dict * Add debugging message to confirm platform setup * Debug messages * Debug messages * Debug async_added_to_hass * Debug async_added_to_hass async_add_job * Debug async_added_to_hass * Debug devices not loading in hass * Debug new entities not being added to hass * Debug adding devices to hass * Revert "3.4 lint clean up" This reverts commit0d8fb992b1
. * 3.4 lint clean up * Revert "Debug adding devices to hass" This reverts commitec306773d4
. * Revert "Debug new entities not being added to hass" This reverts commit55fb724d06
. * Revert "Debug devices not loading in hass" This reverts commit07814b4f14
. * Revert "Debug async_added_to_hass" This reverts commit4963a255d8
. * Revert "Debug async_added_to_hass async_add_job" This reverts commit22cadff91f
. * Revert "Debug async_added_to_hass" This reverts commit12c5651fe4
. * Pylint clean up * pylint cleanup * Clean up naming * Enhance config schema. Fix logging issue * Reapply changes after squash
36 lines
1 KiB
Python
36 lines
1 KiB
Python
"""
|
|
Support for INSTEON dimmers via PowerLinc Modem.
|
|
|
|
For more details about this component, please refer to the documentation at
|
|
https://home-assistant.io/components/sensor.insteon_plm/
|
|
"""
|
|
import asyncio
|
|
import logging
|
|
|
|
from homeassistant.components.insteon_plm import InsteonPLMEntity
|
|
from homeassistant.helpers.entity import Entity
|
|
|
|
DEPENDENCIES = ['insteon_plm']
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
@asyncio.coroutine
|
|
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|
"""Set up the INSTEON PLM device class for the hass platform."""
|
|
plm = hass.data['insteon_plm']
|
|
|
|
address = discovery_info['address']
|
|
device = plm.devices[address]
|
|
state_key = discovery_info['state_key']
|
|
|
|
_LOGGER.debug('Adding device %s entity %s to Sensor platform',
|
|
device.address.hex, device.states[state_key].name)
|
|
|
|
new_entity = InsteonPLMSensorDevice(device, state_key)
|
|
|
|
async_add_devices([new_entity])
|
|
|
|
|
|
class InsteonPLMSensorDevice(InsteonPLMEntity, Entity):
|
|
"""A Class for an Insteon device."""
|