Skip to content

Commit

Permalink
300-add-esp-temperature (#318)
Browse files Browse the repository at this point in the history
* Update sensor.py

Add CelsiusSensorEntity class

* Update powerstream.py

Added 20_1.espTempsensor as "ESP Temperature"
  • Loading branch information
Dev-Fabry committed Sep 5, 2024
1 parent c1a4915 commit 1e03006
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
from ...number import MinBatteryLevelEntity, MaxBatteryLevelEntity, BrightnessLevelEntity, DeciChargingPowerEntity
from ...select import PowerDictSelectEntity
from ...sensor import StatusSensorEntity, InWattsSolarSensorEntity, DecivoltSensorEntity, CentivoltSensorEntity, \
DeciampSensorEntity, DecicelsiusSensorEntity, MiscSensorEntity, LevelSensorEntity, DeciwattsSensorEntity, \
DeciampSensorEntity, CelsiusSensorEntity, DecicelsiusSensorEntity, MiscSensorEntity, LevelSensorEntity, DeciwattsSensorEntity, \
AmpSensorEntity, RemainSensorEntity, DecihertzSensorEntity


class PowerStream(BaseDevice):

def sensors(self, client: EcoflowApiClient) -> list[BaseSensorEntity]:
return [
CelsiusSensorEntity(client, self, "20_1.espTempsensor", "ESP Temperature"),

InWattsSolarSensorEntity(client, self, "20_1.pv1InputWatts", "Solar 1 Watts"),
DecivoltSensorEntity(client, self, "20_1.pv1InputVolt", "Solar 1 Input Potential"),
CentivoltSensorEntity(client, self, "20_1.pv1OpVolt", "Solar 1 Op Potential"),
Expand Down
3 changes: 3 additions & 0 deletions custom_components/ecoflow_cloud/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ class TempSensorEntity(BaseSensorEntity):
_attr_state_class = SensorStateClass.MEASUREMENT
_attr_native_value = -1

class CelsiusSensorEntity(TempSensorEntity):
def _update_value(self, val: Any) -> bool:
return super()._update_value(int(val))

class DecicelsiusSensorEntity(TempSensorEntity):
def _update_value(self, val: Any) -> bool:
Expand Down

0 comments on commit 1e03006

Please sign in to comment.