Coder Social home page Coder Social logo

wernerhp / ha.integration.load_shedding Goto Github PK

View Code? Open in Web Editor NEW
112.0 6.0 21.0 681 KB

A Home Assistant integration to track your load schedding schedule.

License: MIT License

Python 100.00%
eskom hacs home-assistant home-automation load-shedding

ha.integration.load_shedding's Introduction

Load Shedding hacs_badge

A Home Assistant integration to track your load schedding schedule.

πŸ’‘This integration uses the Eskom SePush API.
🚨Read the EskomSePush API Licence Agreement.
πŸ”‘Get a Free (50 requests per day) API Key from Eskom Se Push. You can pay for a higher limit.
⚠️Do not use more than one API key from the same IP. Your key will be blocked.

HACS Install

  1. Go to HACS Integrations on your Home Assitant instance
  2. Select "+ Explore & Download Repositories" and search for "Load Shedding"
  3. Select Load Shedding: A Home assistant integration to track your load shedding schedule. and Download this repository with HACS image
  4. Once downloaded, click the My Integrations button to configure the integration.
    Open your Home Assistant instance and start setting up a new integration.
  5. Setup cards and automations
  6. Please support my work

Support

If you find this integration useful, please consider supporting my work by buying me a coffee or making a donation in the form of Bitcoin.

Buy me a coffee

Buy Me A Coffee

Sign-up for a free Luno wallet using this invite link or enter the code X48WY in the Rewards section and we can both earn R 25.00 free BTC after investing our first R 500.

Bitcoin

3EGnQKKbF6AijqW9unyBuW8YeEscY5wMSE
Bitcoin address: 3EGnQKKbF6AijqW9unyBuW8YeEscY5wMSE

Manual Install

Instructions
  1. Download and unzip to your Home Assistant config/custom_components folder.
Screenshot

image

  1. Restart Home Assistant.
  2. Go to Settings > Devices & Services > + Add Integration

Open your Home Assistant instance and start setting up a new integration.

  1. Search for 'Load Shedding' and follow the config flow.
Screenshot
  1. If you're coming from a previous version of this integration, you may need to delete the .json files in /config/.cache.
Screenshot

image

Sensor

The load shedding sensor State will always reflect the current load shedding stage.
i.e When load shedding is suspended, it will show No Load Shedding. When Stage 2 is active, it will show Stage 2.

Screenshot

| | |

Cards

Mushroom Chips

Status Alert

Calendar

ESP Status Bar

Thanks to @ribeirompl for this contribution

Automation Ideas

These are just some automations I've got set up. They are not perfect and will require some tweaking on your end.
Replace sensor.load_shedding_south_africa_stage, sensor.load_shedding_milnerton_14 and other entity_id with your own.

Load Shedding Stage

Announce Load Shedding stage changes on speakers and push notifications.

Load Shedding Start/End

Do stuff when load shedding starts, e.g. update your slack status, turn off lights, etc.

Slack Status

Setup a REST Command and two automations to set your Slack status when Load Shedding starts and ends.

Example

secrets.yaml

slack_token: Bearer xoxp-XXXXXXXXXX-XXXXXXXXXXXX-XXXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

configuration.yaml

rest_command: 
    slack_status:
      url: https://slack.com/api/users.profile.set
      method: POST
      headers:
        authorization: !secret slack_token
        accept: "application/json, text/html"
      payload: '{"profile":{"status_text": "{{ status }}","status_emoji": "{{ emoji }}"}}'
      content_type: "application/json; charset=utf-8"
      verify_ssl: true

Load Shedding Warning (15 min)

15 minutes warning on speaker and telegram before load shedding starts.

Load Shedding Warning (2 hr)

2 hour warning on smart speaker

Load Shedding Reload

Reload the integration every night. This is a workaround for Issue #70/#71

ha.integration.load_shedding's People

Contributors

pnd001 avatar ribeirompl avatar spotityza avatar surekqomi avatar tonym128 avatar wernerhp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ha.integration.load_shedding's Issues

City of Tshwane

Hi, when I'm trying to add Load Shedding to HA it pops up the configuration where I need to search for my suburb.
image
When I search for my Suburb (Villeria in Pretoria) it doesn't pick it up.

It only show these results.
image

Is there any place where I can Edit the Suburb id in code? To use my Suburb ID? Or am I using this wrong?
http://loadshedding.eskom.co.za/LoadShedding/GetSurburbData/?pageSize=1000000&pageNum=1&searchTerm=Villeria&id=167
{
"Results": [
{
"id": "1027184",
"text": "Villeria",
"Tot": 0
}
],
"Total": 1
}

Thx

api from eskom se push

Thanks for this. Saved me so much time.
Im trying to figure out how to plug my API into the mushrooms (lol) so it reads my limit etc.
Right now I have no clue
Sorry for the inconvenience

Dashboard setup

Really nice, I just wish you guys had a tutorial on how to setup the dashboard for beginners that are only coming into home assistant now.

calendar.load_shedding_forecast not updating

So i noticed the other day that using the calendar.load_shedding_forecast, that it was not updating the information.
first thing i did was restart HA, and it worked, but then it didn't update again when thing changed. So i Reloaded the integration, and that worked, so i left it overnight in case it was a daily thing, and noticed that it still didn't update, so i reload the integration again , but when i didn it all broke ( I am sure it all broke because load sheading has now been suspended)

So here are some screenshots. Hope they help

Working as intended during a loadshedding session
Screenshot_20221106-021243_Home Assistant

Top information still there, after load shedding ended
Screenshot_20221106-023203_Home Assistant

After a restart or an integration reload, greyed out area disappeared
Screenshot_20221106-023308_Home Assistant

many hours later greyed out area back again after load shedding fished
Screenshot_20221106-121136_Home Assistant

Broke calendar after a reload and load shedding suspended.
Screenshot_20221106-121942_Home Assistant

Hope this helps, or someone can point me in the correct direction for a solution

To time showing and no timer

I have configured everything and the card is showing as per screenshot just without the 15 min warning.

But my "Next Start" is not showing and "Time Until" not showing

Can anyone help.

COCT Schedule not correct

Adding Integration with following parameters:

  • Search -> "Durbanville" (no effect, but not unexpected)
  • Select Area 6 from dropdown

Integration added successfully.

The load-shedding schedule is missing the next loadshedding slot as per my own integration, as well as Loadshedding app (Loadshedding Notifier)

Expected 22:00 12/07/2022
image

integration: 00:00 13/07/2022
image

I have not looked into it myself, but there seems to be a problem. I will post more replies if I find any clues.

Add end time?

Hey man

Great work with the add on!

Is it possible to add the end time of load shedding to the start time?
Can call it "Next Schedule" instead of Next Start for example

e.g. Next Schedule: 8:00am - 10:30am

Or add another line to show the end time. I think it's useful to show the end time as well not just the start time, and I know it is returned in the same string from the Eskom API.

Also is it possible for you to format the time from the ISO format to a more normal format? Just going on the screenshots here, but glancing at the code looks like it might already be formatted?

Thanks!

End time truncated to midnight

Hi Werner,

Great effort and integration - works great so far.

I have noticed however, that for loadshedding that spans across midnight, the end time is truncated to midnight - please see below - correct endtime is 01:30 the next day - is this a problem with the API?

image

cannot import name 'FlowResultType'

What is the Issue?
When tyring to add the loadshedding integration via the mobile app or web, I am presented with the below screenshot.

image

Text:

Error
This integration does not support configuration via the UI. If you followed this link from the Home Assistant website, make sure you run the latest version of Home Assistant.

Upon checking the logs, I find the following log:

image

Text:

Logger: homeassistant.config_entries
Source: config_entries.py:749
First occurred: 12 July 2022 at 21:52:22 (7 occurrences)
Last logged: 18:52:15

Error occurred loading configuration flow for integration load_shedding: cannot import name 'FlowResultType' from 'homeassistant.data_entry_flow' (/usr/src/homeassistant/homeassistant/data_entry_flow.py)

Version:
Home Assistant Core 2022.6.6

Time to LS not showing Bordeaux (14)

Hi, forgive me if this is the wrong place to post this....

I loaded my area, Bordeaux South, Block 14. Unfortunately, it doesn't show any times other than the stage. Am I missing something?

Thanks for making this!

Capture

Times off by two hours.

Hi

Times are off by two hours, unless I am doing something wrong. HA time zone is set to (GMT+02:00) Johannesburg

Capture
Capture1

Card 4 - Error

Hi,

Thank you for the amazing work being done!

I have the following error. (running dev 1.1.0-5) when copying the card without changing the data (so area is still sensor.load_shedding_area_eskde_14_milnertoncityofcapetownwesterncape) the card shows the correct info on when is the next stage of load shedding etc. is. But obviously it does not show anything when load shedding starts because I do not have sensor.load_shedding_area_eskde_14_milnertoncityofcapetownwesterncape listed anywhere. I then fix it to set area to sensor.load_shedding_area_tshwane_2_faerieglenext7 then the stage prediction breaks of when the next load shedding change will be but my schedule is fixed.

Please find the 2 examples attached.

Am I missing something? all the data is correct when looking under the sensors. and the calender.

Screenshot 2022-11-08 083855

Screenshot 2022-11-08 084422

Regards

Error adding entities for domain sensor with platform load_shedding

Logger: homeassistant.components.sensor
Source: custom_components/load_shedding/sensor.py:192
Integration: Sensor (documentation, issues)
First occurred: 7:30:38 AM (4 occurrences)
Last logged: 12:17:42 PM

Error adding entities for domain sensor with platform load_shedding
Error while setting up load_shedding platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 673, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 776, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 388, in state
value = self.native_value
File "/config/custom_components/load_shedding/sensor.py", line 192, in native_value
start_time = datetime.fromisoformat(schedule[0].get(ATTR_START_TIME))
IndexError: list index out of range

Display Card Yaml file mixup

Not an issue with the actual integration,
but yothe Code for the cards, the links are not right,
Card 1 is linked to card2.yaml
Card 2 is linked to card3.yaml
Card 3 is linked to card2.yaml

I am sure other will work it out, but i did take a few minutes.,
Also, some people might not realise that Mushroom cards are need as in card as it only says
I created this card with the help of [template-entity-row]

Also noticed tha Image for Card 2 and the code for card 2 dont match as there is nothing in there about National stage or cape town stage. I am not a coder, but i am sure i can fumble my way around to get that info to work, just always concerned for others that only know how to copy and paste.

Everything so far seems to be working like a dream, So happy that the API became so much easier to get

Great job

Stage not changing

Last few days the stage is stuck at 4 in home assistant. Not sure it is an issue or problem on my side. Currently running 0.4.1

No longer getting Schedules

This no longer shows me schedule, I says we are on stage 4, so that is still working, but when i look at the schedule, it is blank

I have 1 Device with 2 Entitles the Stage entity and the area entity, but the area entity shows this
"This entity is no longer being provided by the load_shedding integration. If the entity is no longer in use, delete it in settings."

Is this to do with HA update, or has something changed from where it pulls its information?

Blueprints

Awesome integration you are the MAN!

Would it be possible to add your automations as blueprints?

Again thank you for this

Suggestion: bring back some sort of caching

With the free API Token from ESP, you get 50 credits a day, on startup and every hour there after the integration uses 2 of those credits... In normal circumstances this is OK as there are 24 hours a day times 2 is 48, which is under that limit, but I was trying to workout something this afternoon and restarted my home assistant way too many times now my load shedding sensors are broken (except the quota one) 😞
image

I see in the HA Dev Docs they have Restoring sensor states which might be an option, I know last time you used a custom json file in the .cache folder...
It would be nice if you're out of credits the previous state is maintained instead of going to Unavailable/Unknown...
I guess there is danger in having that stale state forever, so it could go unavailable if you couldn't update for more than 24 hours πŸ€·πŸ»β€β™‚οΈ ...

If I had a better understanding of Python I'd maybe tackle these, who knows maybe next weekend I'll give it a go πŸ˜„

Thanks again for making the integration and doing change to ESP

feature request: entity with same matching slots as calendar

Would it be possible to create an entity where the attributes contain the same list of slots as the calendar?

What I mean by that is, where the slots have been combined and the 30min slots removed, exactly as one have in the calendar entity. The problem is, the calendar entity only provide the "next" slot, but also at times it is outdated unlike the area entity. The area entity doesn't have the slots combined and less than 30min removed like the calendar.

Use case: To be able to use the same entries that are in the calendar in automations (to make life easier).

Calendar looks good:
Screenshot 2023-01-16 at 07 38 04

Attributes though useless for automations: (HA limitation and looks like no plan to fix based on home-assistant/core/issues/84202 ).
Eg. Look here. This screenshot was taken at 7:38am but it still shows a 5-6:30 slot in the attribute.
Screenshot 2023-01-16 at 07 38 12

The area attributes seem to get update
Screenshot 2023-01-16 at 07 39 37
d instantly, but is not combined when stage names change halfway through a slot etc:

Unable to add "Area" on new Integration setup - Full Details - Error seems to be persistent.

Home Assistant : VM
Home Assistant 2023.1.7
Supervisor 2023.01.1
Operating System 9.5
Frontend 20230110.0 - latest

Log Relating to Integration :

Logger: homeassistant.helpers.template
Source: helpers/template.py:540
First occurred: 9:34:56 PM (17 occurrences)
Last logged: 9:49:56 PM

Template variable error: 'None' has no attribute 'eskom' when rendering '{{ state_attr('sensor.eskom_loadshedding_stage','status').eskom.stage}}'

Screen Shot :
image

Summary :
It accepts the API Token successful , at the screen where you have add in your area none of the parameter's work.

Regards
Denzel

Next start time

I have no experience in coding but is there a way to clean up the "next time" date/time

Don't want to see the time zone. Maybe have the date and time stacked on top of each other or separated a bit somehow.

Also once load shedding is suspended the timers are still there. No way to make them empty if there is no load shedding stage.

Also I have added the automation if the stage changes but it does not notify if it's suspended.

Integration not installing.

Installed latest HACS βœ”οΈ
Restart HA βœ”οΈ
Installed Load Shedding via HACS βœ”οΈ
Restart HA βœ”οΈ
Correctly installed:
image

Add Integration ❌

Wizard not starting up:
image

Been watching it spin for quite a while...

Not seeing anything in the logs...

Can I have more that one area / zone/ block?

Not an Issue, more of a question
So today it would seem that we were on Block 2 for the longest time and now we have been moved to block 7

can i add a second block? would like to track block 2 and block 7

Eskom SePush API - Feedback

For those who are brave, a very rough development version that works with EskomSePush API is available as a pre-release.
Please post feedback on this issue.

Unable to reach Provider. See Logs for details.

Hi Werner,

Thanks for an awesome integration. Mine stopped working on 4 Sept 2022 but I suspect that the Eskom api site is down or they implemented changes to it.

Can you possibly confirm?

Thanks

Update interval of integration

thanks for the new code looks much better with new time formats.

I have 1 last issue. Seems like I have to manually reload the integration before it will show values. Is this my HA instance that is not updating or is it the load shedding integration that needs to be change to update quicker?

LS stared at 17h00 and after 20 min still did not see any info. Reload integration then values populate.

Unexpected error fetching load_shedding data: 'list' object has no attribute 'items'

This error originated from a custom integration.

Logger: custom_components.load_shedding
Source: custom_components/load_shedding/__init__.py:324
Integration: Load Shedding (documentation, issues)
First occurred: 01:40:19 (1 occurrences)
Last logged: 01:40:19

Unexpected error fetching load_shedding data: 'list' object has no attribute 'items'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
    self.data = await self._async_update_data()
  File "/config/custom_components/load_shedding/__init__.py", line 162, in _async_update_data
    await self.async_area_forecast()
  File "/config/custom_components/load_shedding/__init__.py", line 324, in async_area_forecast
    for area_id, data in areas.items():
AttributeError: 'list' object has no attribute 'items'
This error originated from a custom integration.

Logger: custom_components.load_shedding
Source: custom_components/load_shedding/__init__.py:241
Integration: Load Shedding (documentation, issues)
First occurred: 01:40:19 (1 occurrences)
Last logged: 01:40:19

Unable to get schedule: ("Quota Exceeded - Reminder: you can use the 'test' query param for development. Check the docs! πŸ˜…", 429, 'Too Many Requests')
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/load_shedding/libs/sepush.py", line 69, in _call
    raise urllib3.response.HTTPError(r.status, r.reason)
urllib3.exceptions.HTTPError: (429, 'Too Many Requests')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/load_shedding/__init__.py", line 239, in async_update_schedule
    data = await self.hass.async_add_executor_job(self.sepush.area, area.id)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/site-packages/load_shedding/libs/sepush.py", line 47, in area
    data = _call(url, self.token)
  File "/usr/local/lib/python3.10/site-packages/load_shedding/libs/sepush.py", line 73, in _call
    raise SePushError(error, r.status, r.reason) from e
load_shedding.libs.sepush.SePushError: ("Quota Exceeded - Reminder: you can use the 'test' query param for development. Check the docs! πŸ˜…", 429, 'Too Many Requests')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/load_shedding/__init__.py", line 153, in _async_update_data
    data = await self.async_update_schedule()
  File "/config/custom_components/load_shedding/__init__.py", line 241, in async_update_schedule
    raise UpdateFailed(err) from err
homeassistant.helpers.update_coordinator.UpdateFailed: ("Quota Exceeded - Reminder: you can use the 'test' query param for development. Check the docs! πŸ˜…", 429, 'Too Many Requests')

Automation Ideas

This issue is a place where everyone can share their automation ideas or panels they create using this integration.

  1. Specify the release version on which your template works.
  2. Add a screenshot
  3. Put code in a collapsible details tag like so
<details>
  <summary>Code</summary>

```yml
EXAMPLE YAML GOES HERE
```
</details>

Wont show in Integration

Downloaded from Hacs - No problem
Restarted Home Assistant - No Problems
Go to Settings > Devices & Services > + Add Integration - PROBLEM it is not in the list

Here endith my Problem

Issue with card 1 template

Hi,

Firstly, thank you for the awesome integration.

I am having an issue with the Card 1 template.
Below is what it looks like for me
image

The time always shows 02:00-02:00. Not sure where I have gone wrong as the card 3 template works brilliant

image

Code below.

Thanks in advance.

`type: entities
entities:

  • type: custom:template-entity-row
    icon: mdi:lightning-bolt-outline
    name: Status
    entity: sensor.load_shedding_eskom_stage
    active: '{{ not is_state("sensor.load_shedding_stage_eskom", "No Load Shedding") }}'
    state: '{{states("sensor.load_shedding_stage_eskom")}}'
  • type: custom:template-entity-row
    icon: mdi:timer-outline
    name: Edenvale
    active: '{{ states("sensor.load_shedding_area_ekurhuleni3_9_edenvale") == "on" }}'
    state: >-
    {{ (state_attr("sensor.load_shedding_area_ekurhuleni3_9_edenvale",
    "start_time") | as_datetime | as_local).strftime("%H:%M") }} - {{
    (state_attr("sensor.load_shedding_area_ekurhuleni3_9_edenvale",
    "end_time") | as_datetime | as_local).strftime("%H:%M") }}
    secondary: >-
    {% if states("sensor.load_shedding_area_ekurhuleni3_9_edenvale") == "off"
    %} Starts in {{
    timedelta(minutes=state_attr("sensor.load_shedding_area_ekurhuleni3_9_edenvale",
    "starts_in")) }} {% else %} Ends in {{
    timedelta(minutes=state_attr("sensor.load_shedding_area_ekurhuleni3_9_edenvale",
    "ends_in")) }} {% endif %}
    entity: sensor.load_shedding_area_ekurhuleni3_9_edenvale
    `

Time -1h Difference

Hi Werner, any advice on why the time is out by -1h on my calendar and LS integration, whilst EskomSePush its correct?
Screenshot 2022-11-05 at 06 38 10
Screenshot 2022-11-05 at 06 38 03
Screenshot 2022-11-05 at 06 40 50

Adding Stage Changes

NOT AN ISSUE< BUT AN IDEA?
This might be a long shot, but with all the Schedule updates and the constant changing of stages, is there maybe a way that this integration could display what time the next loadshedding stage will be.
eg
Stage 1 00:00 - 05:00
Stage 3 05:00 - 16:00
Stage 4 16:00 - 00:00

So we are on stage 3, so the next load shed is like 22:00 - 00:30
but if stage 4 comes into play, that would bring the next Load shedding to 16:00 - 18:30
because stage 3 dosent have the 16:00 - 18:30. Hope that made sense.

If its possible, then the awesome code your wrote for the Schedule display on the front end, that could show the new stage in another colour or bold italic?

Any thoughts on this?

Load Shedding Stage Unknown

Hi!

I see that my load shedding stage has been unknown for a few days. The rest of the data seems to be updating just fine.

Any ideas on how to fix this?

Thanks in advance!

Capture

Integration doesn't seem to work outside of South Africa

Hi all. Do you know if the API you get your data from is blocked outside South Africa? I live in Australia and use Home Assistant. Wanted to use the integration to track when our family members in SA have load shedding, but I get the following message: "Unable to reach Provider. See Logs for details.". Not a big deal but I thought I'd just mention it.

Dashboard Cards

I am so grateful for this integration! thank you!!

My landing page in HA has loadshedding stage info, however I would like to add a button next to the stage loadshedding at top with the secondary info from the schedule? any idea how to
Screenshot 2022-07-07 at 11 42 17
Screenshot 2022-07-07 at 11 35 35
?

End time optimization

I use the end_time variable from your 4th card in some of my automations. I'm not sure if it is just my area or other as well, but when stages change when loadshedding is active it gives me the incorrect end time.

I've made a small change that might be worth including that checks if the next start time is the same as the current end time. If true it sets the end time to the next end time instead.

from:
{% set end_time = area_schedule[0].end_time %}

to:
{% if area_schedule[0].end_time == area_schedule[1].start_time %} {% set end_time = area_schedule[1].end_time %} {%else%} {% set end_time = area_schedule[0].end_time %} {%endif%}

Error in HA Log files

Hi @wernerhp

I've upgraded to v0.6.1 which is working well, except I noticed the following error in the log files:

This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/load_shedding/sensor.py:664
Integration: Load Shedding (documentation, issues)
First occurred: 28 October 2022 at 16:33:16 (1104 occurrences)
Last logged: 10:56:59

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 151, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 110, in async_update_listeners
update_callback()
File "/config/custom_components/load_shedding/sensor.py", line 533, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 533, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 574, in _async_write_ha_state
attr.update(self.extra_state_attributes or {})
File "/config/custom_components/load_shedding/sensor.py", line 525, in extra_state_attributes
self._attrs.update(clean(data))
File "/config/custom_components/load_shedding/sensor.py", line 664, in clean
if data[key] == value:
TypeError: list indices must be integers or slices, not str

Let me know if you need any more details?

Thanks!

Unable to download Schedule

Hi,

I'm not able to receive any schedules. Sensor state shows no scheduling data:

Screenshot 2022-07-03 at 08 47 32

Error doing job: Task exception was never retrieved
08:50:40 – (ERROR) Load Shedding (custom integration)
Error adding entities for domain sensor with platform load_shedding
08:50:32 – (ERROR) Sensor (custom integration) - message first occurred at 08:50:32 and shows up 2 times

More details from the logs:

2022-07-03 08:50:32 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform load_shedding
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 619, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 810, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 533, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 571, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 539, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 388, in state
value = self.native_value
File "/config/custom_components/load_shedding/sensor.py", line 172, in native_value
start_time = datetime.fromisoformat(schedule[0].get(ATTR_START_TIME))
IndexError: list index out of range

^ This error might be because I have a sensor template that's not able to get the start / end timestamps. I did previously see errors about retrieving the schedule, but after loadshedding I'm not seeing them reappear.

Loadshedding v0.2.0-alpha

Stage sensor name change

The stage sensor currently uses a value received from Eskom SePush. They changed this value and so the sensor name changed from load_shedding_south_africa_stage to load_shedding_eskom_stage. This will cause automations to fail. I'm looking into changing this to use a value that won't change.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.