Duplicate Push Notifications from Webcore


#1

I having trouble with this piston, which is designed to keep my location mode in sync with 3 virtual switches, which then drive STHM (outside of Webcore). I am receiving duplicate push notifications. Hoping someone can take a look and determine why. Thanks!


#2

Each time a trigger (your lightening bolts in the left margin) changes state, ON to OFF or OFF to ON or your location mode changes, it runs the piston from top to bottom each time. So, for instance, when your location changes to Armed (away), that is one trigger and one PUSH. All three of your Contact Sensors are triggers. But they are also being changed within your piston, thus triggering the piston to run again from top to bottom each time one of them changes state. Also, you have “enable parallelism”, so you could spawn another instance of the piston and that MAY be why you are getting duplicate PUSH.

I am not sure if removing “enable parallelism” would help here. Giving us a log with trace would help.


#3

@Pantheon nailed it.

All of your location triggers (lines 23, 38, 53) will also change your Contact sensors…
… and when any of the Contact sensors change, the piston starts all over at the top, and runs thru the entire code once again.

Generally, we want to avoid this kind of logic:

IF DeviceA changes
    Then change DeviceB
END IF

IF DeviceB changes
    Then change DeviceC
END IF

IF DeviceC changes
    Then change DeviceX
END IF

Keep in mind that any Contact changing to on or off will both start the piston at the top.


Edit:

Although I do not think disabling parallelism will resolve it, it is also my recommendation to do so.


#4

A change in location turns a switch on, and turning the switch on sets the location. However it doesn’t seem like it should be seen as a change in location to generate a second push.

I can see why you might want parallelism around as you are always changing at least two switches and you really don’t want semaphore waits. Whether it is doing any harm is another matter.

It looks like you have set TCP to Never Cancel on the if conditions. I’ve only ever seen that break things and never worked out what it is supposed to do. I’d lose that.

I think you need a full log to see what is actually happening. It may be something elsewhere confusing things e.g. Automations setting switches.


#5

Thanks all. In the end I kept parallelism on and simply removed the portion that sends push notifications. Instead I built a separate piston just for the push notifications - probably less efficient but it’s removed the duplicate push messages.