Parsing an HTTP Response Groovy Errors in Hubitat


#1

I have a piston that works fine in ST but is completely non-functional in Hubitat and I can’t figure out why. Anyone else have any ideas?

These are the errors I’m getting in Hubitat

[app:149](http://192.168.1.12/logs/past#app149)2018-10-18 11:25:23.363 error ║ An error occurred while executing the event: groovy.lang.StringWriterIOException: java.io.IOException: Stream closed

[app:149](http://192.168.1.12/logs/past#app149)2018-10-18 11:25:23.361 info ║ 000000

[app:149](http://192.168.1.12/logs/past#app149)2018-10-18 11:25:22.275 info ║ [mode:2, ws2812fx_mode:0, ws2812fx_mode_name:Static, speed:192, brightness:96, color:[0, 0, 0]]

[app:149](http://192.168.1.12/logs/past#app149)2018-10-18 11:23:26.451 error ║ An error occurred while executing the event: groovy.lang.StringWriterIOException: java.io.IOException: Stream closed

[app:149](http://192.168.1.12/logs/past#app149)2018-10-18 11:23:26.446 info ║ 000000

[app:149](http://192.168.1.12/logs/past#app149)2018-10-18 11:23:25.351 info ║ [mode:2, ws2812fx_mode:0, ws2812fx_mode_name:Static, speed:192, brightness:96, color:[0, 0, 0]]

[app:149](http://192.168.1.12/logs/past#app149)2018-10-18 11:21:26.950 error ║ An error occurred while executing the event: groovy.lang.StringWriterIOException: java.io.IOException: Stream closed

[app:149](http://192.168.1.12/logs/past#app149)2018-10-18 11:21:26.947 info ║ 000000

[app:149](http://192.168.1.12/logs/past#app149)2018-10-18 11:21:25.869 info ║ [mode:2, ws2812fx_mode:0, ws2812fx_mode_name:Static, speed:192, brightness:96, color:[0, 0, 0]]

[app:149](http://192.168.1.12/logs/past#app149)2018-10-18 11:15:08.192 error ║ An error occurred while executing the event: groovy.lang.StringWriterIOException: java.io.IOException: Stream closed

[app:149](http://192.168.1.12/logs/past#app149)2018-10-18 11:15:08.171 info ║ 000000

[app:149](http://192.168.1.12/logs/past#app149)2018-10-18 11:15:07.016 info ║ [mode:2, ws2812fx_mode:0, ws2812fx_mode_name:Static, speed:196, brightness:100, color:[0, 0, 0]]

#2

I don’t have a Hubitat, but your IF statement on line 27 above is totally blank…


#3

Yes…that’s because this piston is called from another and isn’t triggered on it’s own. It works fine in ST. Rather than have 5 copies of this statement in every piston that I use it for, which is like 10, I have one of these per LED strip. And I call to execute this piston from another. That wasn’t my question.

My question was about the groovy language error I recieved.


#4

I do this all the time, and that top IF is not needed for this.
(To be honest, I think it is asking for problems)


#5

There, I removed the if and got the same error. Can you answer MY question now rather than argue semantics?


#6

This is what is shown in the logs:

10/18/2018, 4:42:37 PM +110ms
+1ms ╔Received event [Home].execute = UNKNOWN with a delay of 101ms
+68ms ║RunTime Analysis CS > 24ms > PS > 27ms > PE > 17ms > CE
+161ms ║Runtime (54201 bytes) successfully initialized in 27ms (v0.3.108.20180906) (159ms)
+162ms ║╔Execution stage started
+172ms ║║Comparison (string) :7c76bcf13f4437d56396ddf04776b595: is_any_of (string) :7c76bcf13f4437d56396ddf04776b595:,:d8dba010950cb621ab30af3cc2e14571: = true (1ms)
+174ms ║║Condition #31 evaluated true (8ms)
+175ms ║║Condition group #2 evaluated true (state did not change) (10ms)
+176ms ║║Cancelling statement #2's schedules...
+182ms ║║Calculating (string) http://192.168.1. + (string) 61 >> (string) http://192.168.1.61
+184ms ║║Calculating (string) http://192.168.1.61 + (string) /status >> (string) http://192.168.1.61/status
+188ms ║║Sending external web request to: 192.168.1.61/status
+213ms ║║Executed virtual command httpRequest (25ms)
+216ms ║║[mode:2, ws2812fx_mode:15, ws2812fx_mode_name:Fade, speed:196, brightness:255, color:[0, 0, 0]]
+217ms ║║Executed virtual command log (2ms)
+225ms ║║Executed virtual command setVariable (5ms)
+233ms ║║Executed virtual command setVariable (4ms)
+240ms ║║Executed virtual command setVariable (5ms)
+249ms ║║Executed virtual command setVariable (4ms)
+251ms ║║Executed virtual command wait (1ms)
+255ms ║║Requesting a wake up for Thu, Oct 18 2018 @ 4:42:38 PM EDT (in 1.0s)
+259ms ║║Fast executing schedules, waiting for 997ms to sync up
+1261ms ║║Calculating (string) http://192.168.1. + (string) 61 >> (string) http://192.168.1.61
+1262ms ║║Calculating (string) http://192.168.1.61 + (string) /get_color >> (string) http://192.168.1.61/get_color
+1265ms ║║Sending external web request to: 192.168.1.61/get_color
+1298ms ║║Executed virtual command httpRequest (22ms)
+1302ms ║║000000
+1303ms ║║Executed virtual command log (2ms)
+1306ms ║║An error occurred while executing the event: groovy.lang.StringWriterIOException: java.io.IOException: Stream closed
+1308ms ║╚Execution stage complete. (1145ms)
+1340ms ╚Event processed successfully (1340ms)

#7

LOL, I wasn’t arguing…

When troubleshooting, I always look at the obvious first, and that IF was glaring at me. I would be doing you an injustice to not mention it. You are too quick to get defensive, when all I was trying to do was help.

I will let someone else tackle this


#8

Try breaking it down to the simplest GET and log $response and see if you actually are getting a $response.


#9

This is the piston:

And I get the same error:

0/18/2018, 5:02:00 PM +66ms
+0ms ╔Received event [Home].execute = UNKNOWN with a delay of 101ms
+59ms ║RunTime Analysis CS > 22ms > PS > 28ms > PE > 9ms > CE
+81ms ║Runtime (47562 bytes) successfully initialized in 28ms (v0.3.108.20180906) (79ms)
+82ms ║╔Execution stage started
+86ms ║║Comparison (string) :7c76bcf13f4437d56396ddf04776b595: is_any_of (string) :7c76bcf13f4437d56396ddf04776b595:,:d8dba010950cb621ab30af3cc2e14571: = true (0ms)
+87ms ║║Condition #31 evaluated true (3ms)
+88ms ║║Condition group #2 evaluated true (state did not change) (4ms)
+92ms ║║Cancelling statement #2's schedules...
+96ms ║║Sending external web request to: 192.168.1.44/get_color
+119ms ║║Executed virtual command httpRequest (24ms)
+123ms ║║000000
+124ms ║║Executed virtual command log (1ms)
+126ms ║║An error occurred while executing the event: groovy.lang.StringWriterIOException: java.io.IOException: Stream closed
+127ms ║╚Execution stage complete. (46ms)
+181ms ╚Event processed successfully (180ms)

I can request the same url in Chrome and I get the correct response back.


#10

I’m just getting started with HE myself and have not created any pistons there. Do you have any pistons in HE that makes webcalls that logs $responses that work?


#11

No, these are the first one’s I’ve tried that with.


#12

You’d probably have to tag the folks that ported wc to hubitat… I can’t remember his handle at the moment :older_man:


#13

hey @putnamjwp and @ajayjohn …any ideas?


#14

Guess this isn’t working for anyone. I’ll leave it in ST. VERY regretting this Hubitat purchase.


#15

I’m having issues with issuing a get request to an internal server also. Anyone successfully able to do this?

So OLD ST way…do not use “http://” in front of IP address…HE…needs to have “http://” in front of URL.


#16

Yeah, I am. That doesn’t help. You can see in the screencap above.