Integracja z MójLic...
 
Powiadomienia
Wyczyść wszystko

Integracja z MójLicznik od Energa S.A

76 Wpisów
15 Użytkownicy
13 Likes
10.2 K Wyświetleń
(@tani_kredyt)
Wpisów: 21
Praktykant
 

@tomaszerdmanski 

Może lepiej wkleję jako kod, to nie zniknie:

[
    {
        "id": "d7e67da1d12d4121",
        "type": "tab",
        "label": "MojLicznik",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "e31c842926e2e323",
        "type": "http request",
        "z": "d7e67da1d12d4121",
        "name": "",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "https://mojlicznik.energa-operator.pl/dp/UserLogin.do",
        "tls": "",
        "persist": true,
        "proxy": "",
        "authType": "",
        "senderr": false,
        "x": 290,
        "y": 80,
        "wires": [
            [
                "bbdccdb7c1c17b1c"
            ]
        ]
    },
    {
        "id": "8770dc4fb1a50bc4",
        "type": "inject",
        "z": "d7e67da1d12d4121",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "3600",
        "crontab": "",
        "once": true,
        "onceDelay": "5",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 100,
        "y": 80,
        "wires": [
            [
                "e31c842926e2e323"
            ]
        ]
    },
    {
        "id": "bbdccdb7c1c17b1c",
        "type": "html",
        "z": "d7e67da1d12d4121",
        "name": "Get key required for login",
        "property": "payload",
        "outproperty": "payload",
        "tag": "[name=_antixsrf]",
        "ret": "attr",
        "as": "single",
        "x": 510,
        "y": 80,
        "wires": [
            [
                "5ba109d4c19abc46"
            ]
        ]
    },
    {
        "id": "5ba109d4c19abc46",
        "type": "change",
        "z": "d7e67da1d12d4121",
        "name": "Set request data, headers and cookies",
        "rules": [
            {
                "t": "set",
                "p": "data",
                "pt": "msg",
                "to": "{\"selectedForm\":\"1\",\"save\":\"save\",\"clientOS\":\"web\",\"loginNow\":\"zaloguj+się\"}",
                "tot": "json"
            },
            {
                "t": "set",
                "p": "data[\"_antixsrf\"]",
                "pt": "msg",
                "to": "payload[0].value",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "data",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "cookies",
                "pt": "msg",
                "to": "responseCookies",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "headers",
                "pt": "msg",
                "to": "{\"User-Agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:95.0) Gecko/20100101 Firefox/95.0\",\"Accept\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8\",\"Accept-Language\":\"en-US,en;q=0.5\",\"Accept-Encoding\":\"gzip, deflate, br\",\"Content-Type\":\"application/x-www-form-urlencoded\",\"Origin\":\"https://mojlicznik.energa-operator.pl\",\"DNT\":\"1\",\"Connection\":\"keep-alive\",\"Referer\":\"https://mojlicznik.energa-operator.pl/dp/UserLogin.do\",\"Upgrade-Insecure-Requests\":\"1\",\"Sec-Fetch-Dest\":\"document\",\"Sec-Fetch-Mode\":\"navigate\",\"Sec-Fetch-Site\":\"same-origin\",\"Sec-Fetch-User\":\"?1\"}",
                "tot": "json"
            },
            {
                "t": "delete",
                "p": "headers[\"set-cookie\"]",
                "pt": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 230,
        "y": 160,
        "wires": [
            [
                "fdb7317548b5f408"
            ]
        ]
    },
    {
        "id": "a36fa7aff6ca1df7",
        "type": "http request",
        "z": "d7e67da1d12d4121",
        "name": "",
        "method": "POST",
        "ret": "txt",
        "paytoqs": "body",
        "url": "https://mojlicznik.energa-operator.pl/dp/UserLogin.do",
        "tls": "",
        "persist": true,
        "proxy": "",
        "authType": "",
        "senderr": false,
        "x": 390,
        "y": 260,
        "wires": [
            [
                "4f47e77d6137c267"
            ]
        ]
    },
    {
        "id": "4f47e77d6137c267",
        "type": "html",
        "z": "d7e67da1d12d4121",
        "name": "",
        "property": "payload",
        "outproperty": "payload",
        "tag": "[class=last]",
        "ret": "text",
        "as": "single",
        "x": 550,
        "y": 160,
        "wires": [
            [
                "6a65531b61346744"
            ]
        ]
    },
    {
        "id": "6a65531b61346744",
        "type": "string",
        "z": "d7e67da1d12d4121",
        "name": "",
        "methods": [
            {
                "name": "humanize",
                "params": []
            },
            {
                "name": "replaceAll",
                "params": [
                    {
                        "type": "str",
                        "value": " "
                    },
                    {
                        "type": "str",
                        "value": ""
                    }
                ]
            },
            {
                "name": "replaceAll",
                "params": [
                    {
                        "type": "str",
                        "value": ","
                    },
                    {
                        "type": "str",
                        "value": "."
                    }
                ]
            },
            {
                "name": "toFloat",
                "params": [
                    {
                        "type": "num",
                        "value": "2"
                    }
                ]
            }
        ],
        "prop": "payload[0]",
        "propout": "payload[0]",
        "object": "msg",
        "objectout": "msg",
        "x": 730,
        "y": 140,
        "wires": [
            [
                "b562ed371682c7b5"
            ]
        ]
    },
    {
        "id": "b562ed371682c7b5",
        "type": "string",
        "z": "d7e67da1d12d4121",
        "name": "",
        "methods": [
            {
                "name": "humanize",
                "params": []
            },
            {
                "name": "replaceAll",
                "params": [
                    {
                        "type": "str",
                        "value": " "
                    },
                    {
                        "type": "str",
                        "value": ""
                    }
                ]
            },
            {
                "name": "replaceAll",
                "params": [
                    {
                        "type": "str",
                        "value": ","
                    },
                    {
                        "type": "str",
                        "value": "."
                    }
                ]
            },
            {
                "name": "toFloat",
                "params": [
                    {
                        "type": "num",
                        "value": "2"
                    }
                ]
            }
        ],
        "prop": "payload[1]",
        "propout": "payload[1]",
        "object": "msg",
        "objectout": "msg",
        "x": 870,
        "y": 140,
        "wires": [
            [
                "40aab6834e237229",
                "c709ab68ed240a96"
            ]
        ]
    },
    {
        "id": "40aab6834e237229",
        "type": "api-call-service",
        "z": "d7e67da1d12d4121",
        "name": "",
        "server": "51a55363.7d33bc",
        "version": 3,
        "debugenabled": false,
        "service_domain": "mqtt",
        "service": "publish",
        "entityId": "",
        "data": "{\"topic\":\"/homeassistant/PP\",\"payload\":msg.payload[1]}",
        "dataType": "jsonata",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1070,
        "y": 100,
        "wires": [
            []
        ]
    },
    {
        "id": "c709ab68ed240a96",
        "type": "api-call-service",
        "z": "d7e67da1d12d4121",
        "name": "",
        "server": "51a55363.7d33bc",
        "version": 3,
        "debugenabled": false,
        "service_domain": "mqtt",
        "service": "publish",
        "entityId": "",
        "data": "{\"topic\":\"/homeassistant/PU\",\"payload\":msg.payload[0]}",
        "dataType": "jsonata",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1070,
        "y": 180,
        "wires": [
            []
        ]
    },
    {
        "id": "fdb7317548b5f408",
        "type": "change",
        "z": "d7e67da1d12d4121",
        "name": "Set login and password",
        "rules": [
            {
                "t": "set",
                "p": "payload[\"j_username\"]",
                "pt": "msg",
                "to": "sample@email.com",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "payload[\"j_password\"]",
                "pt": "msg",
                "to": "PASSWORD",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 170,
        "y": 260,
        "wires": [
            [
                "a36fa7aff6ca1df7"
            ]
        ]
    },
    {
        "id": "d553fae76d61a5ec",
        "type": "comment",
        "z": "d7e67da1d12d4121",
        "name": "Hasło i login do  https://mojlicznik.energa-operator.p l",
        "info": "",
        "x": 190,
        "y": 300,
        "wires": []
    },
    {
        "id": "51a55363.7d33bc",
        "type": "server",
        "name": "Home Assistant",
        "addon": true
    }
]
 
Dodane : 24/01/2022 8:51 am
(@mkf118)
Wpisów: 1
Świeżak
 

Witajcie,

Gdzie można szukać problemu?

Przy blokach: SVC mqtt:publish pojawia mi się: "API Error at: Jan 30, 21:40 ?

W debug:

30.01.2022, 21:36:45node: 40aab6834e237229
msg : string[79]
"Call-service error. string value is None for dictionary value @ data['payload']"
30.01.2022, 21:36:45node: c709ab68ed240a96
msg : string[79]
"Call-service error. string value is None for dictionary value @ data['payload']"
30.01.2022, 21:39:30node: 40aab6834e237229
msg : string[79]
"Call-service error. string value is None for dictionary value @ data['payload']"
30.01.2022, 21:39:30node: c709ab68ed240a96
msg : string[79]
"Call-service error. string value is None for dictionary value @ data['payload']"
30.01.2022, 21:45:35node: 40aab6834e237229
msg : string[79]
"Call-service error. string value is None for dictionary value @ data['payload']"
30.01.2022, 21:45:35node: c709ab68ed240a96
msg : string[79]
"Call-service error. string value is None for dictionary value @ data['payload']"

@EDIT

Z powżyszym problemem się uporałem, teraz mam inny problem i zastanawiam się jak sobie z tym poradziliście.

Otóż dane ze strony na energa są z poprzedniego dnia. Posiadam PV i korzystam w HA z zakładki energia gdzie ustawiam sobie encje (live) produkcji z paneli PV. Z tym, że na bieżąco mam informację z inwertera, a z licznika mam info z dnia poprzedniego. Da się to jakoś zsynchronizować, tak żeby dane z licznika były wysyłane w HA na dzień poprzedni?

Inna kwestia, że z portalu energii można ściągać raporty w excelu, które są przypisane do konkretnych dni - ile energi zużyto i ile nadwyżki z produkcji i ile wykorzystano energi z PV. Może ktoś próbował importować z automatu te dane?

 

 

 
Dodane : 30/01/2022 9:48 pm
(@tani_kredyt)
Wpisów: 21
Praktykant
 

@mkf118 

myślałem żeby to jakoś ogarnąć, ale na myśleniu się na ten moment skończyło niestety...

 
Dodane : 01/02/2022 3:17 pm
(@triwolak)
Wpisów: 14
Bywalec
 

@tani_kredyt czy udało Ci się coś podziałać w tym temacie? 

Pozdrawiam,

 
Dodane : 06/11/2022 11:29 am
(@tani_kredyt)
Wpisów: 21
Praktykant
 

@triwolak

Niestety nie udało mi się. Tzn przestałem korzystać z domyślnego dashboardu i zrobiłem swój przy pomocy apex charts gdzie jest parametr offset pozwalający na przesunięcie serii danych o ten jeden dzień. To nie to samo, ale można wyświetlić interesujące dane.

image
 
Dodane : 07/11/2022 5:28 pm
tri wolak reacted
(@triwolak)
Wpisów: 14
Bywalec
 

@tani_kredyt nieźle to wygląda, możesz napisać coś więcej o tej konfiguracji?

Czy jest jakaś możliwość dodania "ręcznie" wcześniejszych wartości, np wygenerowanych z csv?

 
Dodane : 08/11/2022 7:44 am
(@tani_kredyt)
Wpisów: 21
Praktykant
 

@triwolak korzystam z tego:

https://github.com/RomRider/apexcharts-card

Instalacja przez HACS jest prosta. Niestety konfiguracja kart w pełni tekstowa więc czasami trochę się trzeba nadłubać jeżeli domyślny template nie odpowiada. W ramach przykładu mogę wkleić moją konfigurację.

 
Dodane : 08/11/2022 10:05 am
tri wolak reacted
(@triwolak)
Wpisów: 14
Bywalec
 

@tani_kredyt poproszę o konfigurację 🙂

Wpadłem na pomysł połączenia HA z mysql i właśnie próbuję wrzucić historię wygenerowaną w CSV na stronie Energii pod domyślny Dashboard

 
Dodane : 11/11/2022 10:05 pm
(@tani_kredyt)
Wpisów: 21
Praktykant
 

To po kolei:

 

type: custom:apexcharts-card
update_interval: 10m
apex_config:
  chart:
    zoom:
      enabled: true
    toolbar:
      show: true
      tools:
        download: true
        selection: true
        zoom: true
        zoomin: true
        zoomout: true
        pan: true
        reset: true
header:
  show: true
  title: Produkcja vs zużycie energii
  show_states: true
  colorize_states: true
graph_span: 24h
yaxis:
  - id: first
  - id: second
    opposite: true
    min: 0
    max: 100
series:
  - entity: sensor.mm_total_output_power
    type: area
    name: Solar power
    stroke_width: 1
    yaxis_id: first
    group_by:
      duration: 5min
      func: avg
      start_with_last: true
    show:
      in_header: false
  - entity: sensor.sonoff_10013c5f15_power
    type: area
    stroke_width: 1
    name: Heat Pump
    yaxis_id: first
    group_by:
      duration: 5min
      func: avg
      start_with_last: true
    show:
      in_header: false
  - entity: sensor.washing_machine_electricalmeasurement
    type: area
    stroke_width: 1
    name: Washer/Dryer
    yaxis_id: first
    group_by:
      duration: 5min
      func: avg
      start_with_last: true
    show:
      in_header: false

 

type: custom:apexcharts-card
update_interval: 10m
apex_config:
  chart:
    zoom:
      enabled: true
    toolbar:
      show: true
      tools:
        download: true
        selection: true
        zoom: true
        zoomin: true
        zoomout: true
        pan: true
        reset: true
header:
  show: true
  title: Produkcja, zużycie i magazyn wg Energi
  show_states: true
  colorize_states: true
yaxis:
  - id: first
  - id: second
    opposite: true
graph_span: 10d
span:
  end: day
  offset: '-1day'
series:
  - entity: sensor.consumed_energy_total
    name: Power from grid
    type: column
    yaxis_id: first
    offset: +1d
    curve: straight
    show:
      in_header: false
    group_by:
      duration: 1d
      func: diff
      start_with_last: true
  - entity: sensor.stored_energy_total
    name: Power to grid
    type: column
    yaxis_id: first
    curve: straight
    offset: +1d
    show:
      in_header: false
    group_by:
      duration: 1d
      func: diff
      start_with_last: true
  - entity: sensor.grid_energy_storage
    type: line
    yaxis_id: second
    curve: straight
    offset: +1d
    show:
      in_header: false
    group_by:
      duration: 1d
      func: last
      start_with_last: true

 

type: custom:apexcharts-card
update_interval: 10m
apex_config:
  chart:
    zoom:
      enabled: true
    toolbar:
      show: true
      tools:
        download: true
        selection: true
        zoom: true
        zoomin: true
        zoomout: true
        pan: true
        reset: true
header:
  show: true
  title: Produkcja vs zużycie energii dziennie
  show_states: true
  colorize_states: true
yaxis:
  - id: first
  - id: second
    opposite: true
    min: 0
    max: 100
graph_span: 10d
span:
  end: day
series:
  - entity: sensor.mm_total_lifetime_energy_output
    name: Solar production
    type: column
    yaxis_id: first
    group_by:
      duration: 1d
      func: diff
      start_with_last: true
    show:
      in_header: false
  - entity: sensor.sonoff_10013c5f15_energy
    type: column
    yaxis_id: first
    name: Heat Pump
    group_by:
      duration: 1d
      func: last
    show:
      in_header: false
  - entity: sensor.washing_machine_polledsmartenergysummation
    type: column
    yaxis_id: first
    name: Washer/Dryer
    group_by:
      duration: 1d
      func: delta
    show:
      in_header: false

 

type: custom:apexcharts-card
update_interval: 10m
now:
  show: true
apex_config:
  chart:
    zoom:
      enabled: true
    toolbar:
      show: true
      tools:
        download: true
        selection: true
        zoom: true
        zoomin: true
        zoomout: true
        pan: true
        reset: true
header:
  show: true
  title: Produkcja energii vs prognozy
  show_states: true
  colorize_states: true
yaxis:
  - id: first
  - id: second
    opposite: true
    min: 0
    max: 100
graph_span: 10d
span:
  start: day
  offset: '-8d'
series:
  - entity: sensor.energy_production_today_total
    name: Solar production forecast (today)
    type: column
    yaxis_id: first
    group_by:
      duration: 1d
      func: last
      fill: zero
    show:
      in_header: false
  - entity: sensor.energy_production_tomorrow_total
    name: Solar production forecast (tomorrow)
    type: column
    yaxis_id: first
    offset: '-1d'
    show:
      in_header: false
    group_by:
      duration: 1d
      func: last
  - entity: sensor.mm_total_lifetime_energy_output
    name: Solar production
    type: column
    yaxis_id: first
    show:
      in_header: false
    group_by:
      duration: 1d
      func: diff
      start_with_last: true
 
Dodane : 13/11/2022 9:06 am
tri wolak reacted
(@triwolak)
Wpisów: 14
Bywalec
 

Dodane przez: @mkf118

Witajcie,

Gdzie można szukać problemu?

Przy blokach: SVC mqtt:publish pojawia mi się: "API Error at: Jan 30, 21:40 ?

W debug:

30.01.2022, 21:36:45node: 40aab6834e237229
msg : string[79]
"Call-service error. string value is None for dictionary value @ data['payload']"
30.01.2022, 21:36:45node: c709ab68ed240a96
msg : string[79]
"Call-service error. string value is None for dictionary value @ data['payload']"
30.01.2022, 21:39:30node: 40aab6834e237229
msg : string[79]
"Call-service error. string value is None for dictionary value @ data['payload']"
30.01.2022, 21:39:30node: c709ab68ed240a96
msg : string[79]
"Call-service error. string value is None for dictionary value @ data['payload']"
30.01.2022, 21:45:35node: 40aab6834e237229
msg : string[79]
"Call-service error. string value is None for dictionary value @ data['payload']"
30.01.2022, 21:45:35node: c709ab68ed240a96
msg : string[79]
"Call-service error. string value is None for dictionary value @ data['payload']"

@EDIT

Z powżyszym problemem się uporałem, teraz mam inny problem i zastanawiam się jak sobie z tym poradziliście.

Czy mógłbyś napisać, jak poradziłeś sobie z API error?

 

 
Dodane : 08/01/2023 9:52 pm
(@triwolak)
Wpisów: 14
Bywalec
 

@tani_kredyt kolego, a czy jesteś w stanie wstawić taką konfigurację dla taryfy G11 ponieważ zmieniłem?

 
Dodane : 06/04/2023 12:17 pm
tiwek
(@tiwek)
Wpisów: 18
Praktykant
 

Nie przestało wam przypadkiem działać to w ostatnich dniach ??

Próbowałem coś zobaczyć i wydaje mi się, że giną gdzieś ciasteczka dla usunięty link

 
Dodane : 06/04/2023 2:04 pm
(@tani_kredyt)
Wpisów: 21
Praktykant
 

@triwolak Z tym że ja mam G11 więc wszystko co wklejałem powinno działać. Jakiś problem z Dashboardem, czy konfiguracją Node-Red? Jak to drugie to już nie pomoge bo przestałem korzystać. Teraz ściągam przy pomocy multiscrape. Opis jak ustawić jest gdzieś w tym wątku.

 
Dodane : 06/04/2023 3:02 pm
tri wolak reacted
(@triwolak)
Wpisów: 14
Bywalec
 

@tani_kredyt Wyrzuca mi:

"Call-service error. string value is None for dictionary value @ data['payload']"

 

@mkf118 kolego jak sobie z tym poradziłeś?

 
Dodane : 07/04/2023 10:55 am
(@gabrys1)
Wpisów: 1
Świeżak
 

@tiwek Mi przestało działać. Wydaje mi się że to przez to że teraz jak wejdziesz na stronę licznika to wywala jakiś komunikat że strona działa w trybie stabilizacji

 
Dodane : 09/04/2023 11:11 am
tiwek
(@tiwek)
Wpisów: 18
Praktykant
 

@Gabrys1 to napewno przez modyfikacje strony ale ile udalo mi sie sprawdzic to nawet nie dochodzi do zalogowania. Tam pojawily sie nowe cookie ale nie wiem jak sie do nich dobrac

 
Dodane : 09/04/2023 1:47 pm
(@tani_kredyt)
Wpisów: 21
Praktykant
 

Jak zalogowałem się przez przeglądarkę to wyświetliło mi informację o tej stabilizacji (cokolwiek to znaczy). informacja była w okienku i była opcja kliknięcia ‚nie pokazuje więcej’. Po tym sensor bazujący na multiscrape znów zaczął działać.

 
Dodane : 10/04/2023 9:03 pm
tiwek
(@tiwek)
Wpisów: 18
Praktykant
 

@tani_kredyt Czyli sugerujesz się przenieść z node-red na multiscrape ??

 
Dodane : 11/04/2023 7:30 am
(@tani_kredyt)
Wpisów: 21
Praktykant
 

@tiwek efekt taki sam wiec jak działa to pewnie nie ma co zmieniać. Od zera chyba łatwiej multiscrape ustawić jak ktoś jeszcze sie nie bawił w webscraping. 
Ja chciałem ograniczyć liczbę add-ons wiec sie przesiadłem.

 
Dodane : 11/04/2023 5:19 pm
tiwek
(@tiwek)
Wpisów: 18
Praktykant
 

@tani_kredyt Niestety albo mnie zablokowali, albo coś tak pozmieniali, że przestało działać. 

Jak loguje się z przeglądarki to jest ok, a jak puszczam flow z node-red to dostaje "

  PPE jest nieaktywne lub umowa została zakończona.
 
Dodane : 12/04/2023 11:09 am
Strona 3 / 4
Udostępnij: