Sending JSON containing extended ascii data to a piston


#1

I have an external app on a rasp pi which calls a piston and passes JSON data. This is working fine unless any of the data uses extended ascii e.g “Daniël”

If I use codeset utf-8 in the send, I receive a failure from webcore
statusCode: 500
{“error”:true,“type”:“org.codehaus.groovy.grails.web.converters.exceptions.ConverterException”,“message”:“An unexpected error occurred.”}

If I use codeset utf-16 it works, however the Sargs parameter does not include the JSON data.

Using codeset utf-8, and no extended ascii data, works, and $args contains the JSON data.

I know webcore can receive this data, as another third party app can send the extended ascii data in JSON.


#2

Wish I could help Paul, but I’m a newbie, low on the learning curve to WebCore.

I’m curious as to how to handle JSON data in WC.
Could you share your piston please?

I’d like to share my yard light w/ a neighbor, but do not want to give access into my SmartThings, or directly link them into my WC pistons.

I can make a ESP8266-ESP-01 Access point / server (that they can open)
that will send data to a client ESP-01 (inside my house), which then sends data to webcore.

Thanks in advance
Bruce


#3

Hi Bruce,

I’ve just documented everything I was doing in this thread

To send JSON data to webcore, turn it into a string (stringify) so it should look like this
e.g {“payload”:{“event”:“media.stop”,“user”:true,“owner”:true,…

You can then access is within webcore using $arg.payload.event e.t.c

It maybe simpler to have separate piston tso switch the light on and off, and just call their url from your access point server. (from the piston click the “external url” to obtain its url)


#4

Thanks for the clues Paul!
I’ll look into it!


#5

The easiest way is to make a new piston that has commands, but no triggers.

You can simply give him the External URL to that piston… Whenever he clicks that link, that new piston will execute for him. (Thankfully, this does not give him access to any other automation or data)


#6

Got it. THANKS.
That’s the easier way to do things.