Power outage schedule card for Home Assistant. The card is designed to work with the information provided by svitlo.oe.if.ua (see data retrieval example). It shows the schedule for today and tomorrow (if provided).
This card can be installed using HACS (Home Assistant Community Store) custom repositories.
- Install HACS.
- Go to HACS -> Frontend -> Custom repositories (in the menu).
- Set the repository to
https://github.com/strange-v/power-outage-schedule-card
and the category toLovelace
. - Click Explore & download repositories and search for
power outage schedule card
. - Select the card and click download.
- Accept reload.
- Download
power-outage-schedule-card.js
file from the latest-release ordist
folder. - Put
power-outage-schedule-card.js
file into yourconfig/www
folder (this can be done through the "File editor" addon if HA OS is used). - Add a reference to
power-outage-schedule-card.js
in Lovelace resources.- Go to dashboard.
- Click edit and open the three dots menu.
- Click Manage resources.
- Click Add Resource.
- Set the URL to
/local/power-outage-schedule-card.js
and the Resource type toJavaScript module
-
Go to
Settings
-Devices & Services
-Helpers
and create a newText
helper named "OE Queue", set the value to "2.2" (will be updated later) -
Add REST sensors for today and tomorrow
rest: - resource: "https://be-svitlo.oe.if.ua/schedule-by-queue" scan_interval: 1800 headers: "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0" "Accept": "*/*" "Accept-Language": "en-US,en;q=0.5" "Accept-Encoding": "gzip, deflate, br, zstd" "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" "Origin": "https://svitlo.oe.if.ua" "Connection": "keep-alive" "Referer": "https://svitlo.oe.if.ua/" params: "queue": > {{ states('input_text.oe_queue') }} method: GET sensor: - name: "OE Today" unique_id: 5fd8c49686d04772be7d51c2ccdba1f5 value_template: >- {% set today = now().strftime('%d.%m.%Y') %} {% set data = value_json | selectattr("eventDate", "equalto", today) | list %} {% if data | length > 0 %} {% set data = data | last %} {% set queue = data.queues[states('input_text.oe_queue')] %} {{ data.eventDate }};{{ data.scheduleApprovedSince }}; {%- for period in queue %}{{ period.from }}-{{ period.to }}-{{ period.status }};{%- endfor %} {% else %} unknown {% endif %} - name: "OE Tomorrow" unique_id: c8450a42626a4769a5f612d16f3dfc70 value_template: >- {% set tomorrow = (now() + timedelta(days=1)).strftime('%d.%m.%Y') %} {% set data = value_json | selectattr("eventDate", "equalto", tomorrow) | list %} {% if data | length > 0 %} {% set data = data | last %} {% set queue = data.queues[states('input_text.oe_queue')] %} {{ data.eventDate }};{{ data.scheduleApprovedSince }}; {%- for period in queue %}{{ period.from }}-{{ period.to }}-{{ period.status }};{%- endfor %} {% else %} unknown {% endif %}
-
Configure automatic update of the OE Queue
-
Add a new rest sensor
- resource: "https://be-svitlo.oe.if.ua/GavGroupByAccountNumber" scan_interval: 3600 headers: "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0" "Accept": "*/*" "Accept-Language": "en-US,en;q=0.5" "Accept-Encoding": "gzip, deflate, br, zstd" "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" "Origin": "https://svitlo.oe.if.ua" "Connection": "keep-alive" "Referer": "https://svitlo.oe.if.ua/" params: "accountNumber": "XXXXXXXX" "userSearchChoice": "pob" "address": "" method: POST sensor: - name: "OE Queue" unique_id: 3ac7ab5e3ce64c558f86dd6c9c600677 value_template: >- {% set data = value_json['current'] %} {% if data.hasQueue == "yes" %} {{ data.queue }}.{{ data.subqueue }} {% else %} unknown {% endif %}
You can use your address or personal account number to fetch the actual data about your queue. Put your oblenergo personal account number into the
accountNumber
parameter or your address (e.g.,Івано-Франківськ,Індустріальна,32
) into theaddress
parameter. -
Add automation that updates the previously created
Text
helper and related sensorsalias: Update OE Queue description: "" triggers: - trigger: state entity_id: - sensor.queue to: null id: queue conditions: - condition: not conditions: - condition: state entity_id: sensor.queue state: unavailable - condition: state entity_id: sensor.queue state: unknown actions: - action: input_text.set_value metadata: {} data: value: "{{ states('sensor.queue') }}" target: entity_id: input_text.oe_queue - action: homeassistant.update_entity data: entity_id: - sensor.oe_today mode: single
-
-
Configure the card using YAML (the UI editor is unsupported)
type: custom:power-outage-schedule-card queue_entity: input_text.oe_queue today_entity: sensor.oe_today tomorrow_entity: sensor.oe_tomorrow hide_past_hours: true title: Power outage schedule empty_text: The schedule for hourly outages will be published by the end of the day. reload_action: service: homeassistant.update_entity target: sensor.oe_queue
Read more about how to configure notifications.