Supergiovane / node-red-contrib-boolean-logic-ultimate

Enhanced boolean logic with persistent values after reboot and more
https://www.youtube.com/watch?v=sYc6L5QQrTw&list=PL9Yh1bjbLAYoRH4IyQB7EL5srHAihiKpy
MIT License
27 stars 3 forks source link

Arrived topic issues #36

Closed lgwapnitsky closed 1 year ago

lgwapnitsky commented 1 year ago

I have a boolean gate set up with 5 inputs, but, at max, only 2 are reaching the gate and being operated on. I've set my delay to 2000ms, but still the same thing.

I've verified that my inputs are receiving valid data via debug statements.

Advice is welcome

Supergiovane commented 1 year ago

Hi Can you post here your flow, please?

lgwapnitsky commented 1 year ago
[
    {
        "id": "0352c1183c2799fc",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "ecf3802aa2f2206a",
        "type": "api-current-state",
        "z": "0352c1183c2799fc",
        "name": "",
        "server": "1dda1e5c43c20797",
        "version": 3,
        "outputs": 1,
        "halt_if": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "light.den_corner_light_1_2",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 765,
        "y": 280,
        "wires": [
            [
                "0d1ab538d49d0b3e"
            ]
        ],
        "l": false
    },
    {
        "id": "a95c7726382b29cd",
        "type": "api-current-state",
        "z": "0352c1183c2799fc",
        "name": "",
        "server": "1dda1e5c43c20797",
        "version": 3,
        "outputs": 1,
        "halt_if": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "light.den_corner_light_2_2",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "true",
                "valueType": "bool"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 765,
        "y": 340,
        "wires": [
            [
                "0d1ab538d49d0b3e"
            ]
        ],
        "l": false
    },
    {
        "id": "3366fde03af6c85c",
        "type": "api-current-state",
        "z": "0352c1183c2799fc",
        "name": "",
        "server": "1dda1e5c43c20797",
        "version": 3,
        "outputs": 1,
        "halt_if": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "light.den_corner_light_3_2",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "true",
                "valueType": "bool"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 765,
        "y": 400,
        "wires": [
            [
                "0d1ab538d49d0b3e"
            ]
        ],
        "l": false
    },
    {
        "id": "e94c5f58056120c5",
        "type": "api-current-state",
        "z": "0352c1183c2799fc",
        "name": "",
        "server": "1dda1e5c43c20797",
        "version": 3,
        "outputs": 1,
        "halt_if": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "light.den_corner_light_4_2",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "true",
                "valueType": "bool"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 765,
        "y": 440,
        "wires": [
            [
                "0d1ab538d49d0b3e"
            ]
        ],
        "l": false
    },
    {
        "id": "e00b4d28fccb6943",
        "type": "api-current-state",
        "z": "0352c1183c2799fc",
        "name": "",
        "server": "1dda1e5c43c20797",
        "version": 3,
        "outputs": 1,
        "halt_if": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "light.den_corner_light_5_2",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "true",
                "valueType": "bool"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 765,
        "y": 480,
        "wires": [
            [
                "0d1ab538d49d0b3e"
            ]
        ],
        "l": false
    },
    {
        "id": "81c0f21eab45e56f",
        "type": "inject",
        "z": "0352c1183c2799fc",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 540,
        "y": 360,
        "wires": [
            [
                "ecf3802aa2f2206a",
                "a95c7726382b29cd",
                "3366fde03af6c85c",
                "e94c5f58056120c5",
                "e00b4d28fccb6943"
            ]
        ]
    },
    {
        "id": "96b92a36347bb8a1",
        "type": "debug",
        "z": "0352c1183c2799fc",
        "name": "debug 64",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1240,
        "y": 340,
        "wires": []
    },
    {
        "id": "0d1ab538d49d0b3e",
        "type": "BooleanLogicUltimate",
        "z": "0352c1183c2799fc",
        "name": "",
        "payloadPropName": "topic",
        "filtertrue": "both",
        "persist": false,
        "sInitializeWith": "WaitForPayload",
        "triggertopic": "trigger",
        "outputtriggeredby": "all",
        "inputCount": "5",
        "topic": "result",
        "restrictinputevaluation": false,
        "delayEvaluation": "5000",
        "x": 1060,
        "y": 380,
        "wires": [
            [],
            [
                "96b92a36347bb8a1"
            ],
            []
        ]
    },
    {
        "id": "1dda1e5c43c20797",
        "type": "server",
        "name": "Home Assistant",
        "version": 5,
        "addon": false,
        "rejectUnauthorizedCerts": false,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": "30",
        "areaSelector": "friendlyName",
        "deviceSelector": "friendlyName",
        "entitySelector": "friendlyName",
        "statusSeparator": ": ",
        "statusYear": "hidden",
        "statusMonth": "short",
        "statusDay": "numeric",
        "statusHourCycle": "default",
        "statusTimeFormat": "h:m",
        "enableGlobalContextStore": false
    }
]
Supergiovane commented 1 year ago

