From 7cd8ea05abbfc5eb47d3e93634fe7d1d022e7a65 Mon Sep 17 00:00:00 2001 From: Christian Studer Date: Sat, 23 Feb 2019 10:24:42 +0100 Subject: [PATCH] Adds documentation for Edimax power sensor (#8677) * Edimax: Updates documentation link to https * Edimax: Adds documentation for power consumption reporting --- source/_components/switch.edimax.markdown | 24 ++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/source/_components/switch.edimax.markdown b/source/_components/switch.edimax.markdown index 77431300df5..a7882b473fd 100644 --- a/source/_components/switch.edimax.markdown +++ b/source/_components/switch.edimax.markdown @@ -12,7 +12,7 @@ ha_category: Switch ha_release: pre 0.7 --- -This `edimax` switch platform allows you to control the state of your [Edimax](http://www.edimax.com/edimax/merchandise/merchandise_list/data/edimax/global/home_automation_smart_plug/) switches. +This `edimax` switch platform allows you to control the state of your [Edimax](https://www.edimax.com/edimax/merchandise/merchandise_list/data/edimax/global/home_automation_smart_plug/) switches. To use your Edimax switch in your installation, add the following to your `configuration.yaml` file: @@ -44,3 +44,25 @@ name: default: Edimax Smart Plug type: string {% endconfiguration %} + +## {% linkable_title Power consumption sensor %} + +Starting with [version 2 of the firmware](https://www.edimax.com/edimax/download/download/data/edimax/global/download/), the Edimax switches can also report the current and accumulated daily power consumption in their state objects. Use a [template sensor](/components/sensor.template/) to extract their values: + +{% raw %} +```yaml + - platform: template + sensors: + edimax_current_power: + friendly_name: Edimax Current power consumption + unit_of_measurement: 'W' + value_template: "{{ state_attr('switch.edimax_smart_plug', 'current_power_w') | replace('None', 0) }}" + + edimax_total_power: + friendly_name: Edimax Accumulated daily power consumption + unit_of_measurement: 'kWh' + value_template: "{{ state_attr('switch.edimax_smart_plug', 'today_energy_kwh') | replace('None', 0) }}" +``` +{% endraw %} + +Note that if the smart plug is off, these states report the string `None`. By using a `replace()` in the template, these sensors report purely numerical values.