Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 111206

Use Google Calendar Event message data as variable in service call

$
0
0

@Ro4cHii wrote:

Hello there,

I am quite new to Home Assistant and have been reading in this forum and also searching Google like crazy in order to accomplish what I want, yet I lack the understanding to do so.

Following situation:
I have a Shelly 2.5 in order to control my roller shutter.
I want to create an automation that reads an event from my Google calendar, extracts numerical data (percentage) from the title and uses this data to control the roller shutter.

So far, I am able to create events called “#WZK” and once they occur, the roller shutter moves to a predefined position (e.g. 90% in the example below).
However, I want to be able to create events with the pattern “#WZK 72” in order to move the roller shutter to 72% once the event occurs.

Here are the excerpts from my configuration files:

configuration.yaml

rest_command:
  shelly_wzk:
    url: "http://192.168.178.30/roller/0?go=to_pos&roller_pos={{ poswzk }}"

google_calendars.yaml

- cal_id: ********@group.calendar.google.com
  entities:
  - device_id: hagc
    ignore_availability: true
    search: "#WZK"
    name: Home Assistant Google Calendar
    track: true

automations.yaml

- id: '1589283711147'
  alias: TestWZK
  description: ''
  trigger:
  - entity_id: calendar.hagc
    platform: state
    to: 'on'
  condition:
  - condition: template
    value_template: '{{is_state_attr(''calendar.hagc'', ''message'', ''#WZK'') }}'
  action:
  - alias: ''
    data:
      poswzk: 90
    service: rest_command.shelly_wzk

I already tried to adapt the action to the following:

action:
  - alias: ''
    data_template:
      poswzk: '{{state_attr(''calendar.hagc'', ''message'')}}'
    service: rest_command.shelly_wzk

and change the search term in google_calendars.yaml to "#WZK ".

From the Google Calendar Event documentation I understood that the search term will be excluded from the message attribute. However, when I take a look at the state of calendar.hagc, the message always is “#WZK 72” but never “72”.

What am I doing wrong here?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 111206

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>