I have a rest sensor platform configured to give me sensors. Theses sensors contains dates and colors. I would like to add these dates to a calendar. Is far as I know, there are no service to add to the local calendar, so I will settle for a google Calendar.
Sensor:
state: 'OK'
attributes:
title: 'Mad/Rest affald'
color: '#775223'
start: '2023-01-26'
friendly_name: 'Food and household waste'
I have created an automation that adds the events to a calendar, but my problem is that for some reason the sensors from the rest platform is considered changed, event if the state and attributes are the same, which result in events getting added multiple times.
Is there any other way of doing this?
alias: Garbage collection add to calendar
description: ""
mode: single
trigger:
- platform: state
entity_id:
- sensor.food_and_household_waste
id: food
action:
- if:
- condition: trigger
id: food
then:
- service: google.create_event
data:
summary: "{{ state_attr('sensor.food_and_household_waste', 'friendly_name') }}"
description: "{{ state_attr('sensor.food_and_household_waste', 'friendly_name') }}"
start_date: "{{ state_attr('sensor.food_and_household_waste', 'start') }}"
end_date: "{{ state_attr('sensor.food_and_household_waste', 'start') }}"
target:
entity_id: calendar.garbage_collection