Hi all
I need a help with a little project, I scrape some events from the web and store them in sensors “sensor.match_time_one” which is the time of the event.
I need to create another sensor showing “Next event”
This doe not work, just to demonstrate the idea
can someone please show me the correct approach to do this
binary_sensor:
- platform: tod
name: Event 1
time: “sensor.match_time_one”
before_offset: 15 minutes
after_offset: 20 minutes
- platform: tod
name: Event 2
time: “sensor.match_time_two”
before_offset: 15 minutes
after_offset: 20 minutes
- platform: tod
name: Event 3
time: “sensor.match_time_three”
before_offset: 15 minutes
after_offset: 20 minutes
sensor:
- platform: template
sensors:
time_of_day:
friendly_name: "Next event is”
value_template: >-
{% if is_state('sensor.match_time_one,'on') %}
First Event
{% elif is_state('sensor.match_time_two,’on') %}
Second Event
{% else %}
Third Event
{% endif %}