Hi Larry you must change this field to "payload". You cannot use "topic" as input value, because "topic" is used by the node, to fill the name/value pairs. Also be sure to send a different topic for each of your payload to be evaluated.

Node-RED
lgwapnitsky commented 1 year ago

I tried that as well.with the same results. I forgot to change it back before I sent it.

On Mon, Feb 13, 2023, 01:54 Massimo Saccani @.***> wrote:

Closed #36 https://github.com/Supergiovane/node-red-contrib-boolean-logic-ultimate/issues/36 as completed.

— Reply to this email directly, view it on GitHub https://github.com/Supergiovane/node-red-contrib-boolean-logic-ultimate/issues/36#event-8500885592, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE6CFADKZZ6S2WCGGYH6J3WXHLARANCNFSM6AAAAAAUZQYNXA . You are receiving this because you authored the thread.Message ID: <Supergiovane/node-red-contrib-boolean-logic-ultimate/issue/36/issue_event/8500885592 @github.com>

Supergiovane commented 1 year ago

Hi Larry as i don't have Homeassistant, i cannot fully test your flow. Can you please paste here, the output JSON of your homeassistant nodes? Other than that, are you sure to send a different "topic" property for each homeassistant node?

lgwapnitsky commented 1 year ago

also, regarding different topics, what i'm testing has on/off. What would I need to change that to?

On Mon, Feb 13, 2023 at 7:11 AM Larry Wapnitsky @.***> wrote:

I tried that as well.with the same results. I forgot to change it back before I sent it.

On Mon, Feb 13, 2023, 01:54 Massimo Saccani @.***> wrote:

Closed #36 https://github.com/Supergiovane/node-red-contrib-boolean-logic-ultimate/issues/36 as completed.

— Reply to this email directly, view it on GitHub https://github.com/Supergiovane/node-red-contrib-boolean-logic-ultimate/issues/36#event-8500885592, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE6CFADKZZ6S2WCGGYH6J3WXHLARANCNFSM6AAAAAAUZQYNXA . You are receiving this because you authored the thread.Message ID: <Supergiovane/node-red-contrib-boolean-logic-ultimate/issue/36/issue_event/8500885592 @github.com>

Supergiovane commented 1 year ago

Hi Larry On/Off is perfectly fine, because boolean-logic-ultimate supports homeassistant payload.

You need to add a function node that send different topics, like this:

msg.topic = "1"
return msg

Import this code onto your flow: [{"id":"96b92a36347bb8a1","type":"debug","z":"0352c1183c2799fc","name":"debug 64","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1280,"y":240,"wires":[]},{"id":"0d1ab538d49d0b3e","type":"BooleanLogicUltimate","z":"0352c1183c2799fc","name":"","payloadPropName":"topic","filtertrue":"both","persist":false,"sInitializeWith":"WaitForPayload","triggertopic":"trigger","outputtriggeredby":"all","inputCount":"5","topic":"result","restrictinputevaluation":false,"delayEvaluation":"5000","x":1180,"y":360,"wires":[[],["96b92a36347bb8a1"],[]]},{"id":"f96a46a7cafe7206","type":"function","z":"0352c1183c2799fc","name":"set topic 1","func":"msg.topic = \"1\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":930,"y":280,"wires":[["0d1ab538d49d0b3e"]]},{"id":"22aa1aa6a2c56005","type":"function","z":"0352c1183c2799fc","name":"set topic 2","func":"msg.topic = \"2\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":930,"y":340,"wires":[["0d1ab538d49d0b3e"]]},{"id":"55a2e6fce63b250b","type":"function","z":"0352c1183c2799fc","name":"set topic 3","func":"msg.topic = \"3\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":930,"y":400,"wires":[["0d1ab538d49d0b3e"]]},{"id":"dee2726ec7c620e3","type":"function","z":"0352c1183c2799fc","name":"set topic 4 ","func":"msg.topic = \"4\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":930,"y":440,"wires":[["0d1ab538d49d0b3e"]]},{"id":"32a34143ac391eec","type":"function","z":"0352c1183c2799fc","name":"set topic 5","func":"msg.topic = \"5\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":930,"y":480,"wires":[["0d1ab538d49d0b3e"]]}]

You should obtain something like this. I also suggest to read the man github page of the node.

Node-RED