core/homeassistant/components/lightwave/sensor.py

60 lines
1.8 KiB
Python
Raw Normal View History

Add Lightwave TRV (#31665) * Add a shadow for covers that do not support postion * Rename shadow as optimistic * Add TRV support * Revert "Rename shadow as optimistic" This reverts commit e6e1db9cfba082c8e52d7fff57b4d79306f0de49. * Revert "Add a shadow for covers that do not support postion" This reverts commit 4f53e2c6c6ec955d673ab1f66b7107e1f4651374. * fix logic error * Modified configuration * Modified configuration (2) * ATTR_BATTERY_LEVEL * move socket code to library 2 * requirements_all.txt * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Style changes requested by @sprintstan * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Black * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Remove device_attr * remove redundant proxy parameters, left over from previous change * remove device id - not used * add comment on inhibit flag * pylint * fix config logic error * revert suggested change: need different behaviour with None & 0 * touch * backoff error in rebase change * Requesed code changes from @springstan * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Changes requested by @MartinHjelmare * Clean temp step constant Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> Co-authored-by: springstan <46536646+springstan@users.noreply.github.com> Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-04-13 02:35:47 +00:00
"""Support for LightwaveRF TRV - Associated Battery."""
from __future__ import annotations
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorStateClass,
)
from homeassistant.const import CONF_NAME, PERCENTAGE
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
Add Lightwave TRV (#31665) * Add a shadow for covers that do not support postion * Rename shadow as optimistic * Add TRV support * Revert "Rename shadow as optimistic" This reverts commit e6e1db9cfba082c8e52d7fff57b4d79306f0de49. * Revert "Add a shadow for covers that do not support postion" This reverts commit 4f53e2c6c6ec955d673ab1f66b7107e1f4651374. * fix logic error * Modified configuration * Modified configuration (2) * ATTR_BATTERY_LEVEL * move socket code to library 2 * requirements_all.txt * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Style changes requested by @sprintstan * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Black * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Remove device_attr * remove redundant proxy parameters, left over from previous change * remove device id - not used * add comment on inhibit flag * pylint * fix config logic error * revert suggested change: need different behaviour with None & 0 * touch * backoff error in rebase change * Requesed code changes from @springstan * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Changes requested by @MartinHjelmare * Clean temp step constant Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> Co-authored-by: springstan <46536646+springstan@users.noreply.github.com> Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-04-13 02:35:47 +00:00
from . import CONF_SERIAL, LIGHTWAVE_LINK
async def async_setup_platform(
hass: HomeAssistant,
config: ConfigType,
async_add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
Add Lightwave TRV (#31665) * Add a shadow for covers that do not support postion * Rename shadow as optimistic * Add TRV support * Revert "Rename shadow as optimistic" This reverts commit e6e1db9cfba082c8e52d7fff57b4d79306f0de49. * Revert "Add a shadow for covers that do not support postion" This reverts commit 4f53e2c6c6ec955d673ab1f66b7107e1f4651374. * fix logic error * Modified configuration * Modified configuration (2) * ATTR_BATTERY_LEVEL * move socket code to library 2 * requirements_all.txt * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Style changes requested by @sprintstan * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Black * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Remove device_attr * remove redundant proxy parameters, left over from previous change * remove device id - not used * add comment on inhibit flag * pylint * fix config logic error * revert suggested change: need different behaviour with None & 0 * touch * backoff error in rebase change * Requesed code changes from @springstan * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Changes requested by @MartinHjelmare * Clean temp step constant Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> Co-authored-by: springstan <46536646+springstan@users.noreply.github.com> Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-04-13 02:35:47 +00:00
"""Find and return battery."""
if discovery_info is None:
return
batteries = []
lwlink = hass.data[LIGHTWAVE_LINK]
for device_config in discovery_info.values():
name = device_config[CONF_NAME]
serial = device_config[CONF_SERIAL]
batteries.append(LightwaveBattery(name, lwlink, serial))
async_add_entities(batteries)
class LightwaveBattery(SensorEntity):
Add Lightwave TRV (#31665) * Add a shadow for covers that do not support postion * Rename shadow as optimistic * Add TRV support * Revert "Rename shadow as optimistic" This reverts commit e6e1db9cfba082c8e52d7fff57b4d79306f0de49. * Revert "Add a shadow for covers that do not support postion" This reverts commit 4f53e2c6c6ec955d673ab1f66b7107e1f4651374. * fix logic error * Modified configuration * Modified configuration (2) * ATTR_BATTERY_LEVEL * move socket code to library 2 * requirements_all.txt * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Style changes requested by @sprintstan * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Black * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Remove device_attr * remove redundant proxy parameters, left over from previous change * remove device id - not used * add comment on inhibit flag * pylint * fix config logic error * revert suggested change: need different behaviour with None & 0 * touch * backoff error in rebase change * Requesed code changes from @springstan * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Changes requested by @MartinHjelmare * Clean temp step constant Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> Co-authored-by: springstan <46536646+springstan@users.noreply.github.com> Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-04-13 02:35:47 +00:00
"""Lightwave TRV Battery."""
_attr_device_class = SensorDeviceClass.BATTERY
_attr_native_unit_of_measurement = PERCENTAGE
_attr_state_class = SensorStateClass.MEASUREMENT
Add Lightwave TRV (#31665) * Add a shadow for covers that do not support postion * Rename shadow as optimistic * Add TRV support * Revert "Rename shadow as optimistic" This reverts commit e6e1db9cfba082c8e52d7fff57b4d79306f0de49. * Revert "Add a shadow for covers that do not support postion" This reverts commit 4f53e2c6c6ec955d673ab1f66b7107e1f4651374. * fix logic error * Modified configuration * Modified configuration (2) * ATTR_BATTERY_LEVEL * move socket code to library 2 * requirements_all.txt * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Style changes requested by @sprintstan * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Black * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Remove device_attr * remove redundant proxy parameters, left over from previous change * remove device id - not used * add comment on inhibit flag * pylint * fix config logic error * revert suggested change: need different behaviour with None & 0 * touch * backoff error in rebase change * Requesed code changes from @springstan * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Changes requested by @MartinHjelmare * Clean temp step constant Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> Co-authored-by: springstan <46536646+springstan@users.noreply.github.com> Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-04-13 02:35:47 +00:00
def __init__(self, name, lwlink, serial):
"""Initialize the Lightwave Trv battery sensor."""
self._attr_name = name
Add Lightwave TRV (#31665) * Add a shadow for covers that do not support postion * Rename shadow as optimistic * Add TRV support * Revert "Rename shadow as optimistic" This reverts commit e6e1db9cfba082c8e52d7fff57b4d79306f0de49. * Revert "Add a shadow for covers that do not support postion" This reverts commit 4f53e2c6c6ec955d673ab1f66b7107e1f4651374. * fix logic error * Modified configuration * Modified configuration (2) * ATTR_BATTERY_LEVEL * move socket code to library 2 * requirements_all.txt * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Style changes requested by @sprintstan * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Black * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Remove device_attr * remove redundant proxy parameters, left over from previous change * remove device id - not used * add comment on inhibit flag * pylint * fix config logic error * revert suggested change: need different behaviour with None & 0 * touch * backoff error in rebase change * Requesed code changes from @springstan * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Changes requested by @MartinHjelmare * Clean temp step constant Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> Co-authored-by: springstan <46536646+springstan@users.noreply.github.com> Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-04-13 02:35:47 +00:00
self._lwlink = lwlink
self._serial = serial
self._attr_unique_id = f"{serial}-trv-battery"
Add Lightwave TRV (#31665) * Add a shadow for covers that do not support postion * Rename shadow as optimistic * Add TRV support * Revert "Rename shadow as optimistic" This reverts commit e6e1db9cfba082c8e52d7fff57b4d79306f0de49. * Revert "Add a shadow for covers that do not support postion" This reverts commit 4f53e2c6c6ec955d673ab1f66b7107e1f4651374. * fix logic error * Modified configuration * Modified configuration (2) * ATTR_BATTERY_LEVEL * move socket code to library 2 * requirements_all.txt * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Style changes requested by @sprintstan * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Black * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Remove device_attr * remove redundant proxy parameters, left over from previous change * remove device id - not used * add comment on inhibit flag * pylint * fix config logic error * revert suggested change: need different behaviour with None & 0 * touch * backoff error in rebase change * Requesed code changes from @springstan * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Changes requested by @MartinHjelmare * Clean temp step constant Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> Co-authored-by: springstan <46536646+springstan@users.noreply.github.com> Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-04-13 02:35:47 +00:00
2022-09-01 12:14:31 +00:00
def update(self) -> None:
Add Lightwave TRV (#31665) * Add a shadow for covers that do not support postion * Rename shadow as optimistic * Add TRV support * Revert "Rename shadow as optimistic" This reverts commit e6e1db9cfba082c8e52d7fff57b4d79306f0de49. * Revert "Add a shadow for covers that do not support postion" This reverts commit 4f53e2c6c6ec955d673ab1f66b7107e1f4651374. * fix logic error * Modified configuration * Modified configuration (2) * ATTR_BATTERY_LEVEL * move socket code to library 2 * requirements_all.txt * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Style changes requested by @sprintstan * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/__init__.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Black * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Remove device_attr * remove redundant proxy parameters, left over from previous change * remove device id - not used * add comment on inhibit flag * pylint * fix config logic error * revert suggested change: need different behaviour with None & 0 * touch * backoff error in rebase change * Requesed code changes from @springstan * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/climate.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Update homeassistant/components/lightwave/sensor.py Co-Authored-By: Martin Hjelmare <marhje52@gmail.com> * Changes requested by @MartinHjelmare * Clean temp step constant Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> Co-authored-by: springstan <46536646+springstan@users.noreply.github.com> Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-04-13 02:35:47 +00:00
"""Communicate with a Lightwave RTF Proxy to get state."""
(dummy_temp, dummy_targ, battery, dummy_output) = self._lwlink.read_trv_status(
self._serial
)
self._attr_native_value = battery