Need help Including sensor data in an IFTTT Trigger & Action

This alert is tied to IFTTT. When this automation is triggered it sends IFTTT an event which in turn IFTTT sends me a text message with the text below. However the text comes through with the variable “sensor.humidor_humidity” as opposed to value itself. I obtained the variable name from developer tools <> page which showed the sensor value having that exact name. I tried putting sensor.humidor_humidity in quotes as well but that had the same result.

I also think the entity_id: line is incorrect as the trigger is never being triggered.

- alias: Humidity Alert
  trigger:
  - platform: numeric_state
    entity_id: sensor.humidor_humidity
    above: 38
    below: 36
    for:
      minutes: 1
  action:
    service: ifttt.trigger
    data: {"event": "Humidity_Alert", "value1": sensor.humidor_humidity}
1 Like

I managed to resolve my own issue by searching git hub repos until I found someones scripts that was doing something similar to what I was trying to do. In the end I’m happier with the setup and I’ll try my best to provide the solution.

First I’ll give credit where credit is due:Thank you Carlo Costanzo.

Link to github repo: https://github.com/CCOSTAN/Home-AssistantConfig

I grabbed this script:


######################################################################################################
###Script to send notifications to IFTTT to notify me on the mobile Phone! Call like this:
  # action:
    # service: script.ifttt_notify
    # data_template:
      # value1: 'Startup: Home Assistant is Up and Running!'
      # value2: ''
      # value3: "{{ trigger.to_state.state }}"

    # IFTTT Maker channel should look like this: https://files.gitter.im/home-assistant/home-assistant/phkx/blob
######################################################################################################

ifttt_notify:
   sequence:
    - service: ifttt.trigger
      data_template: {"event":"ifttt_notify", "value1":"{{ value1 }}", "value2":"{{ value2 }}", "value3":"{{ value3 }}"}

which simply provides a means of executing an ifttt trigger for an existing ifttt webhook event named “ifttt_notify”. The script takes 3 variables although not all are required to be populated.

Then I found an automation grabbing data from a wind sensor and tailored this snippet to meet my needs


Original

###################################
## Tornados are no Joke.
###################################

- alias: 'High Wind Speed Notification'
  hide_entity: True
  trigger:
    - platform: numeric_state
      entity_id: sensor.dark_sky_wind_speed
      above: 50

  action:
    - service: script.ifttt_notify
      data_template:
        value1: 'VERY HIGH WINDS:'
        value2: "{{ states('sensor.dark_sky_wind_speed')}}"
        value3: ' '

Tailored

- alias: Humidity Low
  trigger:
    platform: numeric_state
    entity_id: 
      - sensor.humidor_humidity
    below: 36
    for:
      minutes: 1
  action:
    - service: script.ifttt_notify
      data_template:
        value1: 'Warning Humidity is currently at: '
        value2: "{{ states('sensor.humidor_humidity')}}"
        value3: ' add moisture. '

- alias: Humidity High
  trigger:
    platform: numeric_state
    entity_id: 
      - sensor.humidor_humidity
    above: 38
    for:
      minutes: 1
  action:
    - service: script.ifttt_notify
      data_template:
        value1: 'Warning Humidity is currently at: '
        value2: "{{ states('sensor.humidor_humidity')}}"
        value3: ' remove moisture. '

Hopefully this helps someone in the future.

I couldn’t get the above: && below: conditions in 1 automation block… So I had to create 2 separate ones… For whatever reason it wouldn’t trigger… so if someone knows the proper syntax please feel free to add it.

1 Like