Let your plant twitter if it needs to be watered

You often forget to water your plants? We already created a guide how to make sure you will be informed to water your plant when you’re coming home. But let’s try something that is a bit crazier! Wouldn’t it be cool if your plant would have it’s own Twitter account and tell you what to do?

What you need

  • one or more Mi Flora Plant sensors
  • a Raspberry Pi or PC running Home Assistant
  • a Twitter account

Installing the software

The base configuration of the Mi Plant sensor has been documented in our first flower sensor article.

Configuring the Twitter integration

If you have already a twitter account, go to apps.twitter.com and create a new App. You need to input some data and then you will get the consumer key/secret and you can create an access token.

Now, configure a notifier in your configuration.yaml file as follows:

notify:
  name: pflanzentwitter
  platform: twitter
  consumer_key: xxxxxxxxx
  consumer_secret: xxxxxxxx
  access_token: xxxxxxxx
  access_token_secret: xxxxxxx

Just copy the tokens from the developer web site into the configuration.

Create some twitter rules

Now, it your turn to find some cool post for your plant. Here is an example that I use. I’ve create a seperate automations.yaml file, that will be included in the main configuration:

- alias: Basil - sunny
  trigger:
    platform: numeric_state
    entity_id: sensor.basilikum_light_intensity
    above: 9800
  action:
    service: notify.pflanzentwitter
    data:
      message: "Basil: Nice sunny day today \U0001f60e"

- alias: Basil - dark
  trigger:
    platform: numeric_state
    entity_id: sensor.basilikum_light_intensity
    below: 100
  action:
    service: notify.pflanzentwitter
    data:
      message: "Basil: It's getting dark outside, good night! \U0001f303"

- alias: Basil - first light
  trigger:
    platform: numeric_state
    entity_id: sensor.basilikum_light_intensity
    above: 100
  action:
    service: notify.pflanzentwitter
    data:
      message: "Basil: Good morning! \U0001f305"

- alias: Basil - above 30 degree
  trigger:
    platform: numeric_state
    entity_id: sensor.basilikum_temperature
    above: 30
  action:
    service: notify.pflanzentwitter
    data:
      message: "Basil: Hot day today, it's over 30 degree celsius now. \U0001f321"

- alias: Basil - water warning 2
  trigger:
    platform: numeric_state
    entity_id: sensor.basilikum_moisture
    below: 25
  action:
    service: notify.pflanzentwitter
    data:
      # Cactus emoticon
      message: "Basil: What about some water for me? \U0001f335"

- alias: Basil - water warning 3
  trigger:
    platform: numeric_state
    entity_id: sensor.basilikum_moisture
    below: 20
  action:
    service: notify.pflanzentwitter
    data:
      # Skull emoticon
      message: "Basil: Water me or I will die of thirst. \U0001f480"

- alias: Basil - water warning 4
  trigger:
    platform: numeric_state
    entity_id: sensor.basilikum_moisture
    below: 10
  action:
    service: notify.pflanzentwitter
    data:
      # Skull emoticon
      message: "Basil: Help! Water! \U0001f480\U0001f480\U0001f480"

- alias: Basil - enough water
  trigger:
    platform: numeric_state
    entity_id: sensor.basilikum_moisture
    above: 50
  action:
    service: notify.pflanzentwitter
    data:
      message: "Basil: I'm feeling better, thank you for the water. \U0001f3a0"

You might ask yourself, what those crazy \U000xxxx numbers are? These are just emoticons. Have a look here for their unicode character codes.