Sensor value to change based on other sensor value (Load Shedding Notify)

I have also acquired an API key from Eskom se Push and implemented it.
Works fantastic!

Kudos to @swartjean, I am using his integration to make this all work.

For those of you that would like to implement something similar, I will post my code. Keep in mind that I am no developer so go easy on me. If you can use my code and modify it to be more “correct” / efficient then go for it.

type: vertical-stack
cards:
  - type: markdown
    content: |-
      {% if states("calendar.loadshedding_local_events_2") == "off" %}
      <font size=5 font color = green>Currently not Load Shedding</font>
      {% elif states("calendar.loadshedding_local_events_2") == "on" %}
      <font size=5 font color = red>Load Shedding in Progress</font>
      {% endif %}
    title: Load Shedding Status
  - type: entity
    entity: calendar.loadshedding_local_events_2
    attribute: message
  - type: entity
    attribute: start_time
    name: 'Next load shedding starts at:'
    entity: calendar.loadshedding_local_events_2
  - type: markdown
    content: >-
      <font size = 06px><font color = red>{% if
      states("calendar.loadshedding_local_events_2") == "off" %}

      Starts in: {{states('sensor.loadshedding_start_time')}}</font>

      {% else %} 

      <font size = 06px><font color = green>Ends in:
      {{states('sensor.loadshedding_end_time')}}

      {% endif %}</font>
  - type: entity
    entity: calendar.loadshedding_local_events_2
    attribute: end_time
    name: 'Next load shedding ends at:'
  - initial_view: dayGridDay
    type: calendar
    entities:
      - calendar.loadshedding_local_events_2

And then the template sensors for loadshedding_start_time and end_time:

#Loadshedding start time and end time sensors
  - platform: template
    sensors:
      loadshedding_start_time:
        value_template: >
          {% set st = ((as_timestamp(state_attr('calendar.loadshedding_local_events_2','start_time')) - as_timestamp(now().timestamp()|timestamp_custom("%Y-%m-%d %H:%M:%S"))) / (60)|float)|round(0) | int %}
          {% if st == 0 %}
            Unavailable
          {% elif st > 60 %}
            {{ st // 60 }}:{{ '{:0>2d}'.format(st%60) }} hours
          {% else %}
            {{ st }} minutes
          {% endif %}
          
  - platform: template
    sensors:
      loadshedding_end_time:
        value_template: >
          {% set et = ((as_timestamp(state_attr('calendar.loadshedding_local_events_2','end_time')) - as_timestamp(now().timestamp()|timestamp_custom("%Y-%m-%d %H:%M:%S"))) / (60)|float)|round(0) | int %}
          {% if et == 0 %}
            Unavailable
          {% elif et > 60 %}
            {{ et // 60 }}:{{ '{:0>2d}'.format(et%60) }} hours
          {% else %}
            {{ et }} minutes
          {% endif %}          
2 Likes

is there any way of sending that data to a telegram group that we have setup in our community and then also send out that ESP message that says load-shedding will start in 55 mins? I have the ESP entity in HA. BUT i know nothing about koding.

Do you create a new template file or is this added to the configuration.yaml