Cloud Plant DB with API for PlantCard

Where is this file located?

in custom_component/plant

This helped, thank you. Would have never figured this out on my own, as those error messages are just… leading nowhere.

let me start by saying the work you are doing rocks. it is spot on what I hoped home assistant would offer for plants. so far I’ve been doing it manually extracting data from the flower care app manually and define the plants.
I managed to get the new plant integration to work. it is fetching the right info from the online DB (5 different plants). I can add the plants to entities card and see all the info in the attributes.
downloaded the images from the DB and saves them under

\config\www\images\plants

However, I am unable to get the card to work. I downloaded the code saved it in:

config\www\lovelace-flower-card

and in the resources section of the dashboards I added

 /local/lovelace-flower-card/flower-card.js

as Java Script Module.

and here is the config for the card:

type: custom:flower-card
entity: plant.cycas_revoluta

but I am getting an error

Custom element doesn't exist: flower-card.

even if I reload, restart HASS …etc. what am I missing?

Thank you for encouragement! Nice to hear!
Have you installed card-tools as well? GitHub - thomasloven/lovelace-card-tools: 🔹A collection of tools for other lovelace plugins to use

If yes then I’d check a Browser Console if any errors there which can give you a clue what’s wrong. Feel free to post errors here or send me a message.

1 Like

thank you for the tip. the console reported it can not find data.js (remains from the older iteration of this card) … clearing the cache solved the problem …

thanks again for the amazing work

Hi all. It’s been a while…
New Plantbook UI update has just been released. Changes:

version 1.04 (20 July 2021)

Major UI update. Now Users can:

  • Modify existing Public-Plants using “Modify” button in Browse DB.
  • Add new Plants using “Add Plant” button in side Menu. Plant is cloned into User-Plant and visible in “My Plants” side menu.
  • Modify own User-Plants via “My Plants” side menu.
  • The only way to delete User-Plant at the moment is via API DELETE call. UI-based deletion will be available in next release.

The detailed documentation about UI Add/Modify operations is available in Wiki - finishing the docs up soon. Let me know if you need any help or clarifications.

2 Likes

Hello,

I may missed something but i can’t get image dynamicaly :frowning:
I created 2 identical plants except image :
image

tomates:
  species: "tomato master no. 2 f1"
  image: openplantbook
  name: Grosses tomates
  sensors:
    moisture: sensor.tomates_moisture
    conductivity: sensor.tomates_conductivity
    temperature: sensor.tomates_temperature
    brightness: sensor.tomates_light

tomatwo:
  species: "tomato master no. 2 f1"
  image: /local/images/plants/tomato.jpg
  name: Grosses tomates 2
  sensors:
    moisture: sensor.tomates_moisture
    conductivity: sensor.tomates_conductivity
    temperature: sensor.tomates_temperature
    brightness: sensor.tomates_light

Database does have valid image url
https://open.plantbook.io/browse-db/?contain=Tomato+Master+No.+2+F1

HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "pid": "tomato master no. 2 f1",
    "display_pid": "Tomato Master No. 2 F1",
    "alias": "tomato",
    "max_light_mmol": 16000,
    "min_light_mmol": 4800,
    "max_light_lux": 130000,
    "min_light_lux": 3500,
    "max_temp": 32,
    "min_temp": 10,
    "max_env_humid": 70,
    "min_env_humid": 30,
    "max_soil_moist": 65,
    "min_soil_moist": 20,
    "max_soil_ec": 2000,
    "min_soil_ec": 350,
    "image_url": "https://objectstorage.ap-sydney-1.oraclecloud.com/n/sdyd5yr3jypo/b/plant-img/o/tomato%20master%20no.%202%20f1.jpg"
}

And as moisture min/max are correctly set in tooltips, i guess api is working fine
image

Does somebody have an idea ?

Hi Pulpyy,

Welcome to Hass and openplatbook community. Currently the hass component does not handle cloud based images. This is next thing I gonna work on. Stay tuned!

Hello Slaxor

Great news. Will gently wait until you release this feature.
Keep up doing this great work.
Thanks

1 Like

I made a quick and simple change which makes the integration to return image URL from API. Obviously, in the plant_card your browser will be fetching image from internet (API storage) every time you open/refresh the UI page (subject to Browser cache which should smooth things out).
You can take the updated component from my repository for now:

You can only download init.py to replace the existing in your custom_components/plant directory.
The way it works is if image attribute set to “openplantbook” then image is assigned image_url from API. E.g.:

plant:
  Hydrangea:
    species: hydrangea chinensis
    image: openplantbook
    sensors:
      moisture: sensor.miflora_moi
      temperature: sensor.miflora_tem
      conductivity: sensor.miflora_fer
      brightness: sensor.miflora_lux

I also submitted pull request to @Olen repository so hopefully it will be in there soon.

I’m also working out possibility to place both plant-card and plant-component to HACS. With Plant-card it seems pretty straight forward, but with plant components it seems a bit tricky. I’m not sure if it is possible to publish the plant component (as it is now) into HACS without breaking the link/inheritance between original plant core component. Not sure at this stage if HACS can override core components at all. If anyone can help with those I’d be grateful :slight_smile:

3 Likes

Hello.

It seems to work perfectly !


Image from database is showing up and optionally overrided by local config

Thanks

Hi all,

not sure exactly why/how - but for some reason if I update HASS (or run the config check) it tells me there is now an issue with how plant/openplantbook is implemented in my configs. Everything is working perfectly with currently installed version: core-2021.5.5

The config checker shows the error to be with the client_id portion of the config:

Testing configuration at /tmp/config
Failed config
  plant: 
    - Invalid config for [plant]: [client_id] is an invalid option for [plant]. Check: plant->plant->openplantbook->client_id. (See /tmp/config/configuration.yaml, line 8). 

This is how it is in my plants.yaml file:

# PLANTS

openplantbook:
  client_id: !secret plantbook_client_id
  secret: !secret plantbook_secret

Unfortunately I am unsure why this is broken in the newer core updates. Anyone run into this or can shed some light on what to try?

Thanks!

1 Like

I have the same issue. I filled out my client_id and secret based on the openplantbook API Credentials but get the same error.

Hello,

Mine is still running fine and is up to date, double check the config, especialy species field

tomates:
  species: tomato master no. 2 f1
  # image: /local/images/plants/tomato.jpg
  image: openplantbook
  name: Grosses tomates
  sensors:
    moisture: sensor.tomates_moisture
    conductivity: sensor.tomates_conductivity
    temperature: sensor.tomates_temperature
    brightness: sensor.tomates_light

I do not have an issue with the species when updating, the issue is with the config portion.

Can you share your config portion?

Updating completely breaks plants and I cannot seem to understand why as everything has been working for 6+ months throughout updates until the version I stated above.

Config is really basic… but here you are :frowning:

from configuration yaml:

plant: !include yaml/plant.yaml

and dedicated plant.yaml

openplantbook:
  client_id: !secret plantbook_client_id
  secret: !secret plantbook_secret

tomates:
  species: tomato master no. 2 f1
  # image: /local/images/plants/tomato.jpg
  image: openplantbook
  name: Grosses tomates
  sensors:
    moisture: sensor.tomates_moisture
    conductivity: sensor.tomates_conductivity
    temperature: sensor.tomates_temperature
    brightness: sensor.tomates_light

and card

type: custom:flower-card
entity: plant.tomates

@Pulpyy @NOTORIOUSVR,

Same with me. My issue is with the config only. Another post mentions updating the version in the manifest.json file. Could that be the cause? Is it the version of plant component or HA? (sorry if this is a simple question, I am a bit out of my element here…). Here is mine:

{
  "domain": "plant",
  "name": "Plant Monitor",
  "documentation": "https://www.home-assistant.io/integrations/plant",
  "issue_tracker": "https://github.com/Olen/homeassistant-plant/issues",
  "after_dependencies": ["recorder"],
  "codeowners": ["@ChristianKuehnel"],
  "quality_scale": "internal",
  "version": "1.04”

As for the client_id. The steps I took were to make an account on open.plantbook.io and generate an API token. I then added “plantbook_client_id:” and “plantbook_secret:” with those tokens in the secrets.yaml file. Did I miss something?

Our versions do not look the same ?

{
  "domain": "plant",
  "name": "Plant Monitor",
  "documentation": "https://www.home-assistant.io/integrations/plant",
  "issue_tracker": "https://github.com/Olen/homeassistant-plant/issues",
  "after_dependencies": ["recorder"],
  "codeowners": ["@ChristianKuehnel"],
  "quality_scale": "internal",
  "version": "0.2"
}

I think I solved my issue. I noticed that my manifest.json and strings.json where actually downloaded as “.json.txt”. I removed the “.txt” extension and seems to work now.