diff --git a/homeassistant/components/netgear_lte/sensor.py b/homeassistant/components/netgear_lte/sensor.py index 611fcbdafa7..238a5f9b72d 100644 --- a/homeassistant/components/netgear_lte/sensor.py +++ b/homeassistant/components/netgear_lte/sensor.py @@ -5,7 +5,8 @@ from homeassistant.components.sensor import DOMAIN from homeassistant.exceptions import PlatformNotReady from . import CONF_MONITORED_CONDITIONS, DATA_KEY, LTEEntity -from .sensor_types import SENSOR_SMS, SENSOR_USAGE, SENSOR_UNITS +from .sensor_types import ( + SENSOR_SMS, SENSOR_SMS_TOTAL, SENSOR_USAGE, SENSOR_UNITS) DEPENDENCIES = ['netgear_lte'] @@ -29,7 +30,9 @@ async def async_setup_platform( sensors = [] for sensor_type in monitored_conditions: if sensor_type == SENSOR_SMS: - sensors.append(SMSSensor(modem_data, sensor_type)) + sensors.append(SMSUnreadSensor(modem_data, sensor_type)) + elif sensor_type == SENSOR_SMS_TOTAL: + sensors.append(SMSTotalSensor(modem_data, sensor_type)) elif sensor_type == SENSOR_USAGE: sensors.append(UsageSensor(modem_data, sensor_type)) else: @@ -47,7 +50,7 @@ class LTESensor(LTEEntity): return SENSOR_UNITS[self.sensor_type] -class SMSSensor(LTESensor): +class SMSUnreadSensor(LTESensor): """Unread SMS sensor entity.""" @property @@ -56,6 +59,15 @@ class SMSSensor(LTESensor): return sum(1 for x in self.modem_data.data.sms if x.unread) +class SMSTotalSensor(LTESensor): + """Total SMS sensor entity.""" + + @property + def state(self): + """Return the state of the sensor.""" + return len(self.modem_data.data.sms) + + class UsageSensor(LTESensor): """Data usage sensor entity.""" diff --git a/homeassistant/components/netgear_lte/sensor_types.py b/homeassistant/components/netgear_lte/sensor_types.py index 5b29a20d56b..3171c1d9663 100644 --- a/homeassistant/components/netgear_lte/sensor_types.py +++ b/homeassistant/components/netgear_lte/sensor_types.py @@ -3,10 +3,12 @@ from homeassistant.components.binary_sensor import DEVICE_CLASS_CONNECTIVITY SENSOR_SMS = 'sms' +SENSOR_SMS_TOTAL = 'sms_total' SENSOR_USAGE = 'usage' SENSOR_UNITS = { SENSOR_SMS: 'unread', + SENSOR_SMS_TOTAL: 'messages', SENSOR_USAGE: 'MiB', 'radio_quality': '%', 'rx_level': 'dBm',