Hello dear openHAB’ers,
I love my plants and I love openHAB but I am really bad when it comes to frontend developing . Thus, I would highly appreciate if we could jointly develop a widget which fulfills (I think) quite general requirements when it comes to plant care.
I would love to have a widget like this:
It does not have to be exactly like this. I am far from being a designer so in case you have better ideas, go for it. ^^
In the best case it is not a widget bound to a specific plant but to all my plants assigned to a group. So when I assign a group AllPlants
to the widget it automatically draws something like this on a sitemap:
Let’s start with a list of requirements. The card shows…
- the label of the plant
- the location of the plant either ideally from the semantic model or if not possible from a non-semantic tag or other source of informatoin
- a semi-transparent background image with path taken from metadata
- an always visible information about “days until waitering”
- a dynamically visible information about “days until fertilizing” when the plant’s item “Growth phase” is
ON
- An information in brackets showing the attributes
wateringInterval
orfertilizingInterval
from the metadata of this plant
- An information in brackets showing the attributes
- a growth phase slider which can be used for interaction
- two buttons for watering/fertilizing.
- Each button is gray in case days until watering/fertilizing is greater than 0.
- Each button is blue (watering) or green (fertilizing) in case the value is 0 or lower.
- One can always interact with the buttons. Means: You can “water” the plant also when days until watering was greater than 0
And some sitemap related requirements:
- In the best case we only need to provide the
AllPlants
group to the widget and it dynamically creates a card for each plant automatically - The cards support dynamic layouts for different screen sizes like this example from the documentation:
A plant which needs watering and fertilizing can be seen on the first screenshot.
This is a plant which does not need watering or fertilizing at the moment:
This one is not in growth phase, so we do not see the fertilizing information. However, the fertilizing button is still visible as we of course can give the poor plant some food in winter if we want to .
The data model currently looks as follows:
Group AllPlants
Group Testplant
"Test plant"
(Location_Groundfloor, AllPlants)
["Plant"]
{
staticMetadata=" " [
background="<OH-URL>/static/plant.jpg"
]
}
Switch Testplant_Growthphase
(Testplant)
Switch Testplant_Watering
(Testplant)
Switch Testplant_Fertilizing
(Testplant)
Number Testplant_DaysUntilWatering
(Testplant)
{
staticMetadata=" " [
wateringInterval=7
]
}
Number Testplant_DaysUntilFertilizing
(Testplant)
{
staticMetadata=" " [
fertilizingInterval=30
]
}
For sure if something needs to be changed on data model side as it is not supported (like using metadata or getting the location out of the semantic model) then it can be adapted of course.
The Switch
items are like bound to the buttons/slider on the card. This would mean, in case a plant does not need watering (Testplant_Watering
would be OFF
and thus gray on the card) but I still water it, I would need to push it twice. The first push would make it ON
and thus blue and then it would turn gray and OFF
again which would trigger a rule in the background that would put the “Days until watering” back to the wateringInterval
(in this case “7”).
Is this somehow possible what I am trying to do here? ^^