I’ve attempted your suggestion with and without the commented lines and I only get an entity with unknown entity state and no attributes. Am I misinterpreting your suggestion?
If you fix your json_attributes_path it will probably work.
json_attributes_path: "$.metaData"
Not sure what your value_template is supposed to accomplish. A state can only be 255 characters, depending on the length of the track metadata this may overflow and completely break the sensor. Better to replace it with say a timestamp for when the sensor was last updated.
Thanks, but no progress to report. I’ve tried the following, again with and without the commented lines. Let me know if you see anything I need to fix or try.
As for the value_template, it wasn’t clear to me how it would behave in this application. The examples I’ve seen only show numerical objects. That said, I like your suggestion. Also, I’ve tried the jason_attribute_path you suggested already, but other things might’ve been misconfigured.
Well all I did was take your sample API response and paste it into a JSONPath online evaluator and make sure the path worked. Your sample response does have an erroneous # at the very end though, I assume that was snuck in during copy-paste and is not actually included in the responses from the player?
Anyway… I have no experience with command line sensors so hard for me to say what isn’t correct. But that being said, why exactly are you using a command line sensor in the first place? Considering all you are doing is quering a REST API, the logical thing to do would surely be to use an actual RESTful Sensor.
Unfortunately, the # is baked in. I see it on another command with a JSON response as well. If it’s unusual, I can contact the support folks for the product.
I’m using the command line sensor because it appeared appropriate to the application. I’ll try your recommendation and see how far I get. Hopefully, it can work with the uninvited guest. Otherwise I might try to pipe it through a sed command. I think I’ve seen examples somewhere.
Then I would guess that is the problem, as it is not valid JSON. Seems like a bug the WiiM developers ought to fix.
Edit: Sure you didn’t get the # from say the shell prompt when copying from a terminal? Surely the WiiM developers would use preexisting libraries for the JSON output etc. so seems like a really weird thing for them to mess up…