Triggering automations one time when values are between two numbers

This is probably a lot simpler than I’m thinking it is.

When my 3D printer starts, it shifts from Operational to Printing. I have a Poll State node watching for a change every 10 seconds.

When the change occurs, a Switch node compares the messages. If the message is Operational down the line it goes to check the temperature of the bed and the extruder.

If it is Printing then my goal is to have Google Home use TTS to Say Printing is 25% complete and then Printing is 50% complete and so on.

I’ve got the announcement worked out. What I can’t figure out is how to get that announcement to fire once when the state of the progress is between two numbers without firing every time the state changes and the value is still between the two numbers. Since the percentage could change 100 times inside of 25 and 26 (25.02, 25.08, etc.) each state change would trigger the announcement.

At present, my only solution seems to be to create boolean switches that are all reset to ON when the print job starts, and are then turned OFF after the announcement is made during that print job. Then, when a new print job starts, the three switches (25% / 50% / 75%) would be turned on again.

Ideas?

[{"id":"b0489ef9.89b62","type":"debug","z":"2191dcb6.bede44","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":582,"y":672,"wires":[]},{"id":"22a89886.438b18","type":"inject","z":"2191dcb6.bede44","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":124,"y":672,"wires":[["317ef9aa.390476"]]},{"id":"5c87bb9d.736174","type":"rbe","z":"2191dcb6.bede44","name":"","func":"deadbandEq","gap":"1","start":"","inout":"out","property":"payload","x":428,"y":672,"wires":[["b0489ef9.89b62"]]},{"id":"317ef9aa.390476","type":"function","z":"2191dcb6.bede44","name":"","func":"let results = [];\nfor(let i = 0;i< 1001;i++) {\n    results.push({payload:0.1*i});\n}\n\nreturn [results];","outputs":1,"noerr":0,"x":274,"y":672,"wires":[["5c87bb9d.736174","e0befc69.83c71"]]},{"id":"e0befc69.83c71","type":"debug","z":"2191dcb6.bede44","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":438,"y":720,"wires":[]}]

Oh…so I could use the deadband node to block any values received past a specific starting point value to prevent repeated firing?

What’s in the function? Reading JSON is like chinese to me right now…workin’ on it.

I was just a way to demonstrate passing a 1000 message through the rbe node and only displaying ones where the value increased by a value of 1.

All you need is the rbe node

In other news, I did get my logic to work the crazy way.

Thanks for the tip though. That’s going to make it work better!

I was looking at doing something similar. I would like if the temp outside starts dropping and gets to 1 Degree I send a notification so I know to bring in the deck plants to prevent from freezing.

Got a flow now but at anytime the temp gets to 1 Degree (rising or falling) it triggers. is there a way to just have it trigger when changing from 2 to 1Degrees?

Could try a trigger-state node where you check if the current state is 1 and the prev state is 2.

Going to give that a try. It will be going down below 0 tonight so we will see what happens.
I see that my netatmo temp value has one decimal place so I made current state 1.0 and previous state 1.1

If the temperature skips over 1.1 it won’t trigger. Might want to try if current state less than or equal to 1 and previous state is greater than 1.