(self)
Update the sensor.
Update the sensor.
Update the sensor .
async def async_update(self):
        """Update the sensor."""
        # Send update "signal" to the component
        await update_data(self.hass, self.hass.data[DOMAIN_DATA]["throttle"])

        # Get new data (if any)
        updated = self.hass.data[DOMAIN_DATA]

        # Check the data and update the value.
        self._state = len(updated.get("potential", [])) - 1
        self._state = 0 if self._state < 0 else self._state

        # Set/update attributes
        self.attr = updated.get("potential", [])
async def async_update ( self ) : # Send update "signal" to the component await update_data ( self . hass , self . hass . data [ DOMAIN_DATA ] [ "throttle" ] ) # Get new data (if any) updated = self . hass . data [ DOMAIN_DATA ] # Check the data and update the value. self . _state = len ( updated . get ( "potential" , [ ] ) ) - 1 self . _state = 0 if self . _state < 0 else self . _state # Set/update attributes self . attr = updated . get ( "potential" , [ ] )