Refactoring and cleanup

This commit is contained in:
2022-07-25 22:03:54 +00:00
parent ae916a3900
commit 947735292a
16 changed files with 132 additions and 144 deletions

View File

@@ -1,7 +1,7 @@
from homeassistant.components.sensor import SensorEntity
from .const import DOMAIN, DATA_ADDERS
from .helpers import BrowserModEntity
from .entities import BrowserModEntity
async def async_setup_platform(
@@ -48,12 +48,15 @@ class BrowserSensor(BrowserModEntity, SensorEntity):
@property
def extra_state_attributes(self):
retval = super().extra_state_attributes
if self.parameter == "currentUser":
retval["userData"] = self._data.get("browser", {}).get("userData")
if self.parameter == "path":
retval["pathSegments"] = (
self._data.get("browser", {}).get("path", "").split("/")
)
if self.parameter == "userAgent":
retval["userAgent"] = self._data.get("browser", {}).get("userAgent")