EskomSePush: API available

Can’t say that I do.

Check that you have not set up 2x polling sensors? The quote request doesnt count as an api call.

Screenshot 2022-09-28 at 07.27.03

Seems you were right however its a potential bug in HA.
I setup mine using your example nad then split the entities into my split configuration.
As the rest sensors did not have unique_is’s HA created duplicates, even though they were only in a single file. Calling the API for each of the sensors.

@MongooseMan what card type are you using in Home Assistant to get it to display like that?

image

Mushroom Template cards: GitHub - piitaya/lovelace-mushroom: Mushroom Cards - Build a beautiful dashboard easily 🍄

{%- for event in states['sensor.eskomsepush'].attributes.events -%} {{ as_timestamp(event['start']) | timestamp_custom('%A %Y-%m-%d   \t%I:%M %p\t') }}➡{{ as_timestamp(event['end']) | timestamp_custom('\t%I:%M %p\t') }} ({{event['note']}}) {{- '\n' -}} {%- endfor -%}
1 Like

Aaah ok cool, thanks for the reply.

Hi , Would you mind sending the whole code? :slight_smile:
Just cant get it to work with your example. It’s all in the same line. not formatted like yours. Maybe im missing something.
Thanks

You just add The Markdown card and paste the code posed above.
It is formed already

Card 1:

type: custom:mushroom-template-card
primary: Upcoming loadshedding slots
icon: mdi:power-plug-off-outline
multiline_secondary: true
secondary: >
  {%- for event in states['sensor.eskomsepush'].attributes.events -%} {{
  as_timestamp(event['start']) | timestamp_custom('%a\t%Y-%m-%d   \t%I:%M %p\t')
  }}➡{{ as_timestamp(event['end']) | timestamp_custom('\t%I:%M %p\t') }}
  ({{event['note']}}) {{- '\n' -}} {%- endfor -%}
icon_color: red

Card 2:

type: custom:mushroom-template-card
primary: Upcoming loadshedding stages
icon: mdi:guy-fawkes-mask
multiline_secondary: true
secondary: |2-
   {%- for event in states['sensor.eskomsepushstatus'].attributes.status.capetown.next_stages -%} {{
          as_timestamp(event['stage_start_timestamp']) | timestamp_custom('%a\t%Y-%m-%d %H:%M\t') }}➡{% if loop.index < loop.length %}{{ as_timestamp(loop.nextitem['stage_start_timestamp']) | timestamp_custom('\t%a\t%Y-%m-%d %H:%M') }}{% else %}{{'\t\t\t\t\t\t    '}}             
  {%- endif -%}{{'\t:\t\t'}}{{ event['stage'] }}{{'\n'}}
          {%- endfor -%}
fill_container: true
icon_color: orange
badge_icon: ''

image

Relies on the following:

rest: 
  - resource: "https://developer.sepush.co.za/business/2.0/area"
    scan_interval: '02:00:00' # RATE LIMIT!
    headers:
      Token: !secret EskomSePushToken
    params:
      id: "capetown-9-pinelands"
      #id: "<your area id here>"
    sensor:
      - name: EskomSePush
        unique_id: eskomsepush
        force_update: true
        value_template: "OK"
        json_attributes:
          - events
          - info
          - schedule
  - resource: "https://developer.sepush.co.za/business/2.0/status"
    scan_interval: '02:00:00' # RATE LIMIT!
    headers:
      Token: !secret EskomSePushToken
    sensor:
      - name: EskomSePushStatus
        unique_id: eskomsepushstatus
        force_update: true
        value_template: "OK"
        json_attributes:
          - status

Works Like a charm. Thanks.
I had it in markdown, but mushroom cards looks much better.
My eskomssepush status … im not pulling from eskomsepush api as it uses a call. so i use the eskom loashedding integration to get the status.
I like the 2nd card as well, but dont need to complicate the WAF.

Now to find a way to publish this to a website :slight_smile:

OK so now that loadshedding is actually ending, I know what my sensors do when there’s no upcoming events:

image

It needs some tweaks… :confused:

Edit:

image

2 Likes

Code pls. :wink:

I think @tinuva updated his too - home-assistant-config/eskomsepush.yaml at master · tinuva/home-assistant-config · GitHub

1 Like

Hi @ebendl
image

Is there an easy way to switch the red and green colouring in the entity card (Green for No Loadshedding and Red for Loadshedding?)

Thanks

Mine seems to work that way:

image

I set the device_class to problem – that might be it? That means “On” = loadshedding is active = “Problem” status = red.

      calendar_loadshedding_active:
        friendly_name: "Loadshedding active"
        device_class: problem
        value_template: >
            {%if state_attr('sensor.eskomsepush','events')|count > 0 %}
                {% if (int(states('sensor.time_till_loadshedding')) <= 0 ) %}
                 True
                {% else %}
                 False
                {% endif %}      
            {% else %}
             False
            {% endif %}   
1 Like

@MongooseMan would you mind sharing the code for your sensor.eskomsepushstatus?

I don’t seem to have the status sensor anywhere and would like to add the upcoming stages to my HA.

Second half of the “Relies on…” code here: EskomSePush: API available - #68 by MongooseMan

Awesome thanks, working now :+1:

1 Like

So your old Token will expire at the end of November. You have to get a new one.

Thanks for a great thread, just joined!
@MongooseMan post updating the API to the new one, Card 1 still works but Card 2 breaks. Did they change the format of the data received? Anyone else with the same problem?
image

Where did you see this? Checked out the links again but didn’t find it.