Skip to content

Commit

Permalink
Add new sensors to fyta (#135032)
Browse files Browse the repository at this point in the history
  • Loading branch information
dontinelli authored Jan 7, 2025
1 parent a01521b commit de9c05a
Show file tree
Hide file tree
Showing 4 changed files with 361 additions and 0 deletions.
9 changes: 9 additions & 0 deletions homeassistant/components/fyta/icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"moisture_status": {
"default": "mdi:water-percent-alert"
},
"nutrients_status": {
"default": "mdi:emoticon-poop"
},
"salinity_status": {
"default": "mdi:sprout-outline"
},
Expand All @@ -21,6 +24,12 @@
},
"salinity": {
"default": "mdi:sprout-outline"
},
"last_fertilised": {
"default": "mdi:calendar-check"
},
"next_fertilisation": {
"default": "mdi:calendar-end"
}
}
}
Expand Down
19 changes: 19 additions & 0 deletions homeassistant/components/fyta/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ class FytaSensorEntityDescription(SensorEntityDescription):
options=PLANT_MEASUREMENT_STATUS_LIST,
value_fn=lambda plant: plant.moisture_status.name.lower(),
),
FytaSensorEntityDescription(
key="nutrients_status",
translation_key="nutrients_status",
device_class=SensorDeviceClass.ENUM,
options=PLANT_MEASUREMENT_STATUS_LIST,
value_fn=lambda plant: plant.nutrients_status.name.lower(),
),
FytaSensorEntityDescription(
key="salinity_status",
translation_key="salinity_status",
Expand Down Expand Up @@ -124,6 +131,18 @@ class FytaSensorEntityDescription(SensorEntityDescription):
state_class=SensorStateClass.MEASUREMENT,
value_fn=lambda plant: plant.ph,
),
FytaSensorEntityDescription(
key="fertilise_last",
translation_key="last_fertilised",
device_class=SensorDeviceClass.DATE,
value_fn=lambda plant: plant.fertilise_last,
),
FytaSensorEntityDescription(
key="fertilise_next",
translation_key="next_fertilisation",
device_class=SensorDeviceClass.DATE,
value_fn=lambda plant: plant.fertilise_next,
),
FytaSensorEntityDescription(
key="battery_level",
native_unit_of_measurement=PERCENTAGE,
Expand Down
17 changes: 17 additions & 0 deletions homeassistant/components/fyta/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@
"too_high": "[%key:component::fyta::entity::sensor::temperature_status::state::too_high%]"
}
},
"nutrients_status": {
"name": "Nutrients state",
"state": {
"no_data": "[%key:component::fyta::entity::sensor::temperature_status::state::no_data%]",
"too_low": "[%key:component::fyta::entity::sensor::temperature_status::state::too_low%]",
"low": "[%key:component::fyta::entity::sensor::temperature_status::state::low%]",
"perfect": "[%key:component::fyta::entity::sensor::temperature_status::state::perfect%]",
"high": "[%key:component::fyta::entity::sensor::temperature_status::state::high%]",
"too_high": "[%key:component::fyta::entity::sensor::temperature_status::state::too_high%]"
}
},
"salinity_status": {
"name": "Salinity state",
"state": {
Expand All @@ -100,6 +111,12 @@
},
"salinity": {
"name": "Salinity"
},
"last_fertilised": {
"name": "Last fertilized"
},
"next_fertilisation": {
"name": "Next fertilization"
}
}
},
Expand Down
Loading

0 comments on commit de9c05a

Please sign in to comment.