mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add netgear_lte connection sensors (#22558)
This commit is contained in:
parent
a61181b10c
commit
282fd225c9
@ -20,7 +20,7 @@ from homeassistant.helpers.event import async_track_time_interval
|
|||||||
|
|
||||||
from . import sensor_types
|
from . import sensor_types
|
||||||
|
|
||||||
REQUIREMENTS = ['eternalegypt==0.0.5']
|
REQUIREMENTS = ['eternalegypt==0.0.6']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -36,6 +36,8 @@ async def async_setup_platform(
|
|||||||
sensors.append(SMSSensor(modem_data, sensor_type))
|
sensors.append(SMSSensor(modem_data, sensor_type))
|
||||||
elif sensor_type == SENSOR_USAGE:
|
elif sensor_type == SENSOR_USAGE:
|
||||||
sensors.append(UsageSensor(modem_data, sensor_type))
|
sensors.append(UsageSensor(modem_data, sensor_type))
|
||||||
|
else:
|
||||||
|
sensors.append(GenericSensor(modem_data, sensor_type))
|
||||||
|
|
||||||
async_add_entities(sensors)
|
async_add_entities(sensors)
|
||||||
|
|
||||||
@ -106,3 +108,12 @@ class UsageSensor(LTESensor):
|
|||||||
def state(self):
|
def state(self):
|
||||||
"""Return the state of the sensor."""
|
"""Return the state of the sensor."""
|
||||||
return round(self.modem_data.data.usage / 1024**2, 1)
|
return round(self.modem_data.data.usage / 1024**2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
class GenericSensor(LTESensor):
|
||||||
|
"""Sensor entity with raw state."""
|
||||||
|
|
||||||
|
@property
|
||||||
|
def state(self):
|
||||||
|
"""Return the state of the sensor."""
|
||||||
|
return getattr(self.modem_data.data, self.sensor_type)
|
||||||
|
@ -6,6 +6,19 @@ SENSOR_USAGE = 'usage'
|
|||||||
SENSOR_UNITS = {
|
SENSOR_UNITS = {
|
||||||
SENSOR_SMS: 'unread',
|
SENSOR_SMS: 'unread',
|
||||||
SENSOR_USAGE: 'MiB',
|
SENSOR_USAGE: 'MiB',
|
||||||
|
'radio_quality': '%',
|
||||||
|
'rx_level': 'dBm',
|
||||||
|
'tx_level': 'dBm',
|
||||||
|
'upstream': None,
|
||||||
|
'wire_connected': None,
|
||||||
|
'mobile_connected': None,
|
||||||
|
'connection_text': None,
|
||||||
|
'connection_type': None,
|
||||||
|
'current_ps_service_type': None,
|
||||||
|
'register_network_display': None,
|
||||||
|
'roaming': None,
|
||||||
|
'current_band': None,
|
||||||
|
'cell_id': None,
|
||||||
}
|
}
|
||||||
|
|
||||||
ALL = list(SENSOR_UNITS)
|
ALL = list(SENSOR_UNITS)
|
||||||
|
@ -407,7 +407,7 @@ ephem==3.7.6.0
|
|||||||
epson-projector==0.1.3
|
epson-projector==0.1.3
|
||||||
|
|
||||||
# homeassistant.components.netgear_lte
|
# homeassistant.components.netgear_lte
|
||||||
eternalegypt==0.0.5
|
eternalegypt==0.0.6
|
||||||
|
|
||||||
# homeassistant.components.keyboard_remote
|
# homeassistant.components.keyboard_remote
|
||||||
# evdev==0.6.1
|
# evdev==0.6.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user