From a227122e354d99f14bdbfe336c4ec5418ec40100 Mon Sep 17 00:00:00 2001 From: Keilin Bickar Date: Sat, 5 Sep 2020 15:52:01 -0400 Subject: [PATCH] Add Emulated Kasa (#14391) Co-authored-by: Franck Nijhof --- source/_integrations/emulated_kasa.markdown | 93 +++++++++++++++++++++ source/_integrations/sense.markdown | 6 ++ 2 files changed, 99 insertions(+) create mode 100644 source/_integrations/emulated_kasa.markdown diff --git a/source/_integrations/emulated_kasa.markdown b/source/_integrations/emulated_kasa.markdown new file mode 100644 index 00000000000..29711b62575 --- /dev/null +++ b/source/_integrations/emulated_kasa.markdown @@ -0,0 +1,93 @@ +--- +title: Emulated Kasa +description: Instructions on how to integrate Emulated Kasa within Home Assistant. +ha_category: + - Energy +ha_iot_class: Local Push +ha_release: 0.112 +ha_config_flow: false +ha_codeowners: + - '@kbickar' +ha_domain: emulated_kasa +--- + +The Emulated Kasa integration emulates a TP-Link Kasa smart plug and announces the power usage of configured devices to any that might request it on the local network. + +For example, the [Sense Energy Monitor](/integrations/sense) can use this to identify power usage. + +The configuration includes a list of entities to expose with attributes for the published name and current power usage. +If the entity is a sensor or has a `current_power_w` attribute (such as in a smart switch), that value will be reported as the current power usage unless the power field is defined. +The power field can contain a hardcoded value, a sensor, or a template (see configuration example). + +
+ +The provided power unit must be the current power usage in Watts. Values of `kW` can be converted, but the values of `kWh` cannot be used. + +
+ +## Configuration + +This integration requires the entities exposed to be listed in your `configuration.yaml` file: + +```yaml +# Example configuration.yaml entry +emulated_kasa: + entities: + light.dining_room: + power: 40.2 +``` + +{% configuration %} +entities: + description: A list of entities exposed. + required: true + type: map + keys: + name: + description: Name visible to external devices. + required: false + type: string + power: + description: The current power usage in watts. This can be set to a static value or a template. + required: false + type: [integer,float,template] + power_entity: + description: A sensor measuring the current power usage in watts. + required: false + type: string +{% endconfiguration %} + +A full configuration sample looks like the one below. + +{% raw %} +```yaml +# Example configuration.yaml entry +emulated_kasa: + entities: + # uses the current_power_w attribute of the switch + switch.ac: + name: "A/C" + # uses the sensor state value + sensor.power_meter: + name: "Power Meter" + # uses static value + light.dining_room: + name: "Dining Room Lights" + power: 40.2 + # uses template based on state of device + fan.ceiling_fan: + power: >- + {% if is_state_attr('fan.ceiling_fan','speed', 'low') %} 2 + {% elif is_state_attr('fan.ceiling_fan','speed', 'medium') %} 12 + {% elif is_state_attr('fan.ceiling_fan','speed', 'high') %} 48 + {% endif %} + # uses value from 3rd party sensor + light.wled: + name: "Strip Lights" + power_entity: sensor.light_power_w + # uses template to convert device state into watts + sensor.ups_kw: + name: UPS Power + power: "{{ float(states('sensor.ups_kw')) * 1000 }}" +``` +{% endraw %} diff --git a/source/_integrations/sense.markdown b/source/_integrations/sense.markdown index a0f550f9ae0..a6d1e92177f 100644 --- a/source/_integrations/sense.markdown +++ b/source/_integrations/sense.markdown @@ -56,3 +56,9 @@ Sensors are added for both usage and production with the following names: Binary sensors are created for each of the devices detected by your Sense monitor to show their power state. Sensors are created for each of the devices detected by your Sense monitor to show their power usage in Watts. + +
+ +The [Emulated Kasa](/integrations/emulated_kasa) integration can be used to expose devices in Home Assistant to the Sense Monitor by emulating TP-Link Kasa Smart Plugs. + +