Using the custom UART text sensor example (exactly the same as this - Custom UART Text Sensor — ESPHome), I have managed to read a JSON string from the UART.
'uart_readline': Received new state {"MSG":1057",Vrms":0.00,"P1":0,"P2":0,"P3":0,"P4":0,"P5":0,"P6":0,"E1":0,"E2":0,"E3":0,"E4":0,"E5":0,"E6":0,"pulse":0}
I’d like to convert this to a JSON Object to split out the different returned values. I can see there is a json_utils file that other components make use of, but I cannot work out how to use this (or if I can). I also saw this brief note about using JSON as well ESPHome 2022.1.0 - 19th January 2022 — ESPHome
I’d like to be able to configure the sensors to be returned in the YAML as not all the data returned will be valid. Is it possible to make the object available and extract what is required like the MQTT component does? (MQTT Client Component — ESPHome)
My other option is to use strtok (on an alternative key:value pair format I can get) to split up the string.
C++ isn’t really my language so I’m struggling here and any help would be appreciated
Correct.
It is pitty that there is no good search within the discord.
I think that it should be part of the esphome example, but I don’t know anyone who can put that into the help.
if you are reffering to dev_documentation channel (Discord),
I understood that this channel is for development only, so I didn’t use that channel.
BTW, can you please let me know how you search within the discord?
Is there something like a “solution” (same as over here)?
My assumption is that it’s for documentation development. Which I think would include any examples on the ESPHome site. I’m not sure, but you could always ask. I believe they are always looking for documentation contributors (since the devs are so busy).
I usually just do a few keyword searches and scroll through results. Coming up with the right keywords is usually the hard bit (same with Google though right).