I want to measure the time difference with milliseconds accuracy between the previous sensor state and the upcoming one. Or to put it in another way: i need the time delta of the last 2 sensor states.
What I’m trying to accomplish with this is:
I have a Tasmota with a photodiode attached as a counter and hooked up to my energy meter which blinks 1600/kwh. I can measure the consumption, but i’d also like to measure momentary wattage.
For this I need to convert kwh to w, and for that i need the time difference of the 2 measurement points.
I tried to fiddle with as_timestamp(now()) and i’m getting results by subtracting some values from each other, but i’m getting nowhere meaningful values which i can incorporate in what i want to accomplish.
I would have thought, from an accuracy point of view, that you’d be better off performing the calculation on the Tasmota flashed device and then passing the result to HA.
I know this could be done with ESPHome but I’m not familiar enough with Tasmota to suggest how.
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic is resolved. This helps other users find answers to similar questions. For more information, refer to guideline 21 in the FAQ.