Untitled

mail@pastecode.io avatar
unknown
json
2 years ago
21 kB
19
Indexable
Never
[
    {
        "id": "3112ac2c0fbf008c",
        "type": "group",
        "z": "8f37cf6cdcaf1128",
        "style": {
            "stroke": "#999999",
            "stroke-opacity": "1",
            "fill": "none",
            "fill-opacity": "1",
            "label": true,
            "label-position": "nw",
            "color": "#a4a4a4"
        },
        "nodes": [
            "75499bf83688f219",
            "b0ce0a5f8f4c3e8e",
            "783adb104be5c841",
            "3c58ba63fad4dccb",
            "0a8fb139e7c977c1",
            "4c9d977cb2e1572c",
            "384aece6d5471100",
            "6979d63a29f3320f",
            "aa14cd26846c375f",
            "a2feab343a668bf4",
            "a25f60655d38b9ea",
            "bd418cc6ebdebda1",
            "86b02fab8e78630a",
            "bd60978fca0d4f6b",
            "793b10175f3d0540",
            "038b6b0c4ae8f243",
            "54d3633e466c010c",
            "68fca7bc985da090",
            "11b4cddf31b1bc59",
            "904c1d3cc85e9b77",
            "8e35b4889fcc7583"
        ],
        "x": 14,
        "y": 2299,
        "w": 2952,
        "h": 442
    },
    {
        "id": "75499bf83688f219",
        "type": "server-state-changed",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "Jeżeli licznik procentów pełnego ładowania laptopa od 0 do 100% osiągnie wartość 100",
        "server": "6eb673d0.397dec",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "input_number.procent_pelnego_naladowania_dell_7773_od_0_do_100",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "100",
        "halt_if_type": "num",
        "halt_if_compare": "gte",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 480,
        "y": 2700,
        "wires": [
            [
                "3c58ba63fad4dccb"
            ],
            []
        ]
    },
    {
        "id": "b0ce0a5f8f4c3e8e",
        "type": "api-call-service",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "Zwiększ licznik Ilości pełnych cykli ładowań baterii od 0 do 100% w zegarku o +1",
        "server": "6eb673d0.397dec",
        "version": 5,
        "debugenabled": false,
        "domain": "counter",
        "service": "increment",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "counter.ilosc_pelnych_cykli_ladowan_baterii_w_dell_7773"
        ],
        "data": "",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1420,
        "y": 2700,
        "wires": [
            []
        ]
    },
    {
        "id": "783adb104be5c841",
        "type": "comment",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "Laptop Dell Inspiron 7773",
        "info": "1. Oblicz różnicę pomiędzy stanem baterii przed i po naładowaniu.\n2. Sprawdź, czy licznik przekroczy 100. Jeżeli tak się stanie odejmij 100 i zwiększ o 1 licznik ilości pełnych cykli ładowań.\n3. Jeżeli zegarek zostanie podłączony lub odłączony od ładowania sprawdź jaki był poprzedni stan pełnego naładowania baterii od 0% do 100% oraz jaka była różnica pomiędzy stanem z przed i po naładowaniu. Następnie dodaj do siebie te dwie wartości i zapisz do input.number jako \"Procent pełnego naładowania zegarka od 0 do 100%\" ",
        "x": 150,
        "y": 2340,
        "wires": []
    },
    {
        "id": "3c58ba63fad4dccb",
        "type": "api-call-service",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "Odejmij 100",
        "server": "6eb673d0.397dec",
        "version": 5,
        "debugenabled": false,
        "domain": "input_number",
        "service": "decrement",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "input_number.procent_pelnego_naladowania_dell_7773_od_0_do_100"
        ],
        "data": "",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 910,
        "y": 2700,
        "wires": [
            [
                "b0ce0a5f8f4c3e8e"
            ]
        ]
    },
    {
        "id": "0a8fb139e7c977c1",
        "type": "comment",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "1 :",
        "info": "",
        "x": 110,
        "y": 2440,
        "wires": []
    },
    {
        "id": "4c9d977cb2e1572c",
        "type": "comment",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "2 :",
        "info": "",
        "x": 110,
        "y": 2700,
        "wires": []
    },
    {
        "id": "384aece6d5471100",
        "type": "join",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "2",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 1150,
        "y": 2440,
        "wires": [
            [
                "6979d63a29f3320f"
            ]
        ]
    },
    {
        "id": "6979d63a29f3320f",
        "type": "function",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "Oblicz różnicę pomiędzy stanem przed naładowaniem a po naładowaniu",
        "func": "msg.topic = \"diff\"\nmsg.payload = msg.payload.battery_max - msg.payload.battery_min;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1500,
        "y": 2440,
        "wires": [
            [
                "a2feab343a668bf4",
                "a25f60655d38b9ea",
                "904c1d3cc85e9b77"
            ]
        ]
    },
    {
        "id": "aa14cd26846c375f",
        "type": "api-call-service",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "Dodaj tą wartość do licznika",
        "server": "6eb673d0.397dec",
        "version": 5,
        "debugenabled": false,
        "domain": "input_number",
        "service": "set_value",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "input_number.procent_pelnego_naladowania_dell_7773_od_0_do_100"
        ],
        "data": "{\"value\":\"{{payload}}\"}",
        "dataType": "json",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 2820,
        "y": 2440,
        "wires": [
            []
        ]
    },
    {
        "id": "a2feab343a668bf4",
        "type": "join",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "2",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 1910,
        "y": 2440,
        "wires": [
            [
                "bd418cc6ebdebda1"
            ]
        ]
    },
    {
        "id": "a25f60655d38b9ea",
        "type": "api-current-state",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "Jaki jest stan licznika naładowania baterii w HA?",
        "server": "6eb673d0.397dec",
        "version": 3,
        "outputs": 1,
        "halt_if": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "input_number.procent_pelnego_naladowania_dell_7773_od_0_do_100",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "counter_lvl",
                "valueType": "str"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 1580,
        "y": 2520,
        "wires": [
            [
                "793b10175f3d0540"
            ]
        ]
    },
    {
        "id": "bd418cc6ebdebda1",
        "type": "function",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "Dodaj różnicę do obecnego stanu licznika naładowania baterii w HA przy pomocy funkcji",
        "func": "msg.topic = \"counter_lvl\"\nmsg.payload = msg.payload.diff + msg.payload.counter_lvl;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2330,
        "y": 2440,
        "wires": [
            [
                "bd60978fca0d4f6b",
                "aa14cd26846c375f"
            ]
        ]
    },
    {
        "id": "86b02fab8e78630a",
        "type": "change",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "Zmień string na wartość liczbową",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$number(payload)",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 900,
        "y": 2440,
        "wires": [
            [
                "384aece6d5471100",
                "8e35b4889fcc7583"
            ]
        ]
    },
    {
        "id": "bd60978fca0d4f6b",
        "type": "debug",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "Dodaj różnicę do licznika",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 2790,
        "y": 2520,
        "wires": []
    },
    {
        "id": "793b10175f3d0540",
        "type": "change",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "Zmień string na wartość liczbową",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$number(payload)",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1940,
        "y": 2520,
        "wires": [
            [
                "a2feab343a668bf4"
            ]
        ]
    },
    {
        "id": "038b6b0c4ae8f243",
        "type": "ha-wait-until",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "Czekaj na odłączenie ładowania",
        "server": "6eb673d0.397dec",
        "version": 2,
        "outputs": 1,
        "entityId": "sensor.dellinspiron7773_battery_powerline_status",
        "entityIdFilterType": "exact",
        "property": "state",
        "comparator": "is",
        "value": "Offline",
        "valueType": "str",
        "timeout": "0",
        "timeoutType": "num",
        "timeoutUnits": "seconds",
        "checkCurrentState": true,
        "blockInputOverrides": true,
        "outputProperties": [],
        "x": 310,
        "y": 2580,
        "wires": [
            [
                "54d3633e466c010c"
            ]
        ]
    },
    {
        "id": "54d3633e466c010c",
        "type": "api-current-state",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "Jaki jest poziom baterii?",
        "server": "6eb673d0.397dec",
        "version": 3,
        "outputs": 1,
        "halt_if": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "sensor.dellinspiron7773_battery_charge_remaining_percentage",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "battery_max",
                "valueType": "str"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 590,
        "y": 2580,
        "wires": [
            [
                "86b02fab8e78630a"
            ]
        ]
    },
    {
        "id": "68fca7bc985da090",
        "type": "api-current-state",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "Jaki jest poziom baterii?",
        "server": "6eb673d0.397dec",
        "version": 3,
        "outputs": 1,
        "halt_if": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "sensor.dellinspiron7773_battery_charge_remaining_percentage",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "battery_min",
                "valueType": "str"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 550,
        "y": 2440,
        "wires": [
            [
                "038b6b0c4ae8f243",
                "86b02fab8e78630a"
            ]
        ]
    },
    {
        "id": "11b4cddf31b1bc59",
        "type": "server-state-changed",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "Podłączony do ładowania",
        "server": "6eb673d0.397dec",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "sensor.dellinspiron7773_battery_powerline_status",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "Online",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": true,
        "ignorePrevStateUnknown": true,
        "ignorePrevStateUnavailable": true,
        "ignoreCurrentStateUnknown": true,
        "ignoreCurrentStateUnavailable": true,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "new",
                "valueType": "str"
            }
        ],
        "x": 290,
        "y": 2440,
        "wires": [
            [
                "68fca7bc985da090"
            ],
            []
        ]
    },
    {
        "id": "904c1d3cc85e9b77",
        "type": "debug",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "Różnica po naładowaniu",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1891,
        "y": 2350,
        "wires": []
    },
    {
        "id": "8e35b4889fcc7583",
        "type": "debug",
        "z": "8f37cf6cdcaf1128",
        "g": "3112ac2c0fbf008c",
        "name": "Zmiana stringu",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1180,
        "y": 2560,
        "wires": []
    },
    {
        "id": "6eb673d0.397dec",
        "type": "server",
        "name": "Home Assistant",
        "version": 5,
        "addon": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": 30,
        "areaSelector": "friendlyName",
        "deviceSelector": "friendlyName",
        "entitySelector": "friendlyName",
        "statusSeparator": "at: ",
        "statusYear": "hidden",
        "statusMonth": "short",
        "statusDay": "numeric",
        "statusHourCycle": "h23",
        "statusTimeFormat": "h:m",
        "enableGlobalContextStore": true
    }
]