Git Product home page Git Product logo

node-red-contrib-light-transition's People

Contributors

dependabot[bot] avatar mochman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

node-red-contrib-light-transition's Issues

Possibility to use brightness (0-255) instead of percentage

Awesome node. I've just used it to dim some IKEA bulbs and it works great. However, I had to use a function, because I grab my bulb's brightness first, and then pass that into the change node. When I grab my bulb's brightness, I do not get a percentage back, but instead get a 0-255 value.

It would be great if transitioning between 0 and 255 is possible with 2 more attributes (optional of course). Here is my workaround:

Create a new function node:

function newBrightness(current_brightness) {
    newBrightnessPct = (current_brightness / 256) * 100
    return Math.max(0, Math.min(100, Math.round(newBrightnessPct)))
}
    
newMsg = {
    payload: {
        "data": {
            "entity_id": msg.topic,
            "old_brightness": msg.data.attributes.brightness,
            "brightness_pct": newBrightness(msg.data.attributes.brightness)
        }
    }
}

return newMsg;

That converts 255 to 100%, 127 to 50%, and so on.

Then pass that node to the change node (look at startBright):

{
    "duration": 5,
    "units": "Second",
    "steps": 10,
    "startRGB": "#ffffff",
    "transitionRGB": "#ffffff",
    "endRGB": "#ffffff",
    "startBright": msg.payload.data.brightness_pct,
    "endBright": 100,
    "transitionType": "Linear",
    "colorTranstitionType": "None"
}

Thanks

Problem - RGB value components over 255

Terms

  • This request is not a duplicate of an existing issue.
  • I have provided as much information as I can to help resolve this issue.

Description

Hi,
msg.payload.rgb_color componets return value higher then 255. It was "fixed" in #10, but it is still occures. (I am not sure how to reopen closed issue)

steps-to-reproduce

Set:
Steps number: 60
Starting color: 194, 168, 0
Middle color: 255, 200, 100 does not matter
End color: 255, 0, 0
Transition: No Transition Color

Actual Behavior

Between steps 31 to 32 color component (red) changed value from 254 to 256. In next steps is growing high above 255.

step 31
{"_msgid":"eab6f05cb79027af","payload":{"brightness_pct":100,"brightness":255,"rgb_color":[254,108,0],"color_temp":403},"topic":""}

step 32
{"_msgid":"eab6f05cb79027af","payload":{"brightness_pct":100,"brightness":255,"rgb_color":[256,106,0],"color_temp":410},"topic":""}

step 33
{"_msgid":"eab6f05cb79027af","payload":{"brightness_pct":100,"brightness":255,"rgb_color":[258,104,0],"color_temp":416},"topic":""}

Version

1.7.0

JSON of node setup

No response

RGB value above 255

Hi!

I'm using v1.4.2 and i'm still getting values above 255 when using the "Half & Half" mode. (pictuere in attachement)

grafik

Thanks for your help,

Mua

Too much steps mess things up with RGB

Terms

  • This request is not a duplicate of an existing issue.
  • I have provided as much information as I can to help resolve this issue.

Description

Describe the problem.

I noticed that using the Weighted transition for colors with high number of steps actually reduce of nullify the number of steps.

I create a little flow to check it up
image

