HomeMatic optimizations and code cleanup (#7986)
* Cleanup and optimizations * Cleanup * Typo -.- * Linting
This commit is contained in:
parent
49d642741d
commit
a19e7ba3f1
5 changed files with 119 additions and 149 deletions
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
The homematic sensor platform.
|
||||
The HomeMatic sensor platform.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/sensor.homematic/
|
||||
|
@ -51,7 +51,7 @@ HM_ICON_HA_CAST = {
|
|||
|
||||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Set up the Homematic platform."""
|
||||
"""Set up the HomeMatic platform."""
|
||||
if discovery_info is None:
|
||||
return
|
||||
|
||||
|
@ -65,7 +65,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
|
||||
|
||||
class HMSensor(HMDevice):
|
||||
"""Represents various Homematic sensors in Home Assistant."""
|
||||
"""Represents various HomeMatic sensors in Home Assistant."""
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
|
@ -89,11 +89,8 @@ class HMSensor(HMDevice):
|
|||
return HM_ICON_HA_CAST.get(self._state, None)
|
||||
|
||||
def _init_data_struct(self):
|
||||
"""Generate a data dict (self._data) from hm metadata."""
|
||||
# Add state to data dict
|
||||
"""Generate a data dictionary (self._data) from metadata."""
|
||||
if self._state:
|
||||
_LOGGER.debug("%s init datadict with main node %s", self._name,
|
||||
self._state)
|
||||
self._data.update({self._state: STATE_UNKNOWN})
|
||||
else:
|
||||
_LOGGER.critical("Can't correctly init sensor %s", self._name)
|
||||
_LOGGER.critical("Can't initialize sensor %s", self._name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue