From 497e16cea084efde7fb93221a2eb7be934a49287 Mon Sep 17 00:00:00 2001 From: Chris Feist Date: Sun, 4 Nov 2018 13:50:32 -0800 Subject: [PATCH] Update TP Link Switch markdown to include power readings (#7361) * Update TP Link Switch markdown to include power Update the markdown to include how to retrieve power readings from a switch that has Energy Monitoring features, such as the HS110 https://www.tp-link.com/us/products/details/cat-5516_HS110.html * Use latest attributes and add friendly name * remove comment in yaml * Update kW to kWh * Minor changes --- source/_components/switch.tplink.markdown | 34 +++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/source/_components/switch.tplink.markdown b/source/_components/switch.tplink.markdown index 59912f87d1f..2be6ca2ed68 100644 --- a/source/_components/switch.tplink.markdown +++ b/source/_components/switch.tplink.markdown @@ -22,6 +22,8 @@ Supported units: - HS110 - HS200 +## {% linkable_title Configuration %} + To use your TP-Link switch or socket in your installation, add the following to your `configuration.yaml` file: ```yaml @@ -59,3 +61,35 @@ switch: - platform: tplink host: SECOND_IP_ADDRESS ``` + +## {% linkable_title Configure Energy Sensors %} ## + +In order to get the power consumption readings from the HS110, you'll have to create a [template sensor](/components/switch.template/). In the example below, change all of the `my_tp_switch`'s to match your switch's entity ID. + +{% raw %} +```yaml +sensor: + - platform: template + sensors: + my_tp_switch_amps: + friendly_name_template: "{{ states.switch.my_tp_switch.name}} Current" + value_template: '{{ states.switch.my_tp_switch.attributes["current_a"] | float }}' + unit_of_measurement: 'A' + my_tp_switch_watts: + friendly_name_template: "{{ states.switch.my_tp_switch.name}} Current Consumption" + value_template: '{{ states.switch.my_tp_switch.attributes["current_power_w"] | float }}' + unit_of_measurement: 'W' + my_tp_switch_total_kwh: + friendly_name_template: "{{ states.switch.my_tp_switch.name}} Total Consumption" + value_template: '{{ states.switch.my_tp_switch.attributes["total_energy_kwh"] | float }}' + unit_of_measurement: 'kWh' + my_tp_switch_volts: + friendly_name_template: "{{ states.switch.my_tp_switch.name}} Voltage" + value_template: '{{ states.switch.my_tp_switch.attributes["voltage"] | float }}' + unit_of_measurement: 'V' + my_tp_switch_today_kwh: + friendly_name_template: "{{ states.switch.my_tp_switch.name}} Today's Consuption" + value_template: '{{ states.switch.my_tp_switch.attributes["today_energy_kwh"] | float }}' + unit_of_measurement: 'kWh' +``` +{% endraw %}