So first we need to create a sensor that takes the product of the power and costs
template:
- sensor:
unique_id: ecc4d377-6e5e-4758-b570-549539525357
name: Device costs
state: >
{{ states('sensor.device_power')|float(0) * states('sensor.brabander_electricity_price')|float(0) / 1000}}
unit_of_measurement: "β¬/h"
state_class: measurement
It is dividend by a factor of 1000 because my power sensor reports in W and my price sensor in $/kWh