Well it seems to me you are trying to parse a XML response with JSON.parse. You will need a XML parser to get what you want.
If you are just interested in the BinaryState Tag value you can get by with a regex if they are supported.
// Gives you the value of BinaryState let binaryState = /<BinaryState>(\d)<\/BinaryState>/.exec(pdata)[1];
@PaddeK started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Well it seems to me you are trying to parse a XML response with JSON.parse. You will need a XML parser to get what you want.
If you are just interested in the BinaryState Tag value you can get by with a regex if they are supported.