Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

300-add-esp-temperature #318

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading