I was at first considering to get the energy monitor as a sensor, instead of being “attributes” on the switch, but indeed the template platform gets the job done. Here is how to get the “attributes” as a sensor in the UI:
- platform: template
sensors:
tp_link_amps:
value_template: '{{ states.switch.tplink_switch_hs100.attributes["Current"] | replace(" A", "") | float }}'
unit_of_measurement: 'A'
tp_link_watts:
value_template: '{{ states.switch.tplink_switch_hs100.attributes["Current consumption"] | replace(" W", "") | float }}'
unit_of_measurement: 'W'
tp_link_kw:
value_template: '{{ states.switch.tplink_switch_hs100.attributes["Total consumption"] | replace(" kW", "") | float }}'
unit_of_measurement: 'kW'
tp_link_volts:
value_template: '{{ states.switch.tplink_switch_hs100.attributes["Voltage"] | replace(" V", "") | float }}'
unit_of_measurement: 'V'