I have a flow where I decrement the brightness of lights starting from 100% and decrementing every 2mins by 1%. The flow stops at 0% when “countLowerLimitReached” is true.
When I deploy the flow everything works as it should. But the next day when the flow is triggered again it immediately stops because the count = 0 and countLowerLimitReached is true
I have tried everything I can think of, even changing the message after the trigger and explicitly removing the count and countLowerLimitReached, but as soon as the message leaves the counter for the first time they are back in the message at 0 and true.
I’m out of ideas, it must be simple but I don’t see it. Looks like state is remembered somewhere, but no idea why.
This is my flow
[{"id":"516088b10958505d","type":"http request","z":"2b5ce9b1350c8a99","name":"Set Brightness L","method":"POST","ret":"txt","paytoqs":"ignore","url":"http://192.168.1.45/rpc","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":1500,"y":780,"wires":[[]]},{"id":"a6288b4e8a48812e","type":"function","z":"2b5ce9b1350c8a99","name":"Configure Brightness","func":"msg.payload = {\n \"id\": 1,\n \"method\": \"Light.Set\",\n \"params\": {\n \"id\": 0,\n \"on\": true,\n \"brightness\": msg.count\n }\n};\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1240,"y":880,"wires":[["516088b10958505d"]]},{"id":"a4c06de862e61610","type":"counter","z":"2b5ce9b1350c8a99","name":"Brightness Decrement","init":"100","step":"1","lower":"0","upper":"100","mode":"decrement","outputs":1,"x":820,"y":1020,"wires":[["6d1e01f53e015ae7","30efe11ea8b6da48"]]},{"id":"6d1e01f53e015ae7","type":"switch","z":"2b5ce9b1350c8a99","name":"Stop @ Minimum Brightness","property":"countLowerLimitReached","propertyType":"msg","rules":[{"t":"null"}],"checkall":"false","repair":false,"outputs":1,"x":1200,"y":1020,"wires":[["a5046f513e456237"]]},{"id":"a5046f513e456237","type":"stoptimer","z":"2b5ce9b1350c8a99","duration":"2","units":"Minute","payloadtype":"num","payloadval":"0","name":"Brightness Decrement Transition","x":910,"y":920,"wires":[["a4c06de862e61610","a6288b4e8a48812e"],[]]},{"id":"059faf7525b3b57b","type":"inject","z":"2b5ce9b1350c8a99","name":"Start DecrementTrigger","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":140,"y":960,"wires":[["a4c06de862e61610"]]},{"id":"bddf8c676e16a24c","type":"cronplus","z":"2b5ce9b1350c8a99","name":"Lights L Timer","outputField":"payload","timeZone":"","storeName":"","commandResponseMsgOutput":"fanOut","defaultLocation":"","defaultLocationType":"default","outputs":4,"options":[{"name":"Brightness Decrement 17h30","topic":"topic3","payloadType":"default","payload":"","expressionType":"cron","expression":"0 30 17 * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"},{"name":"Off 21h","topic":"topic4","payloadType":"default","payload":"","expressionType":"cron","expression":"0 0 21 * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":120,"y":880,"wires":[["a4c06de862e61610"],["ba446755e6952e8b"],[],[]]},{"id":"ba446755e6952e8b","type":"http request","z":"2b5ce9b1350c8a99","name":"Set Lights L Off","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.1.7/rpc/Switch.Set?id=0&on=false","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":540,"y":1120,"wires":[[]]},{"id":"f132dc7ffc5cbdeb","type":"inject","z":"2b5ce9b1350c8a99","name":"Stop Lights Trigger","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":130,"y":1020,"wires":[["ba446755e6952e8b"]]},{"id":"30efe11ea8b6da48","type":"debug","z":"2b5ce9b1350c8a99","name":"Debug Decrement","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":420,"y":1320,"wires":[]}]
And this is the message which leaves the counter node
20 Jun 17:30:00 - [info] [debug:Debug Decrement]
{
topic: 'topic3',
scheduledEvent: true,
payload: {
triggerTimestamp: 1718897400000,
status: {
type: 'static',
modified: false,
isRunning: true,
count: 2,
limit: 0,
nextDescription: 'in 23 hours 59 minutes 59 seconds',
nextDate: 2024-06-21T15:30:00.000Z,
nextDateTZ: 'Jun 21, 2024, 17:30:00 GMT+2',
timeZone: 'Europe/Brussels',
serverTime: 2024-06-20T15:30:00.023Z,
serverTimeZone: 'Europe/Brussels',
description: 'At 17:30'
},
config: {
topic: 'topic3',
name: 'Brightness Decrement 17h30',
index: 0,
payloadType: 'default',
payload: '',
limit: null,
expressionType: 'cron',
expression: '0 30 17 * * * *'
}
},
_msgid: '3b2449f6bcd15793',
count: 0,
countLowerLimitReached: true
}