added device_info property
This commit is contained in:
@@ -4,6 +4,7 @@ import logging
|
|||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from homeassistant.helpers.event import async_track_time_interval
|
from homeassistant.helpers.event import async_track_time_interval
|
||||||
from homeassistant.helpers.translation import async_get_translations
|
from homeassistant.helpers.translation import async_get_translations
|
||||||
|
from const import DOMAIN
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -66,6 +67,16 @@ class FroelingBinarySensor(BinarySensorEntity):
|
|||||||
def is_on(self):
|
def is_on(self):
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_info(self):
|
||||||
|
return {
|
||||||
|
"identifiers": {(DOMAIN, self._device_name)},
|
||||||
|
"name": self._device_name,
|
||||||
|
"manufacturer": "Froeling",
|
||||||
|
"model": "Lambdatronic Modbus",
|
||||||
|
"sw_version": "1.0",
|
||||||
|
}
|
||||||
|
|
||||||
async def async_update(self, _=None):
|
async def async_update(self, _=None):
|
||||||
client = ModbusTcpClient(self._host, port=self._port)
|
client = ModbusTcpClient(self._host, port=self._port)
|
||||||
if client.connect():
|
if client.connect():
|
||||||
@@ -106,6 +117,16 @@ class FroelingSensor(BinarySensorEntity):
|
|||||||
def is_on(self):
|
def is_on(self):
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_info(self):
|
||||||
|
return {
|
||||||
|
"identifiers": {(DOMAIN, self._device_name)},
|
||||||
|
"name": self._device_name,
|
||||||
|
"manufacturer": "Froeling",
|
||||||
|
"model": "Lambdatronic Modbus",
|
||||||
|
"sw_version": "1.0",
|
||||||
|
}
|
||||||
|
|
||||||
async def async_update(self, _=None):
|
async def async_update(self, _=None):
|
||||||
client = ModbusTcpClient(self._host, port=self._port, retries=2, timeout=15)
|
client = ModbusTcpClient(self._host, port=self._port, retries=2, timeout=15)
|
||||||
if client.connect():
|
if client.connect():
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import logging
|
|||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from homeassistant.helpers.event import async_track_time_interval
|
from homeassistant.helpers.event import async_track_time_interval
|
||||||
from homeassistant.helpers.translation import async_get_translations
|
from homeassistant.helpers.translation import async_get_translations
|
||||||
|
from const import DOMAIN
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -100,6 +101,16 @@ class FroelingNumber(NumberEntity):
|
|||||||
def native_max_value(self):
|
def native_max_value(self):
|
||||||
return self._max_value
|
return self._max_value
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_info(self):
|
||||||
|
return {
|
||||||
|
"identifiers": {(DOMAIN, self._device_name)},
|
||||||
|
"name": self._device_name,
|
||||||
|
"manufacturer": "Froeling",
|
||||||
|
"model": "Lambdatronic Modbus",
|
||||||
|
"sw_version": "1.0",
|
||||||
|
}
|
||||||
|
|
||||||
async def async_set_native_value(self, value):
|
async def async_set_native_value(self, value):
|
||||||
client = ModbusTcpClient(self._host, port=self._port)
|
client = ModbusTcpClient(self._host, port=self._port)
|
||||||
if client.connect():
|
if client.connect():
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import logging
|
|||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from homeassistant.helpers.event import async_track_time_interval
|
from homeassistant.helpers.event import async_track_time_interval
|
||||||
from homeassistant.helpers.translation import async_get_translations
|
from homeassistant.helpers.translation import async_get_translations
|
||||||
|
from const import DOMAIN
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -126,6 +127,16 @@ class FroelingSensor(SensorEntity):
|
|||||||
def device_class(self):
|
def device_class(self):
|
||||||
return self._device_class
|
return self._device_class
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_info(self):
|
||||||
|
return {
|
||||||
|
"identifiers": {(DOMAIN, self._device_name)},
|
||||||
|
"name": self._device_name,
|
||||||
|
"manufacturer": "Froeling",
|
||||||
|
"model": "Lambdatronic Modbus",
|
||||||
|
"sw_version": "1.0",
|
||||||
|
}
|
||||||
|
|
||||||
async def async_update(self, _=None):
|
async def async_update(self, _=None):
|
||||||
client = ModbusTcpClient(self._host, port=self._port, retries=2, timeout=15)
|
client = ModbusTcpClient(self._host, port=self._port, retries=2, timeout=15)
|
||||||
if client.connect():
|
if client.connect():
|
||||||
@@ -269,6 +280,16 @@ class FroelingTextSensor(SensorEntity):
|
|||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_info(self):
|
||||||
|
return {
|
||||||
|
"identifiers": {(DOMAIN, self._device_name)},
|
||||||
|
"name": self._device_name,
|
||||||
|
"manufacturer": "Froeling",
|
||||||
|
"model": "Lambdatronic Modbus",
|
||||||
|
"sw_version": "1.0",
|
||||||
|
}
|
||||||
|
|
||||||
async def async_update_text_sensor(self, _=None):
|
async def async_update_text_sensor(self, _=None):
|
||||||
client = ModbusTcpClient(self._host, port=self._port, retries=2, timeout=15)
|
client = ModbusTcpClient(self._host, port=self._port, retries=2, timeout=15)
|
||||||
|
|||||||
Reference in New Issue
Block a user