Skip to content

script #2043

@R3ikop

Description

@R3ikop
Image Image

The temperature data I receive from the MQTT PLC comes as JSON {"PLC":[{28.6250}]}. I only want to get the value, so I wrote

let inbound = '{"PLC":[{"Temperature":31.5}]}';

try {
let data = JSON.parse(inbound);
return data.PLC[0].Temperature;
} catch(e) {
return 0;
}
but the value is always a constant 31.5. How can I fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions