Best way to test templates?

Hello,

I have a question regarding creating value templates. I am looking to build a few REST based sensors, where the API calls return some pretty complicated JSON data I need to parse and extract the value I want from. Does anyone have any tips on how I might sandbox/test my templates without having to go through the entire HA component interface?

John

There is the templates-dev tool. Bottom of the HA menu, second to last icon or is your statement above saying you don’t want to use that?

EDIT: Nevermind. I guess that will only return items that are in HA. Re-reading is my friend. :slight_smile:

1 Like

In this post @ih8gates showed how this works in the templates tool.

Edit:
And for better viewing, something like this:
https://jsonformatter.curiousconcept.com/

1 Like

Ah great, yes so I can just define a variable and play with it there that’s useful.

I think I might just bail out of HA entirely though and use command line sensors to pull data. I don’t see the point in having to learn a whole new template engine for a complex task I can reproduce very quickly with a shell script. Any reason that’s a bad idea?

IMO No. Sometimes a little scripting in bash or python is easier, and you can control it without restarting HA. :slight_smile:

2 Likes