custom_components/myenergi/sensor.py
def state(self):
        """Return the state of the sensor."""
        prop_name = self.meta["prop_name"]
        if prop_name == "power_export":
            power = self.coordinator.client.power_grid
            return abs(min(0, power))
        elif prop_name == "power_import":
            power = self.coordinator.client.power_grid
            return max(0, power)
        return operator.attrgetter(prop_name)(self.coordinator.client)
Return the state of the sensor.
Return the state of the sensor.
Return the state of the sensor .
def state(self):
        prop_name = self.meta["prop_name"]
        if prop_name == "power_export":
            power = self.coordinator.client.power_grid
            return abs(min(0, power))
        elif prop_name == "power_import":
            power = self.coordinator.client.power_grid
            return max(0, power)
        return operator.attrgetter(prop_name)(self.coordinator.client)
def state ( self ) : prop_name = self . meta [ "prop_name" ] if prop_name == "power_export" : power = self . coordinator . client . power_grid return abs ( min ( 0 , power ) ) elif prop_name == "power_import" : power = self . coordinator . client . power_grid return max ( 0 , power ) return operator . attrgetter ( prop_name ) ( self . coordinator . client )
Return the state of the sensor.
Return the state of the sensor .
"""Return the state of the sensor."""
self