I found a couple of examples on the forum but I can’t get it to work.
I want to calculate the euros I make with a solarpanel sensor.
The sensor on my device is: sensor.today_s_pv_generation
I tried with making a template sensor with the tarif. That didn’t work.
Now I made a template sensor: 0.39 is the Kwh price.
- platform: template
sensors:
panelen_schuur_dag_opbrengst:
friendly_name: "Opbrengst per dag panelen schuur [EUR]"
unit_of_measurement: "EUR"
value_template: "{{ states('sensor.today_s_pv_generation') | float * states('0.39') | float }}"
I get the following log:
Logger: homeassistant.helpers.template_entity
Source: helpers/template_entity.py:364
First occurred: 20:39:05 (1 occurrences)
Last logged: 20:39:05
TemplateError('ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ states('sensor.today_s_pv_generation') | float * states('0.39') | float }}' but no default was specified') while processing template 'Template<template=({{ states('sensor.today_s_pv_generation') | float * states('0.39') | float }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.panelen_schuur_dag_opbrengst'