Plant tracker with AppDaemon

Hello everyone!
I have made a “plant tracker” with AppDaemon. I use it to keep (manually) track of when my plants need water and thought it might be of use for others too. It is basically a simple habit tracker/reminder for watering plants. I find this especially useful for plants that needs water less than every week (partly because of my bad memory :sweat_smile:) and to monitor how often the individual plants actually needs water.

This is an example of my script together with @RomRider 's button card(colors represents state, number are days since watered):

Info-dialog:

How it works: Each plant is configured with a watering interval and a watering window (optional). The script creates a sensor for each plant you want to track. The colors in the picture represents the four different states available. The way I use them is something like; blue: watered today, green: does not need water, brown: should be checked/can be watered, red: needs water. The states are updated every day at a chosen time or when you press the button (when you have watered a plant).

I have posted the code and explained the set up here: https://github.com/mountwebs/ha-plant-tracker

I am learning python and this is the first time I share my code. All suggestions for improvements or advice is welcome!

Edit: Added photo.

8 Likes

This is very nice! I bought a bunch of Xiaomi soil sensors some time ago, but my wife surprisingly doesn’t want to have anything to do with helping me set it up. I figured I could do something like this to help me schedule extra or longer watering sessions with our drip system. This would be perfect. This gives me motivation to try again.

@BrianHanifin
Nice! It Shouldn’t be hard to combine this with some IoT-solutions. I also have a soil sensor and a diy watering machine lying around, and was thinking I would integrate it with the tracker at some point.

@mountwebs Thank you very much for the app. Any updates on this, as I am unable to integrate to love lace using RomRider’s button card. I think lots has changed ever-since this was first developed. Any idea if I can integrate it with any other card system? Any help is appreciated.

Hi all,

I’ve gotten this mostly working using Mushroom Entity cards, however my issue is that I can’t seem to figure out how to successfully call the watered script (water.py in @mountwebs setup). I have a button set up in a Browser Mod popup to call it and every time I press it nothing happens. No error message, nothing I can see in the logs, and nothing updates.

Here’s the workflow:

  1. I select my plant entity card (Big Ben)
  2. A popup opens with a button to run the script (Watered Big Ben)
  3. Selecting the button calls /config/python_scripts/plantWater (plantWater.py is my water.py script)
  4. I have the script living at this location in my file setup. I haven’t changed anything MountWebs’ code, just the script name and references to the name.

Once I get this working I’d love to share it with you all because this project is really cool! I just need help getting there :slight_smile:


Hey GreyBandit,

Did you get any further with your problem?

I got no solution for your problem, but maybe you have one for mine.
I setted up the script in appdaemon with a test plant. But I got the issue that the plant is not saved in the plants.db. So now everytime I restart Appdeamon or HA itself the date lastwatered gets resetted to today. :frowning:

Greets

Hi there!

I’m sorry that I haven’t got around to answer any of you before now. I am still running this successfully on my home assistant, and I have also installed it again as I started a new home assistant from scratch one and a half years ago. The setup is just creating a simple service, so it should be straight forward to trigger it in another way than via the button card. I will set this up in another separate instance. It is possible that something has changed or that there is something wrong with my guide.

@GreyBandit did you have the same issue as @andy_arbeit? Does the script write anything to plant.db? @andy_arbeit it might be a permission issue. Is plant.db created at all? If not, you might have to just create the file.

1 Like

I think my issue is a little different than andy_arbeit’s. Once I defined the plants in the yaml file they showed up in the db file. Since then, I haven’t been able to get the script to update the db file whenever I select a button linked to the script. :frowning: I wouldn’t be surprised if I have something simple messed up in my setup…

Since this is my first attempt with appdaemon I could have made a major mistake configuring it?

Here are the steps I took:

  • I am using home assistant as an virtual machine
  • I installed AppDaemon via the addon section
  • I had to create the apps folder and apps.yaml and the appdaemon.yaml by myself
  • then I dropped planttracker.py in it

This is the code of my appdaemon.yaml

appdaemon:
  time_zone: Europe/Berlin
  latitude: xx.81932775822483
  longitude: xx.893040658371874
  elevation: 0
  plugins:
    HASS:
      type: hass
      ha_url: http://192.168.xxx.xx:8123
      token: eyJhbGciOiJIUzI1N......................
      app_init_delay: 20
http:
  url: http://192.168.xxx.xx:5050
  transport: socketio

This is the code of the apps.yaml:

plant_tracker:
  module: PlantTracker
  class: PlantTracker
  file: /config/appdaemon/apps/plants.db
  plants:
    Limette:
      friendly_name: Limette
      watering_interval: 2
      icon: mdi:leaf
      watering_window: 1
    Minze:
      friendly_name: Minze
      watering_interval: 4
      icon: mdi:leaf
      watering_window: 1