[DEPRECATED THREAD] webCoRE Beta Milestone 1

Lol, finally someone who uses the piston state to full potential :wink:

Problem with that unicode saving error is that communication to ST is MIME encoded and Base64 encoding/decoding with Unicode is notoriously buggy. Not sure which of the encoding in javascript or the decoding in Groovy is faulty… will look at it.

3 Likes

What browser do you use? Does the error happen in all browsers? The utoa function in browsers vary from browser to browser…

Here’s a related problem: https://cafedev.org/article/2016/08/javascript-unicode/

1 Like

Happens on both, Safari and Firefox on macOS

1 Like

Got any Chrome on Windows? Or IE/Edge? Or Chrome on MacOS?

1 Like

Just tried Chrome on macOS - no go either :cry:

1 Like

It may then be the Groovy decoding function. And to explain why some work and some don’t, I believe it is to do with alignment. Where it does not work, please add a space (one blank space) in front of the emoji and see if that fixes it

1 Like

Didn’t work (tried adding one or two spaces and neither worked).

Is there a way to look at the JSON it fails to decode?

1 Like

Yes, with the editor open, open the console and type this in:

angular.toJson(scope.piston)

The result is a string that represents all the piston code. You can copy that and try and parse it with an online parser (http://json.parser.online.fr)

1 Like

The JSON seems correct (both parse and eval) after replacing all \" with " :confused:

1 Like

Yeah but that is not the issue. Try encoding it to base64, then decode it, then parse it. Still ok?

1 Like

Yes - still OK. Used https://www.base64decode.org for encoding and decoding

1 Like

While saving, capture network traffic. If the piston is small enough, you should have one single request to piston/set… you can extract the data from there, decode it and parse it… is that ok? I hope not, got a lot more control in js than in groovy… :wink:

1 Like

The request seems to send JSON

{"e":"…"}

Decoding the value is another correctly formatted JSON dictionary:

{"iv":"…","v":"…","ct":"…"}

Decoding the "ct" value is not possible (but then, is that using the encryptions parameters in the object?)

1 Like

Nah, that’s the backup bin - sha encrypted :wink: initial vectors and stuff. look for the request that goes as a jsonp to smartthings.

1 Like

OK - I assume that data parameter of the query string? That doesn’t decode…

1 Like

Are there more requests? Is it saying chunk 1 of N? If so, you need to get them all and concatenate them.

1 Like

I’m using Charles to capture the traffic so I don’t have to piece together things from individual packets. That is the full request

1 Like

Hi ady624,

Did the Integrations get removed for other services like IFTTT on the SmartApp? I don’t see this option anymore on the settings menu since last week

1 Like

Open safari’s console and check the network tab. It shows al requests and data is in the query string. It helps if the piston is small so it fits in one request. How do you write that damn emoji? Paste the notification text here? Or at least the failing emoji…

2 Likes

They are going to move into the dashboard. Made no sense to have them edited using the ST app :wink:

1 Like