[
    {
        "id": "80fe75b2a24333a9",
        "type": "group",
        "z": "e1f44cc40f36d3a0",
        "name": "BUG",
        "style": {
            "label": true,
            "stroke": "#ff0000"
        },
        "nodes": [
            "8fdda0823adf3eb7",
            "03872151ea5e959d",
            "5606ef80aa8da72c",
            "61a4898846598603",
            "6e163a42342e938a",
            "c549a82fd681ead5",
            "b890ef6d32e57859",
            "a4e38f2c210bdea7",
            "0ab70d77e4d680a3",
            "7ada516bbca9873f"
        ],
        "x": 28,
        "y": 1893,
        "w": 1038,
        "h": 554
    },
    {
        "id": "8fdda0823adf3eb7",
        "type": "light-transition",
        "z": "e1f44cc40f36d3a0",
        "g": "80fe75b2a24333a9",
        "name": "Transition",
        "startRGB": "#ffffff",
        "transitionRGB": "#ffc864",
        "endRGB": "#ff0000",
        "startMired": "",
        "endMired": "",
        "transitionTime": "1800",
        "transitionTimeUnits": "Second",
        "steps": "1800",
        "startBright": "100",
        "endBright": "1",
        "brightnessType": "Percent",
        "transitionType": "Linear",
        "colorTransitionType": "Weighted",
        "x": 460,
        "y": 2060,
        "wires": [
            [
                "61a4898846598603"
            ],
            [
                "c549a82fd681ead5"
            ]
        ]
    },
    {
        "id": "03872151ea5e959d",
        "type": "debug",
        "z": "e1f44cc40f36d3a0",
        "g": "80fe75b2a24333a9",
        "name": "Color steps counter",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 930,
        "y": 2100,
        "wires": []
    },
    {
        "id": "5606ef80aa8da72c",
        "type": "debug",
        "z": "e1f44cc40f36d3a0",
        "g": "80fe75b2a24333a9",
        "name": "RGB",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload.rgb_color",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 970,
        "y": 2040,
        "wires": []
    },
    {
        "id": "61a4898846598603",
        "type": "rbe",
        "z": "e1f44cc40f36d3a0",
        "g": "80fe75b2a24333a9",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload.rgb_color",
        "topi": "topic",
        "x": 630,
        "y": 2040,
        "wires": [
            [
                "6e163a42342e938a"
            ]
        ]
    },
    {
        "id": "6e163a42342e938a",
        "type": "function",
        "z": "e1f44cc40f36d3a0",
        "g": "80fe75b2a24333a9",
        "name": "function 1",
        "func": "// Controlla se il contatore esiste già nel contesto del flusso\nlet count = flow.get('count') || 0;\n\n// Incrementa il contatore\ncount += 1;\n\n// Salva il contatore nel contesto del flusso\nflow.set('count', count);\n\n// Aggiungi il contatore come una nuova proprietà del messaggio\nmsg.count = count;\n\n// Restituisci il messaggio per inviarlo al prossimo nodo\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 800,
        "y": 2040,
        "wires": [
            [
                "5606ef80aa8da72c"
            ]
        ]
    },
    {
        "id": "c549a82fd681ead5",
        "type": "change",
        "z": "e1f44cc40f36d3a0",
        "g": "80fe75b2a24333a9",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "count",
                "tot": "flow"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 660,
        "y": 2100,
        "wires": [
            [
                "03872151ea5e959d"
            ]
        ]
    },
    {
        "id": "b890ef6d32e57859",
        "type": "change",
        "z": "e1f44cc40f36d3a0",
        "g": "80fe75b2a24333a9",
        "name": "reset",
        "rules": [
            {
                "t": "set",
                "p": "count",
                "pt": "flow",
                "to": "0",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 310,
        "y": 2060,
        "wires": [
            [
                "8fdda0823adf3eb7"
            ]
        ]
    },
    {
        "id": "a4e38f2c210bdea7",
        "type": "group",
        "z": "e1f44cc40f36d3a0",
        "g": "80fe75b2a24333a9",
        "name": "OK",
        "style": {
            "label": true
        },
        "nodes": [
            "f53f71f18c43d04f",
            "6ecaf814d665528d",
            "fdc8af069a7f5ad7"
        ],
        "x": 54,
        "y": 1919,
        "w": 172,
        "h": 162
    },
    {
        "id": "f53f71f18c43d04f",
        "type": "inject",
        "z": "e1f44cc40f36d3a0",
        "g": "a4e38f2c210bdea7",
        "name": "255",
        "props": [
            {
                "p": "transition.duration",
                "v": "1",
                "vt": "num"
            },
            {
                "p": "transition.steps",
                "v": "255",
                "vt": "num"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 150,
        "y": 1960,
        "wires": [
            [
                "b890ef6d32e57859"
            ]
        ]
    },
    {
        "id": "6ecaf814d665528d",
        "type": "inject",
        "z": "e1f44cc40f36d3a0",
        "g": "a4e38f2c210bdea7",
        "name": "256",
        "props": [
            {
                "p": "transition.duration",
                "v": "1",
                "vt": "num"
            },
            {
                "p": "transition.steps",
                "v": "256",
                "vt": "num"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 150,
        "y": 2000,
        "wires": [
            [
                "b890ef6d32e57859"
            ]
        ]
    },
    {
        "id": "fdc8af069a7f5ad7",
        "type": "inject",
        "z": "e1f44cc40f36d3a0",
        "g": "a4e38f2c210bdea7",
        "name": "259",
        "props": [
            {
                "p": "transition.duration",
                "v": "1",
                "vt": "num"
            },
            {
                "p": "transition.steps",
                "v": "259",
                "vt": "num"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 150,
        "y": 2040,
        "wires": [
            [
                "b890ef6d32e57859"
            ]
        ]
    },
    {
        "id": "0ab70d77e4d680a3",
        "type": "group",
        "z": "e1f44cc40f36d3a0",
        "g": "80fe75b2a24333a9",
        "name": "NOT OK",
        "style": {
            "label": true
        },
        "nodes": [
            "147627cdab4a5cdb",
            "32aa788e8a0d8fb7"
        ],
        "x": 54,
        "y": 2099,
        "w": 172,
        "h": 122
    },
    {
        "id": "147627cdab4a5cdb",
        "type": "inject",
        "z": "e1f44cc40f36d3a0",
        "g": "0ab70d77e4d680a3",
        "name": "260",
        "props": [
            {
                "p": "transition.duration",
                "v": "1",
                "vt": "num"
            },
            {
                "p": "transition.steps",
                "v": "260",
                "vt": "num"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 150,
        "y": 2140,
        "wires": [
            [
                "b890ef6d32e57859"
            ]
        ]
    },
    {
        "id": "32aa788e8a0d8fb7",
        "type": "inject",
        "z": "e1f44cc40f36d3a0",
        "g": "0ab70d77e4d680a3",
        "name": "500",
        "props": [
            {
                "p": "transition.duration",
                "v": "1",
                "vt": "num"
            },
            {
                "p": "transition.steps",
                "v": "500",
                "vt": "num"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 150,
        "y": 2180,
        "wires": [
            [
                "b890ef6d32e57859"
            ]
        ]
    },
    {
        "id": "7ada516bbca9873f",
        "type": "group",
        "z": "e1f44cc40f36d3a0",
        "g": "80fe75b2a24333a9",
        "name": "NOT EVEN CLOSE",
        "style": {
            "label": true
        },
        "nodes": [
            "127c308392d76255",
            "1f64774dfe6c13ee",
            "6fb3ce918b9dfa99"
        ],
        "x": 54,
        "y": 2259,
        "w": 172,
        "h": 162
    },
    {
        "id": "127c308392d76255",
        "type": "inject",
        "z": "e1f44cc40f36d3a0",
        "g": "7ada516bbca9873f",
        "name": "502",
        "props": [
            {
                "p": "transition.duration",
                "v": "1",
                "vt": "num"
            },
            {
                "p": "transition.steps",
                "v": "502",
                "vt": "num"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 150,
        "y": 2300,
        "wires": [
            [
                "b890ef6d32e57859"
            ]
        ]
    },
    {
        "id": "1f64774dfe6c13ee",
        "type": "inject",
        "z": "e1f44cc40f36d3a0",
        "g": "7ada516bbca9873f",
        "name": "600",
        "props": [
            {
                "p": "transition.duration",
                "v": "1",
                "vt": "num"
            },
            {
                "p": "transition.steps",
                "v": "600",
                "vt": "num"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 150,
        "y": 2340,
        "wires": [
            [
                "b890ef6d32e57859"
            ]
        ]
    },
    {
        "id": "6fb3ce918b9dfa99",
        "type": "inject",
        "z": "e1f44cc40f36d3a0",
        "g": "7ada516bbca9873f",
        "name": "900",
        "props": [
            {
                "p": "transition.duration",
                "v": "1",
                "vt": "num"
            },
            {
                "p": "transition.steps",
                "v": "900",
                "vt": "num"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 150,
        "y": 2380,
        "wires": [
            [
                "b890ef6d32e57859"
            ]
        ]
    }
]

The flow counts the number of messages with different RGB values. The debug in the OK group have a valid number of steps produced. Increasing the number of steps (the group NOT OK) produce some wierdly low number of steps and the group NOT EVEN CLOSE produce no variation at all except 3 fixed points.

I haven't see the code yet but it seems that the node works on a rounded version of the number instead having a floating point and returning the rounded version.

Can you be interested in a PR? Or did I provide enought to help you easily find (and fix) the issue?

steps-to-reproduce

run the flow provided

Actual Behavior

Increasing the number of steps acctually reduce the number of variation in RGB transition

Version

0.0.18

JSON of node setup

No response

Brightness after stop is not the same as settings.

After firing the node the first time everything works like a charm. When sending a stop command and a new start command the brightness has not been reset to the initial values. The color_temp instead is working correctly.

afbeelding

There is no information passed trough via previous nodes. The payload has only the string text off (the node before checks if the lights are off).
If i move the light transition node around and press the save button (only changed nodes save) everything is working correctly, until one time. After that it start over like above.

afbeelding
afbeelding

payload.brightness

Dimmers like shelly uses "payload.brightness" and not "payload.brightness_pct". The node should output both, or a way to change the output payload.

Transition to zero brightness

Terms

  • This request is not a duplicate of an existing issue.
  • I have provided as much information as I can to help resolve this issue.

Description

Describe the problem.

Currently, this works well for transitioning between different "on" states. I'm looking for it to also handle fade down to off state.

The brightness variable throws an error if I enter a zero, though it really is the end value I'm looking for.
transition error

steps-to-reproduce

  1. Go to properties of transition node...
  2. Click on ending brightness and set it to "0" (zero)
  3. Run the deploy button.

Actual Behavior

zero brightness error

Version

1.4.6

JSON of node setup

[{"id":"b8e9e09679289844","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"231486a205fabf48","type":"group","z":"b8e9e09679289844","name":"Front Lights Timer","style":{"label":true,"fill":"#001f60","stroke":"#3f5787"},"nodes":["aec4f4be5967b86c","1e6e34c3f89e6338","83df93c7fe145af8","2248c4127cc3ef18","f03b2691dff86f8e","7236318e1c352822"],"x":414,"y":139,"w":772,"h":162,"info":"# Front light timer\nTurns on all the smart bulbs in front of the house.\nCurrently, those are:\n * Front porch light\n * Yard light (on the pole)\n * Garage light right (as facing gagage)\n * Garage light left (as facing garage)\n \n Brightness is set to 80%.\n\n\n## To-do\n * **Check that the on-and-off points are suitable.**  The lights should come on prior to it getting noticeably dark and should go off after it is light enough.  This is based on some amount of time before sunset and after sunrise, as calculated by Node-RED for out lat-lon.\n * **Transition lights on and off.**  Currently, the Tuya bulbs don't provide transition (can change setting over some designated length of time, such as gradually adjusting the brightness to full over 10 seconds, for example).  Need to replace bulbs with bulbs that will.\n * **Check the color temperature.**  Set the warmness to an appropriate value.  Don't want them too blue; prefer something on the warmer side.\n * **Change brightness for different times of the night.**  The lights don't need to be full bright all night.  Should adjust based on time AND on triggers (they should go full bright if something interesting is happening).\n * **Adjust color based on event.**  If nighttime viewing is desired (rocket launch, for example), the color of the lights could be set to red (better for the eyes in the dark).  Other color settings could be based on who is here, events, other conditions (as an indicator or reminder).\n"},{"id":"aec4f4be5967b86c","type":"light-transition","z":"b8e9e09679289844","g":"231486a205fabf48","name":"Fade down","startRGB":"#ffffff","transitionRGB":"#f57f7f","endRGB":"#000000","startMired":"343","endMired":"343","transitionTime":"30","transitionTimeUnits":"Minute","steps":"30","startBright":"100","endBright":"0","brightnessType":"Percent","transitionType":"Linear","colorTransitionType":"None","x":890,"y":260,"wires":[["2248c4127cc3ef18","58c245d35462212a"],["f1d7cb9991a2bf89"]]},{"id":"1e6e34c3f89e6338","type":"light-transition","z":"b8e9e09679289844","g":"231486a205fabf48","name":"Fade up","startRGB":"#000000","transitionRGB":"#f57f7f","endRGB":"#ffffff","startMired":"343","endMired":"343","transitionTime":"30","transitionTimeUnits":"Minute","steps":"30","startBright":"1","endBright":"100","brightnessType":"Percent","transitionType":"Linear","colorTransitionType":"None","x":880,"y":180,"wires":[["f03b2691dff86f8e","58c245d35462212a"],[]]},{"id":"83df93c7fe145af8","type":"light-scheduler","z":"b8e9e09679289844","d":true,"g":"231486a205fabf48","settings":"6e83e123e9731bd7","events":"[{\"start\":{\"dow\":0,\"mod\":0},\"end\":{\"dow\":1,\"mod\":0}},{\"start\":{\"dow\":1,\"mod\":0},\"end\":{\"dow\":2,\"mod\":0}},{\"start\":{\"dow\":2,\"mod\":0},\"end\":{\"dow\":3,\"mod\":0}},{\"start\":{\"dow\":3,\"mod\":0},\"end\":{\"dow\":4,\"mod\":0}},{\"start\":{\"dow\":4,\"mod\":0},\"end\":{\"dow\":5,\"mod\":0}},{\"start\":{\"dow\":5,\"mod\":0},\"end\":{\"dow\":6,\"mod\":0}},{\"start\":{\"dow\":6,\"mod\":0},\"end\":{\"dow\":0,\"mod\":0}}]","topic":"light","name":"Front light timer","onPayload":"on","onPayloadType":"str","offPayload":"off","offPayloadType":"str","onlyWhenDark":true,"scheduleRndMax":0,"sunElevationThreshold":"6","sunShowElevationInStatus":true,"outputfreq":"output.statechange","x":520,"y":180,"wires":[["7236318e1c352822"]]},{"id":"2248c4127cc3ef18","type":"api-call-service","z":"b8e9e09679289844","g":"231486a205fabf48","name":"Front lights off","server":"516c2498.f1e86c","version":4,"debugenabled":false,"domain":"light","service":"turn_on","target":{"areaId":[],"deviceId":[],"entityId":["light.family_room_couch_left"]},"data":"{\t\"brightness_pct\" : payload.brightness_pct,\t\"color_temp\" : payload.color_temp\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1080,"y":260,"wires":[[]]},{"id":"f03b2691dff86f8e","type":"api-call-service","z":"b8e9e09679289844","g":"231486a205fabf48","name":"Front lights on","server":"516c2498.f1e86c","version":4,"debugenabled":false,"domain":"light","service":"turn_on","target":{"areaId":[],"deviceId":[],"entityId":["light.family_room_couch_left"]},"data":"{\t\"brightness_pct\" : payload.brightness_pct,\t\"color_temp\" : payload.color_temp\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1080,"y":180,"wires":[[]]},{"id":"7236318e1c352822","type":"switch","z":"b8e9e09679289844","g":"231486a205fabf48","name":"on or off?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":700,"y":220,"wires":[["1e6e34c3f89e6338"],["aec4f4be5967b86c"]]},{"id":"3b1907c6e2c675d8","type":"inject","z":"b8e9e09679289844","name":"On","props":[{"p":"transition","v":"{\"duration\":15,\"units\":\"Second\",\"steps\":15}","vt":"json"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":470,"y":360,"wires":[["7236318e1c352822"]]},{"id":"58c245d35462212a","type":"debug","z":"b8e9e09679289844","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1090,"y":80,"wires":[]},{"id":"650147a1096fb41a","type":"inject","z":"b8e9e09679289844","name":"Off","props":[{"p":"transition","v":"{\"duration\":15,\"units\":\"Second\",\"steps\":15}","vt":"json"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"off","payloadType":"str","x":470,"y":420,"wires":[["7236318e1c352822"]]},{"id":"f1d7cb9991a2bf89","type":"switch","z":"b8e9e09679289844","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"completed","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":970,"y":400,"wires":[[]]},{"id":"6e83e123e9731bd7","type":"light-scheduler-settings","name":"Lat-Lon","latitude":"28.876955187201514","longitude":"-81.2394233419017"},{"id":"516c2498.f1e86c","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30"}]

Problem - When i set the transition to exponential it sends NaNs

Terms

  • This request is not a duplicate of an existing issue.
  • I have provided as much information as I can to help resolve this issue.

Description

Describe the problem.

Everything works okay in linear mode, but when i switch to exponential the values in the payload are all NaN.

steps-to-reproduce

Set the transition type to exponential.

Actual Behavior

The node sends NaNs which causes the next node to error.

See https://i.imgur.com/2gCOvpP.png

Version

1.7.2

JSON of node setup

[
    {
        "id": "c9033972aae7ceeb",
        "type": "inject",
        "z": "ca7c0aaf4a7f4d79",
        "name": "07:15 Weekdays",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "15 07 * * 1,2,3,4,5",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 170,
        "y": 140,
        "wires": [
            [
                "08217238b8b75952"
            ]
        ]
    },
    {
        "id": "b6359e243f5dc563",
        "type": "delay",
        "z": "ca7c0aaf4a7f4d79",
        "name": "",
        "pauseType": "delay",
        "timeout": "5",
        "timeoutUnits": "minutes",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 580,
        "y": 200,
        "wires": [
            [
                "d162b174594aea67"
            ]
        ]
    },
    {
        "id": "ed980b406fb48fbc",
        "type": "comment",
        "z": "ca7c0aaf4a7f4d79",
        "name": "Turn Alarm On",
        "info": "",
        "x": 150,
        "y": 100,
        "wires": []
    },
    {
        "id": "08217238b8b75952",
        "type": "api-current-state",
        "z": "ca7c0aaf4a7f4d79",
        "name": "Alarms On?",
        "server": "a3040d918205a56e",
        "version": 3,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "input_boolean.work_alarm",
        "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": 370,
        "y": 140,
        "wires": [
            [
                "312e614528b8e525",
                "b6359e243f5dc563",
                "e5315357aae72e70",
                "d19b7d5b29458444"
            ],
            []
        ]
    },
    {
        "id": "a6f3b48f3a164cb1",
        "type": "ha-button",
        "z": "ca7c0aaf4a7f4d79",
        "name": "",
        "version": 0,
        "debugenabled": false,
        "outputs": 1,
        "entityConfig": "70b810918fa3cbaa",
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "x": 210,
        "y": 200,
        "wires": [
            [
                "08217238b8b75952"
            ]
        ]
    },
    {
        "id": "e5315357aae72e70",
        "type": "light-transition",
        "z": "ca7c0aaf4a7f4d79",
        "name": "1% -> 100%",
        "startRGB": "#ff0000",
        "transitionRGB": "#ffc864",
        "endRGB": "#ffffff",
        "startMired": "",
        "endMired": "",
        "transitionTime": "5",
        "transitionTimeUnits": "Minute",
        "steps": "60",
        "startBright": "1",
        "endBright": "255",
        "brightnessType": "Integer",
        "transitionType": "Linear",
        "colorTransitionType": "Weighted",
        "x": 750,
        "y": 140,
        "wires": [
            [
                "920b22cc663022ed"
            ],
            []
        ]
    },
    {
        "id": "d162b174594aea67",
        "type": "light-transition",
        "z": "ca7c0aaf4a7f4d79",
        "name": "1% -> 50%",
        "startRGB": "#ff0000",
        "transitionRGB": "#ffc864",
        "endRGB": "#ffffff",
        "startMired": "",
        "endMired": "",
        "transitionTime": "10",
        "transitionTimeUnits": "Minute",
        "steps": "60",
        "startBright": "1",
        "endBright": "255",
        "brightnessType": "Integer",
        "transitionType": "Exponential",
        "colorTransitionType": "Weighted",
        "x": 750,
        "y": 200,
        "wires": [
            [
                "ec2bfa9cd58bd625",
                "5ab261777fbed01f"
            ],
            []
        ]
    },
    {
        "id": "920b22cc663022ed",
        "type": "api-call-service",
        "z": "ca7c0aaf4a7f4d79",
        "name": "Turn Floor On",
        "server": "a3040d918205a56e",
        "version": 5,
        "debugenabled": false,
        "domain": "light",
        "service": "turn_on",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "light.bedroom_floor_light"
        ],
        "data": "{\"brightness\": payload.brightness}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 940,
        "y": 140,
        "wires": [
            []
        ]
    },
    {
        "id": "ec2bfa9cd58bd625",
        "type": "api-call-service",
        "z": "ca7c0aaf4a7f4d79",
        "name": "Turn Ceiling On",
        "server": "a3040d918205a56e",
        "version": 5,
        "debugenabled": false,
        "domain": "light",
        "service": "turn_on",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "light.shellydimmer2_48551900c175"
        ],
        "data": "{\"brightness\": payload.brightness}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 940,
        "y": 200,
        "wires": [
            []
        ]
    },
    {
        "id": "930cc2d8b4c761ff",
        "type": "inject",
        "z": "ca7c0aaf4a7f4d79",
        "name": "Stop",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "stop",
        "payloadType": "str",
        "x": 570,
        "y": 100,
        "wires": [
            [
                "e5315357aae72e70",
                "d162b174594aea67"
            ]
        ]
    },
    {
        "id": "d19b7d5b29458444",
        "type": "function",
        "z": "ca7c0aaf4a7f4d79",
        "name": "",
        "func": "\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 580,
        "y": 240,
        "wires": [
            [
                "d162b174594aea67"
            ]
        ]
    },
    {
        "id": "5ab261777fbed01f",
        "type": "debug",
        "z": "ca7c0aaf4a7f4d79",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1150,
        "y": 180,
        "wires": []
    },
    {
        "id": "a3040d918205a56e",
        "type": "server",
        "name": "Home Assistant",
        "version": 2,
        "addon": false,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": true,
        "heartbeatInterval": "60"
    },
    {
        "id": "70b810918fa3cbaa",
        "type": "ha-entity-config",
        "server": "a3040d918205a56e",
        "name": "node-red-alarm-on",
        "version": 2,
        "haConfig": [
            {
                "property": "name",
                "value": "Alarm On"
            },
            {
                "property": "icon",
                "value": ""
            },
            {
                "property": "device_class",
                "value": ""
            }
        ],
        "entityType": "button"
    }
]

topic is removed from message?

Terms

  • This request is not a duplicate of an existing issue.
  • I have provided as much information as I can to help resolve this issue.

Description

It seems the node removes TOPIC from the message.
Is there a way to keep the topic through the node?

steps-to-reproduce

Feed a message with topic and it comes out without

Actual Behavior

Feed a message with topic and it comes out without

Version

1.5.1

JSON of node setup

[
    {
        "id": "5f156cada4cfd3a0",
        "type": "Thing Update",
        "z": "39f9e2f8e099f89d",
        "nodeName": "update light State",
        "name": "",
        "thingType": "Fights",
        "debug": false,
        "updates": [],
        "x": 670,
        "y": 3240,
        "wires": []
    }
]

Problem - Home Assistant takes payload.data.variable instead of payload.variable

Terms

  • This request is not a duplicate of an existing issue.
  • I have provided as much information as I can to help resolve this issue.

Description

When working with Home Assistant light nodes, they accept values such as payload.data.brightness, not payload.brightness

steps-to-reproduce

Create config node
Connect to HA service node for a light
Nothing Changes

Actual Behavior

Nothing

Version

latest

JSON of node setup

No response

Brightness integer

When using brightness "integer" and input 255 then it only gets output op to 100. If you 255*2,55=651 it will get output to 255 (but get error from node red because the value is over 255).

When using brightness "integer" the output is still "brightness_pct" is should be "brightness".

Problem - Sometimes it will get stuck on the first step

Terms

  • This request is not a duplicate of an existing issue.
  • I have provided as much information as I can to help resolve this issue.

Description

Describe the problem.

Sometimes the node will get stuck on the first step, 1/60 etc. I have been testing this with inject nodes, stopping & starting the flow. Usually after less than 10 restarts it will get stuck. Not sure what's causing this or how to debug it.

steps-to-reproduce

Start the flow, wait to see if it gets to 2/60, stop the flow, restart.

Actual Behavior

Occasionally it will just stop at 1/60.

Version

1.7.2

JSON of node setup

[
    {
        "id": "c9033972aae7ceeb",
        "type": "inject",
        "z": "ca7c0aaf4a7f4d79",
        "name": "07:15 Weekdays",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "15 07 * * 1,2,3,4,5",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 150,
        "y": 120,
        "wires": [
            [
                "08217238b8b75952"
            ]
        ]
    },
    {
        "id": "ed980b406fb48fbc",
        "type": "comment",
        "z": "ca7c0aaf4a7f4d79",
        "name": "Turn Alarm On",
        "info": "",
        "x": 130,
        "y": 80,
        "wires": []
    },
    {
        "id": "8770299df6eb1321",
        "type": "cast-to-client",
        "z": "ca7c0aaf4a7f4d79",
        "name": "1980s Zoom",
        "url": "https://samcloud.spacial.com/api/listen?sid=111415&rid=194939&f=mp3,any&br=128000,any&m=sc",
        "contentType": "audio/mpeg",
        "message": "",
        "language": "En-gb",
        "ip": "192.168.0.20",
        "port": "",
        "volume": "20",
        "x": 770,
        "y": 240,
        "wires": [
            []
        ]
    },
    {
        "id": "08217238b8b75952",
        "type": "api-current-state",
        "z": "ca7c0aaf4a7f4d79",
        "name": "Alarms On?",
        "server": "a3040d918205a56e",
        "version": 3,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "input_boolean.work_alarm",
        "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": 350,
        "y": 120,
        "wires": [
            [
                "e5315357aae72e70",
                "6c32572ef31f330e",
                "312e614528b8e525"
            ],
            []
        ]
    },
    {
        "id": "a6f3b48f3a164cb1",
        "type": "ha-button",
        "z": "ca7c0aaf4a7f4d79",
        "name": "",
        "version": 0,
        "debugenabled": false,
        "outputs": 1,
        "entityConfig": "70b810918fa3cbaa",
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "x": 190,
        "y": 160,
        "wires": [
            [
                "08217238b8b75952"
            ]
        ]
    },
    {
        "id": "e5315357aae72e70",
        "type": "light-transition",
        "z": "ca7c0aaf4a7f4d79",
        "name": "",
        "startRGB": "#ff0000",
        "transitionRGB": "#ffc864",
        "endRGB": "#ffffff",
        "startMired": "",
        "endMired": "",
        "transitionTime": "5",
        "transitionTimeUnits": "Minute",
        "steps": "60",
        "startBright": "1",
        "endBright": "255",
        "brightnessType": "Integer",
        "transitionType": "Exponential",
        "colorTransitionType": "Weighted",
        "x": 550,
        "y": 120,
        "wires": [
            [
                "920b22cc663022ed"
            ],
            [
                "d162b174594aea67"
            ]
        ]
    },
    {
        "id": "d162b174594aea67",
        "type": "light-transition",
        "z": "ca7c0aaf4a7f4d79",
        "name": "",
        "startRGB": "#ff0000",
        "transitionRGB": "#ffc864",
        "endRGB": "#ffffff",
        "startMired": "",
        "endMired": "",
        "transitionTime": "10",
        "transitionTimeUnits": "Minute",
        "steps": "60",
        "startBright": "1",
        "endBright": "255",
        "brightnessType": "Integer",
        "transitionType": "Exponential",
        "colorTransitionType": "Weighted",
        "x": 800,
        "y": 180,
        "wires": [
            [
                "ec2bfa9cd58bd625"
            ],
            []
        ]
    },
    {
        "id": "920b22cc663022ed",
        "type": "api-call-service",
        "z": "ca7c0aaf4a7f4d79",
        "name": "Turn Floor On",
        "server": "a3040d918205a56e",
        "version": 5,
        "debugenabled": false,
        "domain": "light",
        "service": "turn_on",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "light.bedroom_floor_light"
        ],
        "data": "{\"brightness\": payload.brightness}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 760,
        "y": 120,
        "wires": [
            []
        ]
    },
    {
        "id": "ec2bfa9cd58bd625",
        "type": "api-call-service",
        "z": "ca7c0aaf4a7f4d79",
        "name": "Turn Ceiling On",
        "server": "a3040d918205a56e",
        "version": 5,
        "debugenabled": false,
        "domain": "light",
        "service": "turn_on",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "light.shellydimmer2_48551900c175"
        ],
        "data": "{\"brightness\": payload.brightness}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1020,
        "y": 180,
        "wires": [
            []
        ]
    },
    {
        "id": "6c32572ef31f330e",
        "type": "function",
        "z": "ca7c0aaf4a7f4d79",
        "name": "",
        "func": "\n\nconsole.log(JSON.stringify(msg));\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 520,
        "y": 80,
        "wires": [
            []
        ]
    },
    {
        "id": "312e614528b8e525",
        "type": "random-output",
        "z": "ca7c0aaf4a7f4d79",
        "name": "",
        "outputs": 4,
        "useWeights": false,
        "weights": [
            "1",
            "1",
            "1",
            "1"
        ],
        "x": 580,
        "y": 240,
        "wires": [
            [
                "8770299df6eb1321"
            ],
            [
                "8770299df6eb1321"
            ],
            [
                "8770299df6eb1321"
            ],
            [
                "8770299df6eb1321"
            ]
        ]
    },
    {
        "id": "a3040d918205a56e",
        "type": "server",
        "name": "Home Assistant",
        "version": 2,
        "addon": false,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": true,
        "heartbeatInterval": "60"
    },
    {
        "id": "70b810918fa3cbaa",
        "type": "ha-entity-config",
        "server": "a3040d918205a56e",
        "name": "node-red-alarm-on",
        "version": 2,
        "haConfig": [
            {
                "property": "name",
                "value": "Alarm On"
            },
            {
                "property": "icon",
                "value": ""
            },
            {
                "property": "device_class",
                "value": ""
            }
        ],
        "entityType": "button"
    }
]

Second and Seconds settings problem

I've got the light transition node working with manual settings (settings hard-coded into the node). However, when I sent a "msg:transition" object to the node, the "units" value isn't being used as it should. It is provided "Second" but it still maintains the "Minutes" that is hard-coded in my settings in the node... it isn't overridden. If I try sending "Seconds" instead of "Second" I get an error message -- apparently the plural version doesn't work. But within the properties of the node, the unit is listed as "Seconds" (plural). Hence, the msg:transition object can't seem to override the units value.

Solution: allow the msg:transition object to provide the correct version of the unit.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.