Hey,
I need some advice how to save from state in automation into a variable (I have already created a variable)? I’m using a state trigger (from, to) and I would like to store the state before the change i.e. the value of the from item.
The goal is to calculate the fuel consumption of a car. Unfortunately the integration on toyota only returns the tank percentage and mileage status. So I would like to calculate the consumption from these values.
Thank you very much for your response. My point is that the integration on toyota auto only shows how much gasoline percentage is in the tank. My goal is that when I refuel (the percentage left in the tank is set to 100%), that I save the value that came before.
So I want to do automation on the state, when the entity changes to 100% store XY in the variable “tank value before refueling”.
For example, the default tank value is 53% I will perform a refuel and that will change the value to 100%. I run the automation and I want to store the default value of 53% in the variable. Unfortunately, I don’t know how to get it (it should actually be the from item in the status trigger).
I then want to calculate what amount of gasoline was consumed by simply using the formula (100%-53%)*tank size in liters. I will use the result to calculate the consumption.