miflora-card icon indicating copy to clipboard operation
miflora-card copied to clipboard

Read values from plant domain

Open k1rd3rf opened this issue 5 years ago • 1 comments

It would be nice to specify one entity instead of each and every entity, since HA support the plant domain.

plant:
  ficus:
    sensors:
      moisture: sensor.plant_ficus_moisture
      conductivity: sensor.plant_ficus_conductivity
      brightness: sensor.plant_ficus_brightness
      temperature: sensor.plant_ficus_temperature
      battery: sensor.plant_ficus_battery
    min_moisture: 20
    max_moisture: 60
    min_conductivity: 350
    max_conductivity: 2000
    min_brightness: 2500
    max_brightness: 35000
    min_temperature: 8
    max_temperature: 32
    min_battery: 15

lovelace:

- type: custom:miflora-card
  title: 'Ficus microcarpa'
  image: images/ficus_microcarpa.jpg
  plant: plant.ficus

k1rd3rf avatar Jun 05 '20 20:06 k1rd3rf

I like the idea. Getting the current status from the plant entity is easy enough. However, I can't find an easy way to get the configured max/min-values. There is another card here that just checks if the state contains a keyword, and will color the icon red based on that: https://github.com/jckoester/lovelace-picture-plant-card

But I don't really like that approach.

I think it would be better to get the configured min/max-values into the attributes of the plant "sensors": https://github.com/home-assistant/core/blob/dev/homeassistant/components/plant/init.py

That way we could read it directly from the plant entity. But that requires a PR to the plant component...

Olen avatar Jun 08 '20 19:06 Olen