EDIT: I came up with something, see edit at end of original post. Would still like other ideas.
I want to create a very simple flow, but can’t think of how to program it.
In the picture below, the Amazon Delivered state node is watching a sensor that increases with each piece of Amazon mail that is delivered, and is then reset to 0 at midnight. Every time the number INCREASES (ie, 0 to 1, 1 to 2, 2 to 3) I want to trigger ‘Alert Jims phone’. I do not want anything to trigger when it gets set back to 0 at midnight.
[{"id":"adf42c5585367382","type":"tab","label":"Mail","disabled":false,"info":"","env":[]},{"id":"311f27a9a4807c3a","type":"server-state-changed","z":"adf42c5585367382","name":"Amazon delivered","server":"ab3e2c53.e3491","version":5,"outputs":1,"exposeAsEntityConfig":"","entityId":"sensor.mail_amazon_packages_delivered","entityIdType":"exact","outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":375,"y":390,"wires":[["1b61bf1beb511681"]]},{"id":"1b61bf1beb511681","type":"api-call-service","z":"adf42c5585367382","name":"Alert Jims phone","server":"ab3e2c53.e3491","version":5,"debugenabled":false,"domain":"notify","service":"notify_jim","areaId":[],"deviceId":[],"entityId":[],"data":"{\"title\":\"\",\"message\":\"Picture test\",\"data\":{\"sticky\":\"false\",\"priority\":\"Normal\",\"ttl\":0,\"tag\":\"picture_test\",\"color\":\"blue\",\"image\":\"/api/camera_proxy/camera.mail_amazon_delivery_camera\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":675,"y":390,"wires":[[]]},{"id":"ab3e2c53.e3491","type":"server","name":"AvilaSmartHome","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]
Edit:
OK here is what i came up with but still interested in your thoughts.
So everyday at 12:01am it checks sensor (which the integration resets to 0 at midnight) and writes that value to a global variable. So global is basically set to 0 at midnight.
Then lets say we get a package at 9am. The package delivered state node will trigger and compare the current count (1) , to the value of the global (0). If current > global, it passes on to the alert node and then also changes the value of global to (1).
We get another package at 2PM. Same check applies, if current (2) > global (1), then pass. Rinse repeat.
[{"id":"adf42c5585367382","type":"tab","label":"Mail","disabled":false,"info":"","env":[]},{"id":"311f27a9a4807c3a","type":"server-state-changed","z":"adf42c5585367382","name":"Package delivered","server":"ab3e2c53.e3491","version":5,"outputs":2,"exposeAsEntityConfig":"","entityId":"sensor.mail_amazon_packages_delivered","entityIdType":"exact","outputInitially":true,"stateType":"num","ifState":"amazon_packages_delivered","ifStateType":"global","ifStateOperator":"gt","outputOnlyOnStateChange":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":180,"y":330,"wires":[["1b61bf1beb511681"],[]]},{"id":"1b61bf1beb511681","type":"api-call-service","z":"adf42c5585367382","name":"Alert Jims phone","server":"ab3e2c53.e3491","version":5,"debugenabled":false,"domain":"notify","service":"notify_jim","areaId":[],"deviceId":[],"entityId":[],"data":"{\"title\":\"\",\"message\":\"Picture test\",\"data\":{\"sticky\":\"false\",\"priority\":\"Normal\",\"ttl\":0,\"tag\":\"picture_test\",\"color\":\"blue\",\"image\":\"/api/camera_proxy/camera.mail_amazon_delivery_camera\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":435,"y":330,"wires":[["3e4bc36cf40f40b7"]]},{"id":"3e4bc36cf40f40b7","type":"change","z":"adf42c5585367382","name":"","rules":[{"t":"set","p":"amazon_packages_delivered","pt":"global","to":"msg.count","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":790,"y":360,"wires":[[]]},{"id":"f8a8ebb3a861eecc","type":"api-current-state","z":"adf42c5585367382","name":"Current package count","server":"ab3e2c53.e3491","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.mail_amazon_packages_delivered","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"count","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":490,"y":420,"wires":[["3e4bc36cf40f40b7"]]},{"id":"d13f064427e0b8e8","type":"bigtimer","z":"adf42c5585367382","outtopic":"","outpayload1":"ON","outpayload2":"OFF","name":"Trigger at 12:01am everyday","comment":"","lat":"45.307781","lon":"-93.577408","starttime":"0","endtime":"0","starttime2":"0","endtime2":"0","startoff":"1","endoff":"2","startoff2":0,"endoff2":0,"offs":0,"outtext1":"","outtext2":"","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":"","month1":"","day2":"","month2":"","day3":"","month3":"","day4":"","month4":"","day5":"","month5":"","day6":"","month6":"","day7":"","month7":"","day8":"","month8":"","day9":"","month9":"","day10":"","month10":"","day11":"","month11":"","day12":"31","month12":"12","d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xday7":"","xmonth7":"","xday8":"","xmonth8":"","xday9":"","xmonth9":"","xday10":"","xmonth10":"","xday11":"","xmonth11":"","xday12":"","xmonth12":"","xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"randon1":false,"randoff1":false,"randon2":false,"randoff2":false,"repeat":false,"atstart":false,"odd":false,"even":false,"x":210,"y":420,"wires":[["f8a8ebb3a861eecc"],[],[]],"outputLabels":["on-off message","",""]},{"id":"ab3e2c53.e3491","type":"server","name":"AvilaSmartHome","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]