I have this sensor in my config file which displays the correct information.
- platform: template
sensors:
electric_voltage_l1_round:
value_template: “{{ states.sensor.voltage_em_1.state.split(’.’)[0] + ‘.’ + states.sensor.voltage_em_1.state.split(’.’)[1][:1] }}”
friendly_name: “Line 1 Voltage”
unit_of_measurement: “V”’
However, in the Supervisor Core I get this error:
2021-07-10 13:26:21 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError(‘UndefinedError: list object has no element 1’) while processing template ‘Template("{{ states.sensor.voltage_em_1.state.split(’.’)[0] + states.sensor.voltage_em_1.state.split(’.’)[1][:1] }}")’ for attribute ‘_attr_state’ in entity ‘sensor.electric_voltage_l1_round’
2021-07-10 13:26:21 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template("{{ states.sensor.voltage.state.split(’.’)[0] + ‘.’ + states.sensor.voltage.state.split(’.’)[1][:1] }}")’
What is the correct syntax? I cannot figure it out.