Skip to content

Commit

Permalink
Add additional sensors to ecoforest integration (home-assistant#102734)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjanuario authored Oct 30, 2023
1 parent 8fde275 commit 71ecb39
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 4 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/ecoforest/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/ecoforest",
"iot_class": "local_polling",
"requirements": ["pyecoforest==0.3.0"]
"requirements": ["pyecoforest==0.4.0"]
}
60 changes: 59 additions & 1 deletion homeassistant/components/ecoforest/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
SensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import UnitOfTemperature
from homeassistant.const import (
PERCENTAGE,
UnitOfPressure,
UnitOfTemperature,
UnitOfTime,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import StateType
Expand Down Expand Up @@ -88,6 +93,59 @@ class EcoforestSensorEntityDescription(
icon="mdi:alert",
value_fn=lambda data: data.alarm.value if data.alarm else "none",
),
EcoforestSensorEntityDescription(
key="depression",
translation_key="depression",
native_unit_of_measurement=UnitOfPressure.PA,
device_class=SensorDeviceClass.ATMOSPHERIC_PRESSURE,
entity_registry_enabled_default=False,
value_fn=lambda data: data.depression,
),
EcoforestSensorEntityDescription(
key="working_hours",
translation_key="working_hours",
native_unit_of_measurement=UnitOfTime.HOURS,
device_class=SensorDeviceClass.DURATION,
entity_registry_enabled_default=False,
value_fn=lambda data: data.working_hours,
),
EcoforestSensorEntityDescription(
key="ignitions",
translation_key="ignitions",
native_unit_of_measurement="ignitions",
entity_registry_enabled_default=False,
value_fn=lambda data: data.ignitions,
),
EcoforestSensorEntityDescription(
key="live_pulse",
translation_key="live_pulse",
native_unit_of_measurement=UnitOfTime.SECONDS,
device_class=SensorDeviceClass.DURATION,
entity_registry_enabled_default=False,
value_fn=lambda data: data.live_pulse,
),
EcoforestSensorEntityDescription(
key="pulse_offset",
translation_key="pulse_offset",
native_unit_of_measurement=UnitOfTime.SECONDS,
device_class=SensorDeviceClass.DURATION,
entity_registry_enabled_default=False,
value_fn=lambda data: data.pulse_offset,
),
EcoforestSensorEntityDescription(
key="extractor",
translation_key="extractor",
native_unit_of_measurement=PERCENTAGE,
entity_registry_enabled_default=False,
value_fn=lambda data: data.extractor,
),
EcoforestSensorEntityDescription(
key="convecto_air_flow",
translation_key="convecto_air_flow",
native_unit_of_measurement=PERCENTAGE,
entity_registry_enabled_default=False,
value_fn=lambda data: data.convecto_air_flow,
),
)


Expand Down
27 changes: 27 additions & 0 deletions homeassistant/components/ecoforest/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,33 @@
"unkownn": "Unknown alarm",
"none": "None"
}
},
"depression": {
"name": "Depression"
},
"working_hours": {
"name": "Working time"
},
"working_state": {
"name": "Working state"
},
"working_level": {
"name": "Working level"
},
"ignitions": {
"name": "Ignitions"
},
"live_pulse": {
"name": "Live pulse"
},
"pulse_offset": {
"name": "Pulse offset"
},
"extractor": {
"name": "Extractor"
},
"convecto_air_flow": {
"name": "Convecto air flow"
}
},
"number": {
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1681,7 +1681,7 @@ pydroid-ipcam==2.0.0
pyebox==1.1.4

# homeassistant.components.ecoforest
pyecoforest==0.3.0
pyecoforest==0.4.0

# homeassistant.components.econet
pyeconet==0.1.22
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,7 @@ pydrawise==2023.10.0
pydroid-ipcam==2.0.0

# homeassistant.components.ecoforest
pyecoforest==0.3.0
pyecoforest==0.4.0

# homeassistant.components.econet
pyeconet==0.1.22
Expand Down

0 comments on commit 71ecb39

Please sign in to comment.