Skip to content

jwardbond/forecats

Repository files navigation

Forecats

Wake up every morning (more) excited to look at the forecast! This is a custom Home Assistant integration which uses forecast data, pictures of your pets, and Google's Nano Banana API to generate and serve weather-themed drawings of your precious babies every morning.

Blog post here.

A picture of two cats and a snowy, cloudy forecast combine to make a drawing of two cats in scarves looking out a window

Features

  • Home assistant integration to generate pictures
  • Customizable automation template to control drawing styles, generation times, etc.
  • Optional optimization for E-ink screens (currently limited to spectra6 panels)

Examples

You can display it on an e-ink screen

A cat in front of an e-ink screen

Or on your HA Dashboard

Home Assistant app screenshot

Works in better weather

Two cats with sunglasses

Getting Started

Warning

This will cost money. You get (I think) $300 of Gemini credits upon sign up, but eventually you will have to pay ~$0.14 every time this runs.

Requirements

Setup

Do the following in your HA server, using the Terminal & SSH addon, or docker exec if you are running a container on a host system

  1. Create the necessary directory structure in your Home Assistant server:
mkdir /config/custom_components && mkdir -p /config/forecats_data/input_images
  1. Select and upload cat images
  • Choose good pictures of your pets.
  • Rename the files so the pets' names are in the filenames.
  • Upload them to /config/forecats_data/input_images.
  1. Download the repo
cd /config/custom_components && git clone https://github.com/jwardbond/forecats.git
  1. Enable the custom integration by adding forecats: to your configuration file:
# configuration.yaml

default_config:

# ...existing data

automation: !include automations.yaml

forecats:
  1. Set up the automation using the automation template (add to config/automations.yaml).
  • Make sure to fill out (or remove) any <> in the template.
  1. Restart your server

That's it! Every morning at 5:00 am, the forecats integration will generate the following images in the config/www/daily_forecats/ directory:

  • forecats_original.png: the unprocessed output image from Gemini
  • forecats_optimized.png: the output image cropped to your desired size and adjusted for display on your screen (currently only supports color adjustments for Spectra6 e-ink)

These images should be accessible on your local network at (e.g.): <YOUR HA URL>/local/daily_forecats/forecats_original.png

Note

It takes 10-30 seconds for gemini to generate the image. If you have any automations grabbing the image, then I recommend setting them to run a minute after the generate forecats autmation is set to run.

Note

To test the automation, go to developer tools > actions > generate forecats and run it manually.

Local Testing

I got annoyed testing out new prompts on HA, so I made a folder to experiment locally. If you would like to use it:

  1. Clone the repo and enter the testing folder:
git clone https://github.com/jwardbond/forecats.git && cd forecats/local_testing
  1. Add your cat images to the forecats_data/input_images folder.
  2. Create a .env file with your Gemini API key.
  3. Copy the data from your automation into test.py.
  4. Run:
uv run test.py

(Optional) Sending to an e-ink screen

You will need a screen controllable with ESPHOME. I used seeed studio's e10002 spectra6 display. I've included the esphome config I use here. The basic idea is to set the automation to run every day at a 5:00 am, and have the screen wake up every day slightly before that, download the picture at 5:01 am (to leave time to generate), and then go into deep sleep until the next day.

TODO

  • Enrol in HACS for easier install
  • Option to save images to dir
  • Make automation into blueprint for easier install
  • Separate e-ink instructions
  • See if I can make it more configurable from GUI
  • Support for multiple cities

About

Daily cat pictures on your home assistant server

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages