Attribute as sensor for T_Stat attribute

trying to create a sensor from Ecobee t-stat attribute (hvac_action) at a summer home so i can monitor how long the heat runs at different temps (we try to keep a minimal heat on through the winter)…i have a a nice chart (apex chart) tracking the amount of time my phone is on the my home network and it works perfectly and was hoping to set something like that up for the HVAC.

Hitting a couple of road blocks…there a bunch of topics already on the boards dealing with attribute sensors but can’t seem to find a cure for my template/issues

firstly i tried creating the template and got the following …assuming that means the template is working (as its correctly returning the value of the attribute)

When i take the template and plug it into config, i get as per below…

I get the following error when testing to see if i could reload yaml file…

Also wondering if i’m completely running in the wrong direction because i’m getting a attribute that is a string and my previous experience charting state changes have been with binary attributes

do i need to further translate the string attributes to “On/Off”

The Template sensor you are setting up needs to be configured under the top-level key template, not sensor.

Assuming this is your first Template sensor you can do it directly in configuration.yaml or split off a separate file for those sensors.

Ahh…ok so that worked…now lets see if the charting part works itself out…