Issues with Sensor Presence Detection and Opacity Changes

Hello, I send a JSON object every second to detect the presence of a sensor, but I've encountered a few issues. When the sensor is present, I want the opacity to be 1; otherwise, it should be 0,1 . My problems are that the opacity doesn't change when I provide true or false. Additionally, when there's only one node template, the opacity is set to 0.1. The second issue is that when I want to detect the sensor's presence, I only return true when the object is sent (the sensor sends a JSON object every second when it's turned on).

[
    {
        "id": "5a4bb44d40a682f2",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "357ca25e9b6ee712",
        "type": "websocket in",
        "z": "5a4bb44d40a682f2",
        "name": "Odczyt pomiaru",
        "server": "1d856c02d0ab13bf",
        "client": "",
        "x": 180,
        "y": 260,
        "wires": [
            [
                "57e722e7b7524efc",
                "5fd40f3c89735ef7"
            ]
        ]
    },
    {
        "id": "57e722e7b7524efc",
        "type": "switch",
        "z": "5a4bb44d40a682f2",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "nnull"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 450,
        "y": 220,
        "wires": [
            [
                "94fe44864192e940"
            ]
        ]
    },
    {
        "id": "94fe44864192e940",
        "type": "change",
        "z": "5a4bb44d40a682f2",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 620,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "5fd40f3c89735ef7",
        "type": "switch",
        "z": "5a4bb44d40a682f2",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "null"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 450,
        "y": 320,
        "wires": [
            [
                "938bee59395c9d68"
            ]
        ]
    },
    {
        "id": "938bee59395c9d68",
        "type": "change",
        "z": "5a4bb44d40a682f2",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "false",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 620,
        "y": 320,
        "wires": [
            []
        ]
    },
    {
        "id": "af3ddc76f04ab40a",
        "type": "ui_template",
        "z": "5a4bb44d40a682f2",
        "group": "41dccb152c047bef",
        "name": " Changing the background transparency for an inactive sensor (sensor1)",
        "order": 2,
        "width": 0,
        "height": 0,
        "format": "<style>\n    #Pomiary_Czujnik_1_cards {\n        opacity: 0.1;\n    }\n</style>\n",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "local",
        "className": "",
        "x": 760,
        "y": 460,
        "wires": [
            []
        ]
    },
    {
        "id": "29a585e4833868ee",
        "type": "inject",
        "z": "5a4bb44d40a682f2",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 150,
        "y": 460,
        "wires": [
            [
                "af3ddc76f04ab40a"
            ]
        ]
    },
    {
        "id": "29c85f71ebbd5523",
        "type": "inject",
        "z": "5a4bb44d40a682f2",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "false",
        "payloadType": "bool",
        "x": 150,
        "y": 540,
        "wires": [
            [
                "2205e12b3bf2ecce"
            ]
        ]
    },
    {
        "id": "2205e12b3bf2ecce",
        "type": "ui_template",
        "z": "5a4bb44d40a682f2",
        "group": "41dccb152c047bef",
        "name": "Changing the background transparency for the active sensor (sensor1)",
        "order": 2,
        "width": 0,
        "height": 0,
        "format": "<style>\n    #Pomiary_Czujnik_1_cards {\n        opacity: 1;\n    }\n</style>\n",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "local",
        "className": "",
        "x": 750,
        "y": 540,
        "wires": [
            []
        ]
    },
    {
        "id": "1d856c02d0ab13bf",
        "type": "websocket-listener",
        "path": "ws://192.168.4.12/ws",
        "wholemsg": "false"
    },
    {
        "id": "41dccb152c047bef",
        "type": "ui_group",
        "name": "Włącz/wyłącz wszystkie pomiary",
        "tab": "d2f241a589e75745",
        "order": 1,
        "disp": true,
        "width": "20",
        "collapse": false,
        "className": ""
    },
    {
        "id": "d2f241a589e75745",
        "type": "ui_tab",
        "name": "Pomiary",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.