Skip to content

Commit

Permalink
Merge pull request #5 from natekspencer/more-fields
Browse files Browse the repository at this point in the history
Fix scheduled fertilizing field lookup and add fields for cleaning, misting and repotting
  • Loading branch information
natekspencer authored Dec 4, 2024
2 parents bb6463b + 6eb5e0c commit 6b27394
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
40 changes: 39 additions & 1 deletion custom_components/planta/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,34 @@ class PlantaSensorEntityDescription(SensorEntityDescription):
entity_category=EntityCategory.DIAGNOSTIC,
options=PLANT_HEALTH_LIST,
),
PlantaSensorEntityDescription(
key="scheduled_cleaning",
field="cleaning",
is_action=True,
translation_key="scheduled_cleaning",
device_class=SensorDeviceClass.TIMESTAMP,
),
PlantaSensorEntityDescription(
key="scheduled_fertilizing",
field="fertilizing",
field="fertilizingRecurring",
is_action=True,
translation_key="scheduled_fertilizing",
device_class=SensorDeviceClass.TIMESTAMP,
),
PlantaSensorEntityDescription(
key="scheduled_misting",
field="misting",
is_action=True,
translation_key="scheduled_misting",
device_class=SensorDeviceClass.TIMESTAMP,
),
PlantaSensorEntityDescription(
key="scheduled_repotting",
field="repotting",
is_action=True,
translation_key="scheduled_repotting",
device_class=SensorDeviceClass.TIMESTAMP,
),
PlantaSensorEntityDescription(
key="scheduled_watering",
field="watering",
Expand Down Expand Up @@ -126,6 +147,13 @@ class PlantaSensorEntityDescription(SensorEntityDescription):
device_class=SensorDeviceClass.TIMESTAMP,
entity_category=EntityCategory.DIAGNOSTIC,
),
PlantaSensorEntityDescription(
key="last_repotting",
field="repotting",
translation_key="last_repotting",
device_class=SensorDeviceClass.TIMESTAMP,
entity_category=EntityCategory.DIAGNOSTIC,
),
PlantaSensorEntityDescription(
key="last_watering",
field="watering",
Expand All @@ -143,6 +171,16 @@ class PlantaSensorEntityDescription(SensorEntityDescription):
suggested_unit_of_measurement=UnitOfTime.DAYS,
state_class=SensorStateClass.MEASUREMENT,
),
PlantaSensorEntityDescription(
key="time_since_last_repotting",
field="repotting",
translation_key="time_since_last_repotting",
device_class=SensorDeviceClass.DURATION,
entity_category=EntityCategory.DIAGNOSTIC,
native_unit_of_measurement=UnitOfTime.SECONDS,
suggested_unit_of_measurement=UnitOfTime.DAYS,
state_class=SensorStateClass.MEASUREMENT,
),
PlantaSensorEntityDescription(
key="time_since_last_watering",
field="watering",
Expand Down
5 changes: 5 additions & 0 deletions custom_components/planta/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
}
},
"last_fertilizing": { "name": "Last fertilizing" },
"last_repotting": { "name": "Last repotting" },
"last_watering": { "name": "Last watering" },
"pot_size": { "name": "Pot size" },
"pot_type": {
Expand All @@ -84,10 +85,14 @@
"other": "Other pots"
}
},
"scheduled_cleaning": { "name": "Scheduled cleaning" },
"scheduled_fertilizing": { "name": "Scheduled fertilizing" },
"scheduled_misting": { "name": "Scheduled misting" },
"scheduled_repotting": { "name": "Scheduled repotting" },
"scheduled_watering": { "name": "Scheduled watering" },
"size": { "name": "Size" },
"time_since_last_fertilizing": { "name": "Time since last fertilizing" },
"time_since_last_repotting": { "name": "Time since last repotting" },
"time_since_last_watering": { "name": "Time since last watering" }
}
}
Expand Down
5 changes: 5 additions & 0 deletions custom_components/planta/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
}
},
"last_fertilizing": { "name": "Last fertilizing" },
"last_repotting": { "name": "Last repotting" },
"last_watering": { "name": "Last watering" },
"pot_size": { "name": "Pot size" },
"pot_type": {
Expand All @@ -84,10 +85,14 @@
"other": "Other pots"
}
},
"scheduled_cleaning": { "name": "Scheduled cleaning" },
"scheduled_fertilizing": { "name": "Scheduled fertilizing" },
"scheduled_misting": { "name": "Scheduled misting" },
"scheduled_repotting": { "name": "Scheduled repotting" },
"scheduled_watering": { "name": "Scheduled watering" },
"size": { "name": "Size" },
"time_since_last_fertilizing": { "name": "Time since last fertilizing" },
"time_since_last_repotting": { "name": "Time since last repotting" },
"time_since_last_watering": { "name": "Time since last watering" }
}
}
Expand Down

0 comments on commit 6b27394

Please sign in to comment.