Custom Sensor - Howto

Hi Team,

I’ve got some complex automations setup but am struggling to get this to work.
My eletric is standard at 0.30p per KWH, howoever if my car is charging (any time of day ) it’s 7.5pence or if it’s 11.30pm - 5.30am it’s 7.5p otherwise it’s 30p

Am trying to get my Energy dashboard to work with this, so that if my car is not charging the cost per kwh is 30p otherwise if car is charging it’s 7.5p - How would be best to do this?

I’ve alreday got a helper which is on if it’s 7.5p otherwise it’s 0.30p. I’ve also got another helper “Peak Tarrif” cost which is a slider also.

Please any help would be really appranced it

( the sliders do automatcily change based on other automations on a CT Clamp )

input_boolean.7_5p_electric_cost
input_boolean.peak_tarif_cost