Please consider donating if this saves you time so that I can continue to deliver tutorials for you. Here you can download the code that I used in the video templates and Custom Sensors in Home Assistant. You can simply copy and paste this code so that you do not have to type it yourself. Thank you! P.S. You do not have to register to download this file. You can fill in whatever you like in the name and e-mail field and you can still download.