Hi All,
I needs some assistance in getting this value to work for my MQTT climate
I have the commands all set
But the states are not working
the JSON returned when a command is set is as follows
I get the error when i change the mode
Error parsing value: ‘value_json’ is undefined (value: {“power”:0,“mode”:“cool”,“speed”:3,“temp”:26.0,“response”:“RSSL11FF00011002120312041205133406110F1075”}, template: {{value_json[‘mode’] }})
When i put the json in a debugger
i get a invalid character at position 2 before the RSSL
I am not very sure here, but the first character of the “response” value is rendering as a box after you paste it, which suggests that something about the response from the hardware is off. That’s vaguely consistent with the debugger message, although I’m not sure what “position 2” is so it’s hard to be precise.
Can you give more formation about the hardware and how exactly you’re interfacing it with MQTT?
You’re obviously getting a non-ASCII character at the start of the value string. I am not sure if that’s the cause of your ultimate issue, but it’s suspect—because the JSON is otherwise seemingly entirely (and deliberately) ASCII.
With that said, I don’t have any other ideas because I’m not experienced with the setup you’re trying to make work. Hopefully someone else here will have ideas.
That’s a control character (start of text). It’s ASCII, but not in the way I meant the term.
What’s actually giving you that message? If you have the ability to filter the string before it’s parsed by whatever gives that error, maybe you can remove that character. If it always happens at the start of the response field, it’s easy enough to remove?
Are you seeing it say “auto”? If so, drop the double-quotes around the speed values (1, 2 etc.) since they’re integers, not strings, in the sample JSON you posted.
Sorry my bad…
I tested in the template editior and it checked out ok without the quotes but forgot to remove the quotes from my configuration.yaml file.
Glad to hear that it solved the original problem, namely the inability to process the received payload due to an unprintable character that corrupted the JSON structure.
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which indicates to others that the topic has been solved. This helps other users find answers to similar questions.