Last active
September 11, 2024 09:54
-
-
Save lowang/18601a2d063a1e933fb7c6e0e97a3c7c to your computer and use it in GitHub Desktop.
[PL] Energa Operator energy meter sensor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# multiscrape can be found in HACS, src: https://github.com/danieldotnl/ha-multiscrape | |
multiscrape: | |
- resource: 'https://mojlicznik.energa-operator.pl/dp/UserData.do' | |
scan_interval: 43200 # 12h | |
form_submit: | |
submit_once: True | |
resource: 'https://mojlicznik.energa-operator.pl/dp/UserLogin.do' | |
select: "#loginForm" | |
input: | |
j_username: email | |
j_password: 'password' | |
sensor: | |
- unique_id: energa_energy_meter_total_consumption | |
name: Energy meter total consumption | |
device_class: energy | |
state_class: total_increasing | |
unit_of_measurement: kWh | |
select: '#right > table > tr > td.last' | |
value_template: '{{ value | striptags | replace(" ", "") | replace(",", ".") | float }}' | |
on_error: | |
value: last |
Tyle się namęczyłem, a tutaj gotowiec. Ale widzę kilka różnic, więc podrzucam moją wersję:
multiscrape:
- resource: https://mojlicznik.energa-operator.pl/dp/UserData.do
scan_interval: 3600
form_submit:
resource: "https://mojlicznik.energa-operator.pl/dp/UserLogin.do"
select: "form#loginForm"
submit_once: True
resubmit_on_error: True
input:
j_username: "[email protected]"
j_password: "admin123"
sensor:
- unique_id: consumed_energy_total
name: Consumed energy total
select: 'div#right > table > tr:nth-of-type(1) > td.last'
value_template: "{{ value|regex_replace('[^0-9,]', '')|replace(',', '.')|float }}"
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
on_error:
value: last
- unique_id: donated_energy_total
name: Donated energy total
select: 'div#right > table > tr:nth-of-type(3) > td.last'
value_template: "{{ value|regex_replace('[^0-9,]', '')|replace(',', '.')|float }}"
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
on_error:
value: last
Małe rozszerzenie. Działa dla taryfy G12/G12w, licznik dwukierunkowy. Dzięki autorowi.
configuration.yaml:
# Energa operator
multiscrape:
- resource: https://mojlicznik.energa-operator.pl/dp/UserData.do
scan_interval: 3600
form_submit:
resource: "https://mojlicznik.energa-operator.pl/dp/UserLogin.do"
select: "form#loginForm"
submit_once: True
resubmit_on_error: True
input:
j_username: "[email protected]"
j_password: "adminxxx"
sensor:
- unique_id: consumed_energy_total_day
name: Consumed Energy Total Day (A1+)
select: 'div#right > table > tr:nth-of-type(1) > td.last'
value_template: "{{ value|regex_replace('[^0-9,]', '')|replace(',', '.')|float }}"
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
on_error:
value: last
- unique_id: consumed_energy_total_night
name: Consumed Energy Total Night (A2+)
select: 'div#right > table > tr:nth-of-type(3) > td.last'
value_template: "{{ value|regex_replace('[^0-9,]', '')|replace(',', '.')|float }}"
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
on_error:
value: last
# Energia oddana do sieci
- unique_id: donated_energy_total_day
name: Donated Energy Total Day (A1-)
select: 'div#right > table > tr:nth-of-type(5) > td.last'
value_template: "{{ value|regex_replace('[^0-9,]', '')|replace(',', '.')|float }}"
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
on_error:
value: last
- unique_id: donated_energy_total_night
name: Donated Energy Total Night (A2-)
select: 'div#right > table > tr:nth-of-type(7) > td.last'
value_template: "{{ value|regex_replace('[^0-9,]', '')|replace(',', '.')|float }}"
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
on_error:
value: last
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Podany kod dla licznikó dwukierunkowych generuje błąd "missed comma between flow collection entries"
Chociaż to chyba kwestia formatowania a nie kodu