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 } ]
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?
myślałem żeby to jakoś ogarnąć, ale na myśleniu się na ten moment skończyło niestety...