Giter VIP home page Giter VIP logo

homeassistant-plant's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

homeassistant-plant's Issues

[Question] Duplicated sensors generated by integration

When configuring a new instance of Plant Monitor you get asked for temperature/moisture/conductivity etc sensors which pre-exist and are used by the integration.

image

In entities view;
image

If I disable the Plant Monitor-generated sensors (in order to clean up the number of entities in my HASS install) the Plant card stops working.

What is the use-case for this integration to re-expose these sensors again?

Air humidity sensor instead of moisture sensor

I have two plants. One plant working well, but other plant have wrong moisture information. It get's air humidity instead of moisture.
Even if i delete plant and add again with correct sensor it's have wrong data.
Even if i delete plant and add without moisture and air humidity sensor it's have air humidity in moisture.

Low light still results in problem with "warn_low_brightness: false"

WIth below yaml, low light still results in problem

1:
  species: dypsis lutescens
  name: Guldpalm
  warn_low_brightness: false
  sensors:
    moisture: sensor.xiaomi_1_moisture
    battery: sensor.xiaomi_1_battery_level
    temperature: sensor.xiaomi_1_temperature
    conductivity: sensor.xiaomi_1_soil_conductivity
    brightness: sensor.xiaomi_1_illuminance

image

Add humidity measurement

My plant sensors (b-parasite) measure not only temperature but also humidity. It would be nice if I could integrate that measurement as well.
What they do not measure is conductivity. Maybe an option could be introduced in the card associated with this integration to replace the conductivity with humidity?

Error in external and internal url detection

Hi,

Updated to latest HA and your integration to 2.0.1, plant adding now works but I've got this error message :

Log Details (ERROR)
This error originated from a custom integration.
Logger: custom_components.plant.config_flow
Source: custom_components/plant/config_flow.py:184
Integration: Plant monitor (documentation, issues)
First occurred: 9:57:12 PM (5 occurrences)
Last logged: 10:06:08 PM

No internal or external url found. Please configure these in HA General Settings

It seems you're not detecting correctly URL in the configuration.yaml file since it is defined as shown in screenshot

Screenshot_20221023_221128

Expose what the problem is

When looking at a device, if you're not using the flower card, it is not clear as to what the problem with a plant actually is.
As per this example, there's an issue, but no indication of what it is.

This would be handy to have for automations, maybe by saying a plant needs feeding, watering, more light etc

image

Illuminance multiply

my Mi flora illuminance sensor is below the lip of the pot (measures lower lux than the leaves receive), would it be possible to multiply the sensor value with ex. 3.8 (tested with another sensor (140lux from my flora 540 from mi motion sensor))

Has anyone else found a solution to get better results ?

Remove all sensore

Hi folk, i have installed this repo but, now, i wont remove the integration end all sensor. How do it? If I try all sensor are always show in entitys.

Thk all

Failure to define species causes error during setup

If species is not included in the config file I get the following error instead of a default value being used.
Giving even a gibberish value, eg. Poo Flower for species works fine.

ERROR (MainThread) [homeassistant.setup] Error during setup of component plant
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/setup.py", line 213, in _async_setup_component
    result = await task
  File "/home/homeassistant/.homeassistant/custom_components/plant/__init__.py", line 164, in async_setup
    entity = Plant(plant_name, plant_config)
  File "/home/homeassistant/.homeassistant/custom_components/plant/__init__.py", line 244, in __init__
    self._species = self._config.get(CONF_SPECIES).lower().replace("_", " ")
AttributeError: 'NoneType' object has no attribute 'lower'

Works great otherwise
Thanks for the hard work

All plants imported as "unnamed entry"

With v2.0.0-beta.12 all of my plants are imported as "Unnamed entry" with "none" as name, which gets used in the entity generation, e.g.

  • sensor.none_air_humidity
  • sensor.none_illuminance_2

They were all in the yaml with configs like:

plant:
  dracaena_marginata:
    sensors:
      moisture: sensor.livingroom_dracaena_marginata_moisture
      temperature: sensor.livingroom_dracaena_marginata_temperature
      conductivity: sensor.livingroom_dracaena_marginata_soil_conductivity
      brightness: sensor.livingroom_dracaena_marginata_illuminance
    min_moisture: 20
    max_moisture: 60
    min_conductivity: 500
    min_temperature: 15

Unable to add plants that are not in Openplantbook

With v2.0.0-beta.12 and the OpenPlantbook API I am unable to add my "Euphorbia Trigona":

Did not find «Euphorbia Trigona» in OpenPlantbook. Using default values for thresholds.

However, clicking submit results in seeing the spinner for a while and nothing happens. The call to /api/config/config_entries/flow/xxxxx however gives a 200 yuet the response body contains the form again.

Payload:

{
   "display_pid":"Euphorbia Trigona",
   "max_moisture":60,
   "min_moisture":20,
   "max_illuminance":100000,
   "min_illuminance":0,
   "max_dli":30,
   "min_dli":2,
   "max_temperature":40,
   "min_temperature":10,
   "max_conductivity":3000,
   "min_conductivity":500,
   "max_humidity":60,
   "min_humidity":20
}

Issues comparing sensor values in Fahrenheit with min/max values in Celsius

I have my Home Assistant instance set to use Fahrenheit, so the values on my sensors come back in °F. The values in the attributes on the plant entity also come through in °F, as expected. However, it look like the min/max values on OpenPlantbook are all in Celsius and aren't converted before they are compared with the Fahrenheit values, so it reports a "problem" when it shouldn't.

image

This is pretty easy to work around by just setting min/max values in °F in the config yaml, but it could be a little cleaner if it worked automatically.

Adding new plant fail with "Unknown error occured"

Hello,

running latest HA in supervised mode on RPI4

I'm trying to add a new plant and it fails with "Unknown error occured"

image

Openplantbook and card integration are properly installed.

Extract of logs at the moment of the error :

2022-10-02 16:34:16.918 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 82, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 178, in post
return await super().post(request, flow_id)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 73, in wrapper
result = await method(view, request, data, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 280, in async_configure
result = await self._async_handle_step(
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File "/config/custom_components/plant/config_flow.py", line 184, in async_step_select_species
return await self.async_step_limits()
File "/config/custom_components/plant/config_flow.py", line 371, in async_step_limits
entity_picture = f"{get_url(self.hass, require_current_request=True)}{urllib.parse.quote(entity_picture)}"
File "/usr/src/homeassistant/homeassistant/helpers/network.py", line 201, in get_url
raise NoURLAvailableError
homeassistant.helpers.network.NoURLAvailableError

Strange error, internal and external_url are correctly configured in yaml though.

HACS compatibility

Hi @Olen

Just a very quick one, I know you mentioned earlier that you have lacked time recently.

I was looking over this recently (custom component and plant card) as I have forgotten how I have added them and what the update process is. And I have discovered that there isn't really one :)

I have added the Plant card as a custom repository via HACS, but the custom component doesn't work, as the repo does not use the required format.

Was wondering if you intend to have a look at this at some point.

By the looks of it, you will need a hacs.json file with very little info in it, and (probably the best approach) to move the module files into a subfolder. All information can be found here https://hacs.xyz/docs/publish/integration

Let me know your thought on this, it might be that i might have some time in the near future and could try to fork it and do it myself, then submit a PR.

Thanks in advance

Error after reload integration

error occur on all plants devices after reload of the integration:
(used the beta version, but recreated all plants after update to final)
File "/config/custom_components/plant/init.py", line 224, in async_setup_entry
plant.async_schedule_update_ha_state(True)
2022-08-26 18:08:53.097 ERROR (MainThread) [custom_components.plant] Platform plant does not generate unique IDs. ID 764576b4cefcb0e85cc94f7624d2c784 is already used by plant.gummibaum - ignoring plant.gummibaum
2022-08-26 18:08:53.101 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Gummibaum for plant

`image` not always set to `image_url`

This one seems to be quite intermittent and I can't seem to figure this out. I've logged everything out, and from what I can tell, the API is called successfully, and the values are being returned, however the attributes aren't being set.
As an example, image is being set as openplantbook

  avocado_plant:
    species: Persea americana
    image: openplantbook

This logs out the following and the image attribute is successfully set to the image_url

2022-04-26 11:52:44 DEBUG (MainThread) [custom_components.plant] Fetched data from https://open.plantbook.io/api/v1/plant/detail/persea americana:
2022-04-26 11:52:44 DEBUG (MainThread) [custom_components.plant] {'pid': 'persea americana', 'display_pid': 'Persea americana', 'alias': 'pear', 'max_light_mmol': 8000, 'min_light_mmol': 4200, 'max_light_lux': 76000, 'min_light_lux': 4000, 'max_temp': 35, 'min_temp': 8, 'max_env_humid': 80, 'min_env_humid': 30, 'max_soil_moist': 60, 'min_soil_moist': 15, 'max_soil_ec': 2000, 'min_soil_ec': 350, 'image_url': 'https://objectstorage.ap-sydney-1.oraclecloud.com/n/sdyd5yr3jypo/b/plant-img/o/persea%20americana.jpg'}
2022-04-26 11:52:44 DEBUG (MainThread) [custom_components.plant] Plant: avocado_plant Var: name Config: None Value: Persea americana
2022-04-26 11:52:44 DEBUG (MainThread) [custom_components.plant] Plant: avocado_plant Var: min_temperature Config: 10.0 Value: 8
2022-04-26 11:52:44 DEBUG (MainThread) [custom_components.plant] Plant: avocado_plant Var: max_temperature Config: 40.0 Value: 35
2022-04-26 11:52:44 DEBUG (MainThread) [custom_components.plant] Plant: avocado_plant Var: min_moisture Config: 20 Value: 15
2022-04-26 11:52:44 DEBUG (MainThread) [custom_components.plant] Plant: avocado_plant Var: max_moisture Config: 60 Value: 60
2022-04-26 11:52:44 DEBUG (MainThread) [custom_components.plant] Plant: avocado_plant Var: min_conductivity Config: 500 Value: 350
2022-04-26 11:52:44 DEBUG (MainThread) [custom_components.plant] Plant: avocado_plant Var: max_conductivity Config: 3000 Value: 2000
2022-04-26 11:52:44 DEBUG (MainThread) [custom_components.plant] Plant: avocado_plant Var: min_brightness Config: 0 Value: 4000
2022-04-26 11:52:44 DEBUG (MainThread) [custom_components.plant] Plant: avocado_plant Var: max_brightness Config: 100000 Value: 76000
2022-04-26 11:52:44 DEBUG (MainThread) [custom_components.plant] Plant: avocado_plant Var: image Config: openplantbook Value: https://objectstorage.ap-sydney-1.oraclecloud.com/n/sdyd5yr3jypo/b/plant-img/o/persea%20americana.jpg

image

I also have another plant though where image is set to openplantbook

  hall_plant:
    species: Pachira macrocarpa
    image: openplantbook

which logs

2022-04-26 11:52:45 DEBUG (MainThread) [custom_components.plant] Fetched data from https://open.plantbook.io/api/v1/plant/detail/pachira macrocarpa:
2022-04-26 11:52:45 DEBUG (MainThread) [custom_components.plant] {'pid': 'pachira macrocarpa', 'display_pid': 'Pachira macrocarpa', 'alias': 'pachira aquatica', 'max_light_mmol': 4700, 'min_light_mmol': 2800, 'max_light_lux': 40000, 'min_light_lux': 1200, 'max_temp': 32, 'min_temp': 10, 'max_env_humid': 85, 'min_env_humid': 30, 'max_soil_moist': 60, 'min_soil_moist': 15, 'max_soil_ec': 2000, 'min_soil_ec': 350, 'image_url': 'https://objectstorage.ap-sydney-1.oraclecloud.com/n/sdyd5yr3jypo/b/plant-img/o/pachira%20macrocarpa.jpg'}
2022-04-26 11:52:45 DEBUG (MainThread) [custom_components.plant] Plant: pachira_aquatica Var: name Config: None Value: Pachira macrocarpa
2022-04-26 11:52:45 DEBUG (MainThread) [custom_components.plant] Plant: pachira_aquatica Var: min_temperature Config: 10.0 Value: 10
2022-04-26 11:52:45 DEBUG (MainThread) [custom_components.plant] Plant: pachira_aquatica Var: max_temperature Config: 40.0 Value: 32
2022-04-26 11:52:45 DEBUG (MainThread) [custom_components.plant] Plant: pachira_aquatica Var: min_moisture Config: 20 Value: 15
2022-04-26 11:52:45 DEBUG (MainThread) [custom_components.plant] Plant: pachira_aquatica Var: max_moisture Config: 60 Value: 60
2022-04-26 11:52:45 DEBUG (MainThread) [custom_components.plant] Plant: pachira_aquatica Var: min_conductivity Config: 500 Value: 350
2022-04-26 11:52:45 DEBUG (MainThread) [custom_components.plant] Plant: pachira_aquatica Var: max_conductivity Config: 3000 Value: 2000
2022-04-26 11:52:45 DEBUG (MainThread) [custom_components.plant] Plant: pachira_aquatica Var: min_brightness Config: 0 Value: 1200
2022-04-26 11:52:45 DEBUG (MainThread) [custom_components.plant] Plant: pachira_aquatica Var: max_brightness Config: 100000 Value: 40000
2022-04-26 11:52:45 DEBUG (MainThread) [custom_components.plant] Plant: pachira_aquatica Var: image Config: openplantbook Value: https://objectstorage.ap-sydney-1.oraclecloud.com/n/sdyd5yr3jypo/b/plant-img/o/pachira%20macrocarpa.jpg

image

I know these lines are setting the values, however I've logged the values out and can see that they are correct

        if var == 'image' and self._image == 'openplantbook':
            self._image = val

however I'm wondering if there is some other logic later on that then overwrites it . This issue impacts all attributes that should be populated by the API. Possibly the async_setup function is running, but gets overwritten somewhere after?

Plant Threshold Editing

In the images it looks like the threshold entities should be editable from the device? Mine are not - but can be updated in the state editor...do i just have a slightly older/beta 2.0? is there a specific component file to replace in my folder that will allow the editing from the device page?

not syncing plant

hello i have 3 mi flower plants

Xiaomi BLE gives data for all 3 plants,
but plant monitor do not give data for one of them : pl-rosa-marie
(this plant is on the balcony far from bluetooth reciever, but it gives data sometimes in Xiaomi BLE, but never in Plant Monitor)

how can i debug this please ?

Xiaomi BLE : OK

type: vertical-stack
cards:
  - type: entities
    entities:
      - entity: sensor.fl_dischidia_conductivity
        name: Conductivity
      - entity: sensor.fl_dischidia_illuminance
        name: Illuminance
      - entity: sensor.fl_dischidia_moisture
        name: Moisture
      - entity: sensor.fl_dischidia_temperature_2
        name: Temperature
    title: fl-dischidia
    state_color: true
  - type: entities
    entities:
      - entity: sensor.fl_rhipsalis_conductivity_2
        name: Conductivity
      - entity: sensor.fl_rhipsalis_illuminance_2
        name: Illuminance
      - entity: sensor.fl_rhipsalis_moisture_2
        name: Moisture
      - entity: sensor.fl_rhipsalis_temperature
        name: Temperature
    title: fl-rhipsalis
    state_color: true
  - type: entities
    entities:
      - sensor.fl_rosa_marie_illuminance
      - sensor.fl_rosa_marie_moisture
      - sensor.fl_rosa_marie_temperature
      - sensor.fl_rosa_marie_conductivity
    title: fl-rosa-marie
    state_color: true

Plant Monitor : NOK

type: vertical-stack
cards:
  - type: entities
    entities:
      - entity: sensor.pl_dischidia_air_humidity
        name: Air humidity
      - entity: sensor.pl_dischidia_conductivity
        name: Conductivity
      - entity: sensor.pl_dischidia_dli
        name: Dli
      - entity: sensor.pl_dischidia_illuminance
        name: Illuminance
      - entity: sensor.pl_dischidia_soil_moisture
        name: Soil moisture
      - entity: sensor.pl_dischidia_temperature
        name: Temperature
    title: pl-dischidia
  - type: entities
    entities:
      - entity: sensor.pl_rhipsalis_air_humidity
        name: Air humidity
      - entity: sensor.pl_rhipsalis_conductivity
        name: Conductivity
      - entity: sensor.pl_rhipsalis_dli
        name: Dli
      - entity: sensor.pl_rhipsalis_illuminance
        name: Illuminance
      - entity: sensor.pl_rhipsalis_soil_moisture
        name: Soil moisture
      - entity: sensor.pl_rhipsalis_temperature
        name: Temperature
    title: pl-rhipsalis
  - type: entities
    entities:
      - entity: sensor.pl_rosa_marie_air_humidity
        name: Air humidity
      - entity: sensor.pl_rosa_marie_conductivity
        name: Conductivity
      - entity: sensor.pl_rosa_marie_dli
        name: Dli
      - entity: sensor.pl_rosa_marie_illuminance
        name: Illuminance
      - entity: sensor.pl_rosa_marie_soil_moisture
        name: Soil moisture
      - entity: sensor.pl_rosa_marie_temperature
        name: Temperature
    title: pl-rosa-marie

2022-08-17_102600
2022-08-17_102617
2022-08-17_102807
2022-08-17_103430

Statistics Error

Hello,

Since upgradeing to version 2, i constantly get these errors in the home assistant log:

Aug 21 08:10:10 xeon.lan python3[1235427]: 2022-08-21 08:10:10.476 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: (MySQLdb.OperationalError) (1366, "Incorrect string value: '\\xE2\\x8B\\x85m\\xC2\\xB2' for column `homeassistant`.`statistics_meta`.`unit_of_measurement` at row 1")
Aug 21 08:10:10 xeon.lan python3[1235427]: [SQL: INSERT INTO statistics_meta (statistic_id, source, unit_of_measurement, has_mean, has_sum, name) VALUES (%s, %s, %s, %s, %s, %s)]
Aug 21 08:10:10 xeon.lan python3[1235427]: [parameters: ('sensor.pfefferoni_dli', 'recorder', 'mol/d⋅m²', 0, 1, None)]
Aug 21 08:10:10 xeon.lan python3[1235427]: (Background on this error at: https://sqlalche.me/e/14/e3q8)
Aug 21 08:10:10 xeon.lan python3[1235427]: 2022-08-21 08:10:10.477 WARNING (Recorder) [homeassistant.components.recorder.util] Error executing statistics: (MySQLdb.OperationalError) (1366, "Incorrect string value: '\\xE2\\x8B\\x85m\\xC2\\xB2' for column `homeassistant`.`statistics_meta`.`unit_of_measurement` at row 1")
Aug 21 08:10:10 xeon.lan python3[1235427]: [SQL: INSERT INTO statistics_meta (statistic_id, source, unit_of_measurement, has_mean, has_sum, name) VALUES (%s, %s, %s, %s, %s, %s)]
Aug 21 08:10:10 xeon.lan python3[1235427]: [parameters: ('sensor.pfefferoni_dli', 'recorder', 'mol/d⋅m²', 0, 1, None)]
Aug 21 08:10:10 xeon.lan python3[1235427]: (Background on this error at: https://sqlalche.me/e/14/e3q8)
Aug 21 08:10:14 xeon.lan python3[1235427]: 2022-08-21 08:10:14.096 WARNING (SyncWorker_1) [homeassistant.c

The error was also there for the total_ppfd and ppfd sensors, after adding them to the recorder exclude no more problems.

Integration error setting up a new plant from scratch

Hi,

I have just installed this and have the OpenPlantbook integration working properly (tested with the service call and it is returning results as expected). I installed from scratch, so I did not have any plants configured in my configuration.

If I set up a plan using the integration without a species, I get a "uknown error" on top of the screen.
If I fill in the species, it looks up the plant on the OpenPlantbook database, shows me a screen where I can select the correct species, but if I continue I get an error.

In my HASS log I can see this error being triggered anytime I try to set up a plant:

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 82, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 178, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 73, in wrapper
    result = await method(view, request, data, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 280, in async_configure
    result = await self._async_handle_step(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/plant/config_flow.py", line 115, in async_step_user
    return await self.async_step_select_species()
  File "/config/custom_components/plant/config_flow.py", line 190, in async_step_select_species
    return await self.async_step_limits()
  File "/config/custom_components/plant/config_flow.py", line 371, in async_step_limits
    entity_picture = f"{get_url(self.hass, require_current_request=True)}{urllib.parse.quote(entity_picture)}"
  File "/usr/src/homeassistant/homeassistant/helpers/network.py", line 201, in get_url
    raise NoURLAvailableError
homeassistant.helpers.network.NoURLAvailableError

I tried just for the sake of it to try and config a plant in my configuration using the HASS native integration, and this integration successfully picked it up, so I am not sure what exactly is going wrong here.

Any advice or anything I can do help figure this out, if it is a bug?

min_dli and max_dli derived from openplantbook not the same

I think the conversion from the openplantbook values for min_light_mmol and max_light_mmol to your min_dli and max_dli are not corresponding. Please correct me if I'm wrong.

For example my plant: Pellaea Rotundifolia
Min_light_mmol: 400
Max_light_mmol: 700

Converting millimol to mol would result in 0,4 mol and 0,7 mol

Your values:

Min_dli: 1 mol
Max_dli: 3 mol

With these differences my flower care app states that my plant have already accumulated enough sunlight while your integration still states not nearly enough.

Screenshot_20221112-131400_Firefox

Screenshot_20221112-130219_Firefox

Screenshot_20221112-130101_Flower Care

Screenshot_20221112-125859_Home Assistant

Screenshot_20221112-125908_Home Assistant

Converting your current dli value from the utility meter and the integral meter from mol to millimol it comes close to the accumulated value from the flower care app, so that is not the problem.

Flower care app: 459 millimol
Your dli: 0,51 mol = 510 millimol

It's just the min_dli and max_dli that don't compare.

Can it be that you misread the openplantbook values for umol (micromol)?

[Feature request] Add possibility to change sensor

Love the integration together with the Plant card! Awesome work with the redesign!

I hade not set the air humidity sensor (left blank) and I could not find how to set it once it's setup.
The only possibility I have found was to delete the wohle plant and readd it with a humidity sensor

I could find the text when configuring "If you can't find the correct sensors in the dropdown menus, sensors can be added after the plant is set up". But how am I doint this? When I edit a plant in the integration menu I can only add the triggers for a problem, species and picture but not the sensors.

Can you please make that edditable or am I missing something?

No images showing

Just added this integration with the flower card that you've developed.

I've had a look in the plant database and the plants I added have images listed in the database, however the images appear to be broken in the dashboard, they all point to the local fallback folder so it seems like the plants aren't pulling the correct image location from the db?

Unable to set local plant image

If I try to configure a local plant image the entity_picture attribute of the plant entity stays empty and no picture is displayed on the card. If I set an online https image it works without problems.

For example, my image is located at config/www/images/plants/zamioculcaszamiifolia.jpg and among others I tried setting these paths:

/config/www/images/plants/zamioculcaszamiifolia.jpg
/local/images/plants/zamioculcaszamiifolia.jpg
'/local/images/plants/zamioculcaszamiifolia.jpg'
"/local/images/plants/zamioculcaszamiifolia.jpg"

Possible problem with image retrieval

Have updated both the integration and the frontend card, upgrade worked pretty well.

However, I don't seem to have images. Even though the species migrated across correctly and has been manually verified. If I manually populate the URL from openplantbook, then it displays with the card.

Using beta5 of the card and v2.0.0-beta.11 of the integration.

LvlCaT0y

tkhhsR0P

Species and Species to display set to:

dionaea muscipula

No check_days implementation?

Hey, I'm getting the light intensity warning at all times... I think the original plant implementation uses check_days to build an average (although I'm not completely sure that's how it works). Is there a way to get that working with this version, rather than just turning off light warnings altogether? Thx

The integration cannot find user defined plants from open.plantbook.io

Hi @Olen,

First of all, thank you for your awesome integrations and for the time you put in to make them even better in the recent weeks.

User defined plants on open.plantbook.io are not returned when trying to add a plant and the below error is returned in the logs of HA.
Tested with v2.0.0-beta.3.
This was not an issue in v1.

Thanks in advance for your help in getting this issue sorted.

Log Details (ERROR)
This error originated from a custom integration.
Logger: aiohttp.server
Source: custom_components/plant/config_flow.py:172
Integration: Plant monitor ([documentation](https://github.com/Olen/homeassistant-plant/), [issues](https://github.com/Olen/homeassistant-plant/issues))
First occurred: 09:01:56 (3 occurrences)
Last logged: 09:08:30

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 82, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 177, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 73, in wrapper
    result = await method(view, request, data, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 109, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 277, in async_configure
    result = await self._async_handle_step(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 359, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/plant/config_flow.py", line 172, in async_step_select_species
    self.plant_info[ATTR_SPECIES] = user_input[ATTR_SPECIES]
KeyError: 'species'

Sensor dropdown for moisture to restricted

Only for Version 2

When adding a new plant, the dropdown for moisture sensor is restricted to "humidity" device class.
This restriction should be removed.

Workaround:

Add the plant first without moisture sensor, then use the replace sensor service call to add it after the plant is created.

Strange tiling of plant cards.

I'm aware this isn't the perfect place to be posting issues about the card, but there's no issue tracker on that repo.

I'm seeing some funny issues with the tiling of the plant card. On this monitor I should be seeing 3 columns, but on views with the plant card I only ever see a max of 2. Does anyone have any ideas why this may be happening? I don't think it's my setup since other views show the 3 columns fine.

Plant cards

Thanks.

KeyError: 'species' during migration

After updating from Version 1.0.0 to Version 2.0.0-beta2 I get the following error.

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 235, in _async_setup_component
    result = await task
  File "/config/custom_components/plant/__init__.py", line 115, in async_setup
    await async_migrate_plant(hass, plant, config[DOMAIN][plant])
  File "/config/custom_components/plant/__init__.py", line 136, in async_migrate_plant
    plant_config = await plant_helper.generate_configentry(config=config)
  File "/config/custom_components/plant/plant_helpers.py", line 174, in generate_configentry
    jpeg_exists = cv.isfile(f"{DEFAULT_IMAGE_PATH}{config[ATTR_SPECIES]}.jpg")
KeyError: 'species'

My configuration.yml.

plant:
  openplantbook:
    client_id: abc123
    secret: abc123

  plant_couch:
    species: "spathiphyllum 'coco cupido'"
    image: openplantbook
    sensors:
      moisture: sensor.p1m
      conductivity: sensor.p1c
      temperature: sensor.p1t
      brightness: sensor.p1i

  plant_gluecksfeder:
    species: "zamioculcas zamiifolia"
    image: openplantbook
    sensors:
      moisture: sensor.p2m
      conductivity: sensor.p2c
      temperature: sensor.p2t
      brightness: sensor.p2i

  plant3:
    species: "ficus elastica"
    image: openplantbook
    sensors:
      moisture: sensor.p3m
      conductivity: sensor.p3c
      temperature: sensor.p3t
      brightness: sensor.p3i

  plant4:
    species: "monstera deliciosa"
    image: openplantbook
    sensors:
      moisture: sensor.p4m
      conductivity: sensor.p4c
      temperature: sensor.p4t
      brightness: sensor.p4i

  plant5:
    species: "dracaena deremensis 'warneckii'"
    image: openplantbook
    sensors:
      moisture: sensor.p5m
      conductivity: sensor.p5c
      temperature: sensor.p5t
      brightness: sensor.p5i

  plant6:
    species: "bambusa multiplex"
    image: openplantbook
    sensors:
      moisture: sensor.p6m
      conductivity: sensor.p6c
      temperature: sensor.p6t
      brightness: sensor.p6i

  # Goldene Efefute
  plant7:
    species: "epipremnum aureum"
    image: openplantbook
    sensors:
      moisture: sensor.p7m
      conductivity: sensor.p7c
      temperature: sensor.p7t
      brightness: sensor.p7i

  plant8:
    species: "ficus microcarpa bonsai"
    image: openplantbook
    sensors:
      moisture: sensor.p8m
      conductivity: sensor.p8c
      temperature: sensor.p8t
      brightness: sensor.p8i

  plant9_2:
    #species: "zamioculcas zamiifolia" # plant9: Glücksfeder Schlafzimmer
    #species: "ficus elastica" # plant9-1: Gummibaum Gang
    species: "euphorbia leuconeura"
    image: openplantbook
    sensors:
      moisture: sensor.p9m
      conductivity: sensor.p9c
      temperature: sensor.p9t
      brightness: sensor.p9i

Sensor value for min_moisture

Maybe i do something wrong, but i am not able to put a (statistics) sensor value for min_moisture like this

min_moisture: {{ states('sensor.max_feuchtigkeit_sensor_1') | int / 2 }}

my goal is to warn whenever the waterlevel is below half the max moisture.
I created a statistics sensor which does work. But when i paste this in the .yaml the plant cards don't show. There is no error in the logs asswell.

Feature request: expose overall problem state for device automation

I want to create an automation and use the plants problem state as a trigger and I would assume getting a notification, if there is a problem with the plant would be a popular use case. However, if I choose a device trigger and select the plant ("Imperial White" in this example), only value changes are selectable:
image

It would be very convenient to also have the option "plant status changed to problem", which then depends on which sensors are configured as problem triggers in the device options.

The only way to currently achieve this is to set an entity trigger and set the "from" and "to" fields to "ok" and "problem" (I actually haven't tested this yet). This is less elegant and less intuitive than the previously suggested method, where people would just select it in a dropdown menu.

cannot import name 'States'

Hello

After core update to 2022.7, plant is broken
Component error: plant - cannot import name 'States' from 'homeassistant.components.recorder.models' (/usr/src/homeassistant/homeassistant/components/recorder/models.py)

Rollback to 2022.6.7 works again
Obviously, plant is up to date.

Integration doesn't pickup sensor data

I used the integration with some ESPHome USB hubs where I defined every sensor by hand.

With the release of the bluetooth proxy functionality I migrated everything to bluetooth proxys and integrated the MiFlora sensors with the native integration.

The sensor values are fetched by home assistant and are displayed in the device overview.

Then I deleted all the plants and created them again via UI. I used the new sensor entities and the plants are created successfully but they dont use the sensor values. They are shown as unknown.

In the core.config_entities the correct sensor entities are stored.

I don't know how I could start debugging.

German translation

Here is a german translation for your component.

{
  "title": "Plant monitor",
  "config": {
    "step": {
      "user": {
        "title": "Eine Pflanze konfigurieren",
        "description": "Wenn Sie in den Dropdown-Menüs nicht die richtigen Sensoren finden, können Sie die Sensoren nach Abschluss der Installation hinzufügen",
        "data": {
          "name": "Pflanzenname",
          "species": "Sorte",
          "temperature_sensor": "Temperatursensor",
          "moisture_sensor": "Bodenfeuchtesensor",
          "conductivity_sensor": "Leitfähigkeitssensor",
          "illuminance_sensor": "Beleuchtungsstärkesensor",
          "humidity_sensor": "Luftfeuchtigkeitssensor"
        },
        "data_description": {
          "species": "Wird für die Suche in OpenPlantbook verwendet"
        }
      },
      "select_species": {
        "title": "Sorte aus OpenPlantbook auswählen",
        "description": "{desc}",
        "data": {
          "species": "Sorte"
        },
        "menu_options": {
          "user": "Zurück"
        }
      },
      "limits": {
        "title": "Grenzwerte festlegen",
        "description": "# {name}\n![Plant]({entity_picture}){br}\n{extra_desc}Temperatureinheit ist  {temperature_unit}",
        "data": {
          "right_plant": "Das ist die Pflanze, die ich gesucht habe",
          "display_pid": "Anzuzeigende Pflanzenarten",
          "max_moisture": "Maximale Bodenfeuchtigkeit (%)",
          "min_moisture": "Minimale Bodenfeuchtigkeit (%)",
          "max_illuminance": "Maximale Beleuchtungsstärke (lx)",
          "min_illuminance": "Minimale Beleuchtungsstärke (lx)",
          "max_dli": "Maximale DLI (mol/d⋅m²)",
          "min_dli": "Minimale DLI (mol/d⋅m²)",
          "max_temperature": "Maximale Temperatur (siehe oben)",
          "min_temperature": "Minimale Temperatur (siehe oben)",
          "max_conductivity": "Maximale Leitfähigkeit (uS/cm)",
          "min_conductivity": "Minimale Leitfähigkeit (uS/cm)",
          "max_humidity": "Maximale Luftfeuchtigkeit (%)",
          "min_humidity": "Minimale Luftfeuchtigkeit (%)",
          "entity_picture": "Bild-URL"
        }
      }
    }
  },
  "options": {
    "step": {
      "init": {
        "title": "Optionen",
        "description": "",
        "data": {
          "check_days": "Beleuchtungsstärke-Kontrolltage",
          "species": "Species",
          "force_update": "Aktualisierung der Daten aus OpenPlantbook erzwingen",
          "display_pid": "Anzuzeigende Pflanzenarten",
          "temperature_sensor": "Temperatursensor",
          "moisture_sensor": "Bodenfeuchtesensor",
          "conductivity_sensor": "Leitfähigkeitssensor",
          "illuminance_sensor": "Beleuchtungsstärkesensor",
          "humidity_sensor": "Luftfeuchtigkeitssensor",
          "entity_picture": "Bild-URL. Wird automatisch aktualisiert, wenn die Art in OpenPlantbook gefunden wird",
          "illuminance_trigger": "Beleuchtungsstärke als Problemauslöser verwenden",
          "dli_trigger": "Tägliches Lichtintegral (dli) als Problemauslöser verwenden",
          "humidity_trigger": "Luftfeuchtigkeit als Problemauslöser verwenden",
          "conductivity_trigger": "Leitfähigkeit als Problemauslöser verwenden",
          "moisture_trigger": "Bodenfeuchte als Problemauslöser verwenden",
          "temperature_trigger": "Temperatur als Problemauslöser verwenden"
        }
      }
    }
  }
}

missing timezone information Error since 2021.12

Exception in message_received when handling msg on 'sensor/plants/plant1/': '{"battery": 67, "temperature": "18.1", "brightness": 195, "moisture": 21, "conductivity": 171, "timestamp": "2021-12-16T00:30:05.497001"}' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 37, in wrapper msg_callback(msg) File "/usr/src/homeassistant/homeassistant/components/mqtt/sensor.py", line 249, in message_received self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 505, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _async_write_ha_state state = self._stringify_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 511, in _stringify_state if (state := self.state) is None: File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 411, in state raise ValueError( ValueError: Invalid datetime: sensor.plant1_timestamp provides state '2021-12-16 00:30:05.497001', which is missing timezone information

Integration error after replace_sensor

After running replace_sensor on one of my plants the integration started failing:

Logger: homeassistant.config_entries
Source: helpers/entity_component.py:157
First occurred: 19:23:18 (18 occurrences)
Last logged: 19:23:18

Error setting up entry Dieffenbachia for sensor
Error setting up entry Dracaena marginata for sensor
Error setting up entry Office sansevieria mikado for sensor
Error setting up entry Tabaksplant for sensor
Error setting up entry Dracaena for sensor
Traceback (most recent call last):
  File "/srv/hass/lib/python3.10/site-packages/homeassistant/config_entries.py", line 357, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/srv/hass/lib/python3.10/site-packages/homeassistant/components/number/__init__.py", line 119, in async_setup_entry
    return await component.async_setup_entry(entry)
  File "/srv/hass/lib/python3.10/site-packages/homeassistant/helpers/entity_component.py", line 157, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!
Logger: custom_components.plant
Source: helpers/entity_platform.py:520
Integration: Plant monitor ([documentation](https://github.com/Olen/homeassistant-plant/), [issues](https://github.com/Olen/homeassistant-plant/issues))
First occurred: 19:21:43 (18 occurrences)
Last logged: 19:23:18

Platform plant does not generate unique IDs. ID xxxxxxxxxxxxxx is already used by plant.dieffenbachia - ignoring plant.dieffenbachia
Platform plant does not generate unique IDs. ID xxxxxxxxxxxxxxis already used by plant.dracaena_marginata - ignoring plant.dracaena_marginata
Platform plant does not generate unique IDs. ID xxxxxxxxxxxxxxis already used by plant.office_sansevieria_mikado - ignoring plant.office_sansevieria_mikado
Platform plant does not generate unique IDs. ID xxxxxxxxxxxxxxis already used by plant.tabaksplant - ignoring plant.tabaksplant
Platform plant does not generate unique IDs. ID xxxxxxxxxxxxxxis already used by plant.dracaena - ignoring plant.dracaena
Logger: homeassistant.config_entries
Source: custom_components/plant/__init__.py:255
Integration: Plant monitor ([documentation](https://github.com/Olen/homeassistant-plant/), [issues](https://github.com/Olen/homeassistant-plant/issues))
First occurred: 19:21:43 (18 occurrences)
Last logged: 19:23:18

Error setting up entry Dieffenbachia for plant
Error setting up entry Dracaena marginata for plant
Error setting up entry Office sansevieria mikado for plant
Error setting up entry Tabaksplant for plant
Error setting up entry Dracaena for plant
Traceback (most recent call last):
  File "/srv/hass/lib/python3.10/site-packages/homeassistant/config_entries.py", line 357, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/home/hass/.homeassistant/custom_components/plant/__init__.py", line 154, in async_setup_entry
    await _plant_add_to_device_registry(hass, plant_entities, device_id)
  File "/home/hass/.homeassistant/custom_components/plant/__init__.py", line 255, in _plant_add_to_device_registry
    erreg.async_update_entity(entity.registry_entry.entity_id, device_id=device_id)
AttributeError: 'NoneType' object has no attribute 'entity_id'

After a reboot everything was fine again.

Entity is using native unit of measurement 'None' which is not a valid unit for the device class

I have the following errors in Core since upgrading to 2023.1:

Entity sensor.plant_14_air_humidity (<class 'custom_components.plant.sensor.PlantCurrentHumidity'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('humidity') it is using; Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.
Entity sensor.plant_15_illuminance (<class 'custom_components.plant.sensor.PlantCurrentIlluminance'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('illuminance') it is using; Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.
Entity sensor.plant_15_soil_moisture (<class 'custom_components.plant.sensor.PlantCurrentMoisture'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('moisture') it is using; Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.
Entity sensor.plant_15_temperature (<class 'custom_components.plant.sensor.PlantCurrentTemperature'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('temperature') it is using; Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.
Entity sensor.plant_15_air_humidity (<class 'custom_components.plant.sensor.PlantCurrentHumidity'>) is using native unit of measurement 'None' which is not a valid unit for the device class ('humidity') it is using; Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.

It appears there were some sensor changes in this release.

Feature: Battery entity/Signal strength

Since the new BLE implementation in HA (2022.8), the MiFlora devices (HHCCJCY01) report their battery status and signal strength (yay!). It would be great to have the battery/rssi as part of the plant device, so it is easier to see which plant needs a new battery. From a theoretical perspective I understand these entities are not necessarily biological properties of plants, but of the sensor device. But the convenience of having all these properties as part of the plant imo outweighs this.

Motivation: Now we have to keep the link between which plant has which battery sensor in the home-assistant plant integration, as well as in the Flower-card's battery_sensor property , which IMO is a bit of a pain and redundant. Integrating the battery as part of the plant device would allow the flower-card to just grab the battery data from the plant device.

Image defaults to local .jpg.jpg

Even though image URL is provided by database, the card points to:
http://server:8123/local/images/plants/acanthus%20ilicifolius.jpg.jpg
(tested with acanthus ilicifolius)

Also it points to a double .jpg extension.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.