UPDATE You might want to switch to https://github.com/bvweerd/dynamic_energy_contract_calculator
These scripts are made to cope with the Dutch 'salderingsregeling' and tariff calculations in Home Assistant. It is specifically meant for fixed contracts or dynamic contracts.
See folder "Fixed Contract"
See folder "Dynamic Contract"