D-link Smart Plug W215 - Question


I have recently invested in two of the aforementioned smart plugs (They were on sale and I should have known better :disappointed:). Anyway I have manged to set them and I am able to monitor the following values in HA

power_consumption: 0.07 W
total_consumption: 3.2 kWh
temperature: 46 °C
friendly_name: D-link Smart Plug W215

The strange thing is that the actual values include the unit of measure, so that {{ states.switch.dlink_smart_plug_w215.attributes.power_consumption }} yields 0.07 W not 0.07. Is there some clever way to strip away the unit of measurement?

Same problem but not been able to work it out either.

Try using split…
message: 'PANIC ALARM Warning {{ states[states.alarm_control_panel.house.attributes.changed_by.split(".")[0]][ states.alarm_control_panel.house.attributes.changed_by.split(".")[1]].name }}'

in your case you would use .split(" ")[0]

1 Like

Thanks for the tip.

{{ states.switch.dlink_smart_plug_w215.attributes.power_consumption.split(" ")[0]}}

seems to bring the desired result.


Hey, trying to use this in a sensor but config rejects it:

  • platform: template
    friendly_name: “Power Consumption”
    entity_id: switch.dlink_smart_plug_w215
    unit_of_measurement: ‘w/H’
    value_template: “{{ states.switch.dlink_smart_plug_w215.attributes.power_consumption.split(” “)[0]}}”

Any ideas? Using:
value_template: “{{ states.switch.dlink_smart_plug_w215.attributes.power_consumption }}”
Works but cant use the W

You can’t have double double quotes, swap the outer double quotes for single quotes.

1 Like

Cheers, working now

1 Like

Hi, can someone please show me the HA confit for this power-meter smart plug? I want to be able to turn it off when the power consumption reaches a certain threshold - I’m using it to charge a bike battery and I hope to find the right settings so the battery only gets charged to around 80-90 percent. Thanks

What config did you enter into Home Assistant to be able to get access to power consumption details?

Is it also possible for you to get continous info of power consump and have it inserted into history logging?

what was the problem? can you paste here the working yaml?
many thanks!