Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for PlantsIO Ivy smart planter #2069

Merged
merged 3 commits into from
Jul 12, 2024

Conversation

thewade
Copy link
Contributor

@thewade thewade commented Jul 1, 2024

This PR adds the PlantsIO "Ivy" Smart Planter.

Info on the device:
https://www.indiegogo.com/projects/plantsio-ivy-smart-flowerpots-endless-fun#/
https://smartplantivy.com/

Available on Amazon and AliExpress. Lots of drop shippers using various brand names.

Datapoints documented at https://gist.github.com/thewade/ef9f6014f13932bd2e77d43331e2027d

This device has a ton of sensors and config options. I haven't got them all the config done, and some enum data needs to be reverse engineered to be mapped.

Some settings like brightness should be restricted when auto brightness is on, but I wasn't able to figure out if it was possible using constraints and conditions.

I expect another PR in the future to fill in the missing details as well as constraints and conditions if they are possible, but I need a break for now.

secondary_entities:
# Sensor entities
- entity: sensor
name: Ambient light
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest to remove this name, so that pre-defined translations can be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I do that all my sensors have no names:

image

And I end up getting entity IDs like:

sensor.smart_planter
sensor.smart_planter_2
sensor.smart_planter_3

Am I doing something wrong?

This is my current code for the illuminance sensor:

  - entity: sensor
    class: illuminance
    dps:
      - id: 103
        type: integer
        name: sensor
        unit: lx
        class: measurement

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is maybe a recently introduced bug due to a side effect of the fix for #1856. It may be better for me to revert that change.
Unfortunately this was difficult to detect, as existing entity names do not change once they are setup, only newly added ones are affected.

unit: lx
class: measurement
- entity: sensor
name: Temperature
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely remove the names that are the same as class

- value: "Unknown state"
- entity: sensor
name: Humidity status
class: enum
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sensors with only two states could maybe be made into binary_sensor instead, especially if there is a relevant class defined for binary_sensor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect there to be multiple states from the "AI" derived sensors.

e.g. Good, Dry, Too humid, Too dry

However I have no been able to determine all the values in my environment, and as I see with Light status enum the values are not in order so I don't want to guess.

The developers seems to had expressed interested in home assistant status, so I have emailed them to see if they are willing to share the mapping.

type: boolean
name: switch
- entity: number
name: Brightness
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a light?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the display brightness.

- fix most enums to use integer instead of bitfield
- use volume_storage class for water level
- add absorbing state to water status
- add initilizing states from missing enums
- use binary_sensor entity and battery_charging class for charging status
- convert plant in pot to binary_sensor
- add not selected enum for plant type
- add config options for weather and weather location
@thewade
Copy link
Contributor Author

thewade commented Jul 6, 2024

I have added a commit with the following changes:

  • fix most enums to use integer instead of bitfield (some states were not mapping until I fixed it)
  • use volume_storage class for water level
  • add absorbing state to water status
  • add initializing states from missing enums
  • use binary_sensor entity and battery_charging class for charging status
  • convert plant in pot to binary_sensor
  • add not selected enum for plant type
  • add config options for weather and weather location

I haven't made the change regarding the names of known class types due the issue I am seeing and I will wait for your feedback.

@thewade
Copy link
Contributor Author

thewade commented Jul 6, 2024

  • convert plant in pot to binary_sensor

There seems to be some issue with this change as I now have an error in the logs:

This error originated from a custom integration.

Logger: custom_components.tuya_local.sensor
Source: custom_components/tuya_local/sensor.py:59
integration: Tuya Local (documentation, issues)
First occurred: 10:52:57 AM (2155 occurrences)
Last logged: 5:24:13 PM

plantios_ivy_smart_planter.yaml/Plant in pot: Unrecognized sensor device class of problem ignored

The entry:

  - entity: sensor
    name: Plant in pot
    class: problem
    category: diagnostic
    dps:
      - id: 102
        type: boolean
        name: sensor

- remove unnecessary names to allow translations to be used
- fix use of binary_sensor
- remove inappropriate class
- use target language for language names
- use light entity for display brightness
@make-all make-all merged commit 7a53bc1 into make-all:main Jul 12, 2024
4 checks passed
make-all added a commit that referenced this pull request Jul 15, 2024
timlaing pushed a commit to timlaing/tuya-local that referenced this pull request Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants