Why piston sends two broadcast messages?


#1

1) Give a description of the problem
I receive two broadcast messages and one push notification when I should receive one broadcast and one push notification. Any idea what could be happening?

2) What is the expected behaviour?
Send one push notification and one broadcast when something happens.

3) What is happening/not happening?
Almost every time I get two braodcasts and one push message.

**4) Post a Green Snapshot of the piston![image|45x37]


#2

If you run the piston using the ‘Test’ button, do you get the right number of messages?

I see that define begins on line 16. I only have one piston that begins on line 16 and that has two piston settings enabled, one of which is enable parallelism. Hopefully you don’t have that because you will have two events coming in at the same time (longitude and latitude) and you don’t want those to run in parallel.

As to why two broadcast and only one push message, I wonder if one of the notifications get suppressed if they are identical and arrive pretty much at the same time.

Logs would probably be diagnostic.


#3

I do not have parallelism enabled. Is there a way to to suppress broadcasting part in piston?
It could be that latitude and longitude change happens so rapidly that for some reason piston sends two but suppresses push notification. Not sure how and why that happens but…yeah…it seems to happen.
I need to enable logs and paste them here. ( for some reason I had disabled them)


#4

No, I overthought it and forgot to allow for the import code being displayed.

I think the logs are going to be worth a look to see what is going on.


#5

Hi, today it once again happened and I really do not understand why. There seems to be two “httpRequest-lines” at 8.57.57 and 8.57.59.

2.11.2020 klo 8.58.13 +121ms
+1ms ╔Received event [Koti].time = 1604300294819 with a delay of -1698ms
+111ms ║RunTime Analysis CS > 36ms > PS > 26ms > PE > 49ms > CE
+114ms ║Runtime (43029 bytes) successfully initialized in 26ms (v0.3.110.20191009) (112ms)
+115ms ║╔Execution stage started
+116ms ║╚Execution stage complete. (1ms)
+117ms ╚Event processed successfully (117ms)

2.11.2020 klo 8.57.59 +266ms
+0ms ╔Received event [Koti].wc_async_reply = httpRequest with a delay of 0ms
+104ms ║RunTime Analysis CS > 24ms > PS > 25ms > PE > 54ms > CE
+106ms ║Runtime (43033 bytes) successfully initialized in 25ms (v0.3.110.20191009) (105ms)
+107ms ║╔Execution stage started
+108ms ║╚Execution stage complete. (1ms)
+109ms ╚Event processed successfully (109ms)

2.11.2020 klo 8.57.57 +540ms
+0ms ╔Received event [Koti].wc_async_reply = httpRequest with a delay of 0ms
+98ms ║RunTime Analysis CS > 21ms > PS > 22ms > PE > 54ms > CE
+100ms ║Runtime (43028 bytes) successfully initialized in 22ms (v0.3.110.20191009) (99ms)
+101ms ║╔Execution stage started
+122ms ║║Executed virtual command sendPushNotification (11ms)
+133ms ║║Comparison (decimal) ■■■ is_outside_of_range (decimal) XXXX … (decimal) ■■■ = false (1ms)
+135ms ║║Cancelling condition #27’s schedules…
+135ms ║║Condition #27 evaluated false (11ms)
+136ms ║║Condition group #26 evaluated false (state did not change) (12ms)
+138ms ║╚Execution stage complete. (37ms)
+139ms ╚Event processed successfully (139ms)

2.11.2020 klo 8.57.54 +618ms
+1ms ╔Received event [XXXX].longitude = XXXX with a delay of 98ms
+134ms ║RunTime Analysis CS > 16ms > PS > 30ms > PE > 88ms > CE
+137ms ║Runtime (43022 bytes) successfully initialized in 30ms (v0.3.110.20191009) (134ms)
+138ms ║╔Execution stage started
+147ms ║║Comparison (decimal) XXXXX is_inside_of_range (decimal) ■■■ … (decimal) XXXX = true (2ms)
+149ms ║║Cancelling condition #38’s schedules…
+150ms ║║Condition #38 evaluated true (8ms)
+161ms ║║Comparison (decimal) XXXXX is_inside_of_range (decimal) XXXX … (decimal) XXXX = true (2ms)
+163ms ║║Condition #45 evaluated true (11ms)
+167ms ║║Comparison (boolean) true is (boolean) true = true (1ms)
+168ms ║║Cancelling condition #39’s schedules…
+169ms ║║Condition #39 evaluated true (6ms)
+170ms ║║Cancelling condition #37’s schedules…
+171ms ║║Condition group #37 evaluated true (state changed) (28ms)
+173ms ║║Cancelling statement #40’s schedules…
+178ms ║║Executed virtual command setVariable (3ms)
+184ms ║║Executed virtual command setVariable (3ms)
+195ms ║║Sending internal web request to: 192.168.86.30:3000/assistant
+199ms ║║Executed virtual command httpRequest (9ms)
+200ms ║║Requesting a wake up for Mon, Nov 2 2020 @ 8:58:14 AM EET (in 20.0s)
+204ms ║╚Execution stage complete. (67ms)
+205ms ║Setting up scheduled job for Mon, Nov 2 2020 @ 8:58:14 AM EET (in 19.996s)
+214ms ╚Event processed successfully (214ms)


#6

I am hoping I am having a light bulb moment by asking: Do you have two hubs in your location?

The way things are going the answer will be no, but it would explain it.


#7

No I do not :frowning:

I can confirm that it happens in both ways. When variable XXX_away is “false” and IF longitude is outside of range it sends one push notification but two broadcast messages. Why… oh why…


#8

OK, the reason I asked is that you are getting two HTTP responses to your post request in the same way you do when you have two hubs. In that case each hub is sending the POST request independently.

So have you established that just sending the POST request without the rest of the piston just results in a single broadcast? Only I’m wondering if the problem is on the other end. What is on the other end, Assistant Relay or something like that?


#9

I need to duplicate my piston and add broadcast part only. Let’s see what happens. I’m using assistant relay and I do believe it has nothing to do with this problem. I’m using AR a lot with other pistons and none of them acts same way as these pistons do.
Actually I do not get double broadcasts with piston that checks location information.
It needs to be something with those latitude AND longitude IF’s even though there seems to be no reason for it to create two broadcast but only one push notification. It’s weird…

Maybe there should be some kind of wait command after http request so that it wouldn’t run it double. If I remember right then I need to enable “never cancel tasks”…