Custom variable or sensor or entity or ..?

Is it possible to create your own variables or sensors or anything like that which would be based on a manipulation of states or attributes and that would dynamically be updated based on the changing values of these original states or attributes?

Let me clarify myself… I want to keep track of the consolidated travel time between Home and the workplace of my partner + the time from his workplace to my work (as I drive him to work in the morning before going to my company) + 5 extra minutes for the overhead.

Via the google plug-in, I have a sensor for both parts individually, I know how to isolate the value for the travel time and make sure it’s an integer, but I have no idea how to set up an entity of which either the state or an attribute would be give me the output of the sum. That would allow me to easily use that value to display on the UI, use as trigger in an automation to warn me about excessive travel time, etc…

I hope something exists in that respect.

It sounds like maybe something that could be done in a template sensor but my brain hurts trying to figure out the math. I’ve seen some complex stuff other have done with templating.

May be a starting point at least. This may help too: http://jinja.pocoo.org/docs/2.9/templates/

A template sensor will achieve this.

1 Like

Did your head hurt a little imagining it though? Maybe it was just me last night… :laughing:

See if this thread contains what you’re looking for.

2 Likes