mirror of
https://github.com/nuttytree/ESPHome-Devices.git
synced 2024-08-30 18:12:19 +00:00
Energy monitoring updates (#14)
* Update most everything to report power and energy to Home Assistant and Sense * ESPSense is pulled from GitHub Co-authored-by: Chris Nussbaum <chris.nussbaum@protolabs.com>
This commit is contained in:
parent
ae2ef5d478
commit
3cffad99dd
@ -19,6 +19,9 @@ This an enhanced version of the standard [Tuya](https://esphome.io/components/li
|
||||
### Tuya Dimmer as Fan
|
||||
This a modified version of the Tuya fan component I use with [Feit Dimmers](https://www.amazon.com/gp/product/B07SXDFH38/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1) (but it will likely work with other Tuya dimmers) to control bathroom fans. The major change from the standard Tuya fan component (other than removing options for speed, oscillation, and direction) is adding a function to always change the dimmer back to the maximum "brightness" effectively making this only an on/off device. Details on how to use this component are available [here](./components/tuya_dimmer_as_fan/README.md).
|
||||
|
||||
### ESPSense
|
||||
This excellent component is not mine and doesn't live in this repository but most of my devices are using it so I felt it was worthy of a mention here. More details are available [here](https://github.com/cbpowell/ESPSense).
|
||||
|
||||
|
||||
## Misc Devices
|
||||
### [Basement Bathroom Sensor](./devices/basement_bathroom_sensor.yaml)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Tuya Light Plus Component
|
||||
## Overview
|
||||
This a modified version of the Tuya fan component I use with [Feit Dimmers](https://www.amazon.com/gp/product/B07SXDFH38/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1) (but it will likely work with other Tuya dimmers) to control bathroom fans. The major change from the standard Tuya fan component (other than removing options for speed, oscillation, and direction) is adding a function to always change the dimmer back to the maximum "brightness" effectively making this only an on/off device.
|
||||
This a modified version of the Tuya fan component I use with [Feit Dimmers](https://www.amazon.com/gp/product/B07SXDFH38/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1) (but it will likely work with other Tuya dimmers) to control bathroom fans. The major change from the standard Tuya fan component (other than removing options for speed, oscillation, and direction) is adding a function to always change the dimmer back to the maximum "brightness" effectively making this only an on/off device. Similar to the Tuya Light Plus component this component can also add a power sensor based on configured wattage of the fan, this could be done with a templat sensor and automations but it was easy to add here so I figured why not.
|
||||
|
||||
|
||||
## Setup
|
||||
@ -29,6 +29,10 @@ fan:
|
||||
switch_datapoint: 1
|
||||
dimmer_datapoint: 2
|
||||
dimmer_max_value: 1000
|
||||
power:
|
||||
id: my_fan_power
|
||||
name: My Fan Power
|
||||
light_wattage: 21.6
|
||||
```
|
||||
|
||||
## Configuration Variables
|
||||
@ -37,3 +41,6 @@ fan:
|
||||
* switch_datapoint (Required, int): The datapoint id number of the power switch.
|
||||
* dimmer_datapoint (Required, int): The datapoint id number of the dimmer value.
|
||||
* dimmer_max_value (Optional, int, default 255): The highest dimmer value allowed.
|
||||
* power.id (Optional, string) Manually specify the power sensor ID used for code generation.
|
||||
* power.name (Optional, string) The name for the power sensor.
|
||||
* power.fan_wattage (Optional, float) The total wattage of the fan(s) controled by this dimmer.
|
||||
|
@ -1,13 +1,22 @@
|
||||
from esphome.components import fan
|
||||
from esphome.components import fan, sensor
|
||||
import esphome.config_validation as cv
|
||||
import esphome.codegen as cg
|
||||
from esphome.const import CONF_OUTPUT_ID, CONF_SWITCH_DATAPOINT
|
||||
from esphome.components.tuya import CONF_TUYA_ID, Tuya
|
||||
from esphome.const import (
|
||||
CONF_OUTPUT_ID,
|
||||
CONF_SWITCH_DATAPOINT,
|
||||
CONF_POWER,
|
||||
UNIT_WATT,
|
||||
DEVICE_CLASS_POWER,
|
||||
STATE_CLASS_MEASUREMENT,
|
||||
ICON_POWER,
|
||||
)
|
||||
|
||||
DEPENDENCIES = ["tuya"]
|
||||
|
||||
CONF_DIMMER_DATAPOINT = "dimmer_datapoint"
|
||||
CONF_MAX_VALUE = "dimmer_max_value"
|
||||
CONF_FAN_WATTAGE = "fan_wattage"
|
||||
|
||||
tuya_ns = cg.esphome_ns.namespace("tuya")
|
||||
TuyaFan = tuya_ns.class_("TuyaDimmerAsFan", cg.Component)
|
||||
@ -20,6 +29,17 @@ CONFIG_SCHEMA = cv.All(
|
||||
cv.Required(CONF_SWITCH_DATAPOINT): cv.uint8_t,
|
||||
cv.Required(CONF_DIMMER_DATAPOINT): cv.uint8_t,
|
||||
cv.Optional(CONF_MAX_VALUE): cv.int_,
|
||||
cv.Optional(CONF_POWER): sensor.sensor_schema(
|
||||
unit_of_measurement_=UNIT_WATT,
|
||||
accuracy_decimals_=1,
|
||||
device_class_=DEVICE_CLASS_POWER,
|
||||
state_class_=STATE_CLASS_MEASUREMENT,
|
||||
icon_=ICON_POWER,
|
||||
).extend(
|
||||
{
|
||||
cv.Optional(CONF_FAN_WATTAGE): cv.positive_float,
|
||||
}
|
||||
),
|
||||
}
|
||||
).extend(cv.COMPONENT_SCHEMA),
|
||||
)
|
||||
@ -38,3 +58,8 @@ async def to_code(config):
|
||||
cg.add(var.set_dimmer_id(config[CONF_DIMMER_DATAPOINT]))
|
||||
if CONF_MAX_VALUE in config:
|
||||
cg.add(var.set_dimmer_max_value(config[CONF_MAX_VALUE]))
|
||||
if CONF_POWER in config:
|
||||
power_config = config[CONF_POWER]
|
||||
power_sensor = await sensor.new_sensor(power_config)
|
||||
cg.add(var.set_fan_wattage(power_config[CONF_FAN_WATTAGE]))
|
||||
cg.add(var.set_power_sensor(power_sensor))
|
||||
|
@ -15,6 +15,12 @@ void TuyaDimmerAsFan::setup() {
|
||||
auto call = this->fan_->make_call();
|
||||
call.set_state(datapoint.value_bool);
|
||||
call.perform();
|
||||
|
||||
if (this->fan_wattage_.has_value() && this->power_sensor_ != nullptr)
|
||||
{
|
||||
float power = datapoint.value_bool ? this->fan_wattage_.value() : 0.0f;
|
||||
this->power_sensor_->publish_state(power);
|
||||
}
|
||||
});
|
||||
|
||||
this->parent_->register_listener(*this->dimmer_id_, [this](const TuyaDatapoint &datapoint) {
|
||||
|
@ -1,8 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/components/tuya/tuya.h"
|
||||
#include "esphome/components/fan/fan_state.h"
|
||||
#include "esphome/components/sensor/sensor.h"
|
||||
#include "esphome/components/tuya/tuya.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace tuya {
|
||||
@ -15,6 +16,8 @@ class TuyaDimmerAsFan : public Component {
|
||||
void set_switch_id(uint8_t switch_id) { this->switch_id_ = switch_id; }
|
||||
void set_dimmer_id(uint8_t dimmer_id) { this->dimmer_id_ = dimmer_id; }
|
||||
void set_dimmer_max_value(uint32_t max_value) { this->dimmer_max_value_ = max_value; }
|
||||
void set_fan_wattage(float fan_wattage) { this->fan_wattage_ = fan_wattage; }
|
||||
void set_power_sensor(sensor::Sensor *power_sensor) { this->power_sensor_ = power_sensor; }
|
||||
|
||||
protected:
|
||||
Tuya *parent_;
|
||||
@ -22,6 +25,8 @@ class TuyaDimmerAsFan : public Component {
|
||||
optional<uint8_t> dimmer_id_{};
|
||||
uint32_t dimmer_max_value_ = 255;
|
||||
fan::FanState *fan_;
|
||||
optional<float> fan_wattage_{};
|
||||
sensor::Sensor *power_sensor_;
|
||||
};
|
||||
|
||||
} // namespace tuya
|
||||
|
@ -11,6 +11,7 @@ This an enhanced version of the standard Tuya light component that adds a bunch
|
||||
* Double clicking the dimmer while off can be configured to leave the light in an off or on state.
|
||||
* Adds an option to configure action(s) to run when the dimmer is double clicked while on (this double click always turns the light off otherwise you get strange flash when double clicking).
|
||||
* Allows you to "link" other light(s) in Home Assistant that will be controlled by this dimmer (on/off and level).
|
||||
* Can add a sensor to report current power usage based on a configured wattage of the lights it controls. Currently this reports the specified wattage regardless of the dimmer level (my lights run at the max level 95% of the time so for me this is pretty accurate). Eventually I want to determine approximately what the dimmer level to power reduction ratio is so that it can more accurately report the power.
|
||||
|
||||
|
||||
## Setup
|
||||
@ -35,7 +36,7 @@ Add and configure the Tuya Light Plus component
|
||||
```yaml
|
||||
light:
|
||||
- platform: tuya_light_plus
|
||||
name: my_dimmer
|
||||
name: My Light
|
||||
switch_datapoint: 1
|
||||
dimmer_datapoint: 2
|
||||
max_value: 1000
|
||||
@ -55,6 +56,11 @@ light:
|
||||
double_click_while_off_stays_off: false
|
||||
on_double_click_while_on:
|
||||
- script.execute: double_click
|
||||
power:
|
||||
id: my_light_power
|
||||
name: My Light Power
|
||||
light_wattage: 21.6
|
||||
|
||||
```
|
||||
|
||||
## Configuration Variables
|
||||
@ -79,7 +85,9 @@ light:
|
||||
* on_double_click_while_off (Optional): List of actions to run when the dimmer is double clicked while off
|
||||
* double_click_while_off_stays_off (Optional, bool, default: true): Determines if the light remains off or turns on after a double click while off
|
||||
* on_double_click_while_on (Optional): List of actions to run when the dimmer is double clicked while on
|
||||
|
||||
* power.id (Optional, string) Manually specify the power sensor ID used for code generation.
|
||||
* power.name (Optional, string) The name for the power sensor
|
||||
* power.light_wattage (Optional, float) The total wattage of the light(s) controled by this dimmer
|
||||
|
||||
## Operation
|
||||
This component adds 2 services to Home Assistant that can be used to update the settings of the dimmer:
|
||||
|
@ -1,6 +1,6 @@
|
||||
from typing import Optional
|
||||
from esphome import core
|
||||
from esphome.components import light
|
||||
from esphome.components import light, sensor
|
||||
import esphome.config_validation as cv
|
||||
import esphome.automation as auto
|
||||
import esphome.codegen as cg
|
||||
@ -12,6 +12,11 @@ from esphome.const import (
|
||||
CONF_DEFAULT_TRANSITION_LENGTH,
|
||||
CONF_SWITCH_DATAPOINT,
|
||||
CONF_SENSOR_ID,
|
||||
CONF_POWER,
|
||||
UNIT_WATT,
|
||||
DEVICE_CLASS_POWER,
|
||||
STATE_CLASS_MEASUREMENT,
|
||||
ICON_POWER,
|
||||
)
|
||||
from esphome.components.tuya import CONF_TUYA_ID, Tuya
|
||||
|
||||
@ -33,6 +38,7 @@ CONF_NIGHT_AUTO_OFF_TIME = "night_auto_off_time"
|
||||
CONF_ON_DOUBLE_CLICK_WHILE_OFF = "on_double_click_while_off"
|
||||
CONF_DOUBLE_CLICK_WHILE_OFF_STAYS_OFF = "double_click_while_off_stays_off"
|
||||
CONF_ON_DOUBLE_CLICK_WHILE_ON = "on_double_click_while_on"
|
||||
CONF_LIGHT_WATTAGE = "light_wattage"
|
||||
|
||||
tuya_ns = cg.esphome_ns.namespace("tuya")
|
||||
api_ns = cg.esphome_ns.namespace("api")
|
||||
@ -89,6 +95,17 @@ CONFIG_SCHEMA = cv.All(
|
||||
cv.Optional(
|
||||
CONF_DEFAULT_TRANSITION_LENGTH, default="0s"
|
||||
): cv.positive_time_period_milliseconds,
|
||||
cv.Optional(CONF_POWER): sensor.sensor_schema(
|
||||
unit_of_measurement_=UNIT_WATT,
|
||||
accuracy_decimals_=1,
|
||||
device_class_=DEVICE_CLASS_POWER,
|
||||
state_class_=STATE_CLASS_MEASUREMENT,
|
||||
icon_=ICON_POWER,
|
||||
).extend(
|
||||
{
|
||||
cv.Optional(CONF_LIGHT_WATTAGE): cv.positive_float,
|
||||
}
|
||||
),
|
||||
}
|
||||
).extend(cv.COMPONENT_SCHEMA),
|
||||
)
|
||||
@ -144,5 +161,10 @@ async def to_code(config):
|
||||
for conf in config.get(CONF_ON_DOUBLE_CLICK_WHILE_ON, []):
|
||||
trigger = cg.new_Pvariable(conf[CONF_ON_DOUBLE_CLICK_WHILE_ON], var)
|
||||
await auto.build_automation(trigger, [], conf)
|
||||
if CONF_POWER in config:
|
||||
power_config = config[CONF_POWER]
|
||||
power_sensor = await sensor.new_sensor(power_config)
|
||||
cg.add(var.set_light_wattage(power_config[CONF_LIGHT_WATTAGE]))
|
||||
cg.add(var.set_power_sensor(power_sensor))
|
||||
paren = await cg.get_variable(config[CONF_TUYA_ID])
|
||||
cg.add(var.set_tuya_parent(paren))
|
||||
|
@ -239,6 +239,12 @@ void TuyaLightPlus::handle_tuya_datapoint_(tuya::TuyaDatapoint datapoint)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (this->light_wattage_.has_value() && this->power_sensor_ != nullptr)
|
||||
{
|
||||
float power = this->state_->current_values.is_on() ? this->light_wattage_.value() : 0.0f;
|
||||
this->power_sensor_->publish_state(power);
|
||||
}
|
||||
}
|
||||
|
||||
void TuyaLightPlus::on_day_night_changed_(std::string state)
|
||||
|
@ -23,6 +23,8 @@ class TuyaLightPlus : public Component, public light::LightOutput, public api::C
|
||||
void set_tuya_parent(Tuya *parent) { this->parent_ = parent; }
|
||||
void set_min_value(uint32_t min_value) { this->min_value_ = min_value; }
|
||||
void set_max_value(uint32_t max_value) { this->max_value_ = max_value; }
|
||||
void set_light_wattage(float light_wattage) { this->light_wattage_ = light_wattage; }
|
||||
void set_power_sensor(sensor::Sensor *power_sensor) { this->power_sensor_ = power_sensor; }
|
||||
light::LightTraits get_traits() override;
|
||||
void setup_state(light::LightState *state) override;
|
||||
void write_state(light::LightState *state) override;
|
||||
@ -71,6 +73,8 @@ class TuyaLightPlus : public Component, public light::LightOutput, public api::C
|
||||
optional<float> night_default_brightness_{};
|
||||
optional<uint32_t> day_auto_off_time_{};
|
||||
optional<uint32_t> night_auto_off_time_{};
|
||||
optional<float> light_wattage_{};
|
||||
sensor::Sensor *power_sensor_;
|
||||
CallbackManager<void()> double_click_while_off_callback_{};
|
||||
CallbackManager<void()> double_click_while_on_callback_{};
|
||||
bool has_double_click_while_off_{false};
|
||||
|
@ -11,6 +11,10 @@ substitutions:
|
||||
packages:
|
||||
device_base: !include ../packages/device_base.yaml
|
||||
|
||||
external_components:
|
||||
- source: github://cbpowell/ESPSense
|
||||
components: [ espsense ]
|
||||
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
id: light_button
|
||||
@ -29,6 +33,12 @@ binary_sensor:
|
||||
then:
|
||||
- fan.toggle: the_fan
|
||||
|
||||
espsense:
|
||||
plugs:
|
||||
- name: Basement Bathroom Light
|
||||
power_sensor: light_power
|
||||
voltage: 120
|
||||
|
||||
fan:
|
||||
- platform: binary
|
||||
id: the_fan
|
||||
@ -40,6 +50,14 @@ light:
|
||||
id: the_light
|
||||
name: "Basement Bathroom Light"
|
||||
output: light_output
|
||||
on_turn_on:
|
||||
- sensor.template.publish:
|
||||
id: light_power
|
||||
state: 48.0
|
||||
on_turn_off:
|
||||
- sensor.template.publish:
|
||||
id: light_power
|
||||
state: 0.0
|
||||
|
||||
output:
|
||||
- platform: gpio
|
||||
@ -53,3 +71,19 @@ status_led:
|
||||
pin:
|
||||
number: 0
|
||||
inverted: true
|
||||
|
||||
sensor:
|
||||
- platform: template
|
||||
name: Basement Bathroom Light Power
|
||||
id: light_power
|
||||
unit_of_measurement: W
|
||||
device_class: power
|
||||
state_class: measurement
|
||||
accuracy_decimals: 1
|
||||
- platform: total_daily_energy
|
||||
name: Basement Bathroom Light
|
||||
power_id: light_power
|
||||
state_class: measurement
|
||||
|
||||
time:
|
||||
- platform: homeassistant
|
||||
|
@ -11,6 +11,10 @@ substitutions:
|
||||
packages:
|
||||
device_base: !include ../packages/device_base.yaml
|
||||
|
||||
external_components:
|
||||
- source: github://cbpowell/ESPSense
|
||||
components: [ espsense ]
|
||||
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
id: light_button
|
||||
@ -29,11 +33,28 @@ binary_sensor:
|
||||
then:
|
||||
- switch.toggle: heater
|
||||
|
||||
espsense:
|
||||
plugs:
|
||||
- name: Basement Bathroom Shower Light
|
||||
power_sensor: light_power
|
||||
voltage: 120
|
||||
- name: Basement Bathroom Heater
|
||||
power_sensor: heat_power
|
||||
voltage: 120
|
||||
|
||||
light:
|
||||
- platform: binary
|
||||
id: the_light
|
||||
name: "Basement Shower Light"
|
||||
output: light_output
|
||||
on_turn_on:
|
||||
- sensor.template.publish:
|
||||
id: light_power
|
||||
state: 11.5
|
||||
on_turn_off:
|
||||
- sensor.template.publish:
|
||||
id: light_power
|
||||
state: 0.0
|
||||
|
||||
output:
|
||||
- platform: gpio
|
||||
@ -51,3 +72,38 @@ switch:
|
||||
name: "Basement Bathroom Heater"
|
||||
icon: mdi:radiator
|
||||
pin: 4
|
||||
on_turn_on:
|
||||
- sensor.template.publish:
|
||||
id: heat_power
|
||||
state: 500
|
||||
on_turn_off:
|
||||
- sensor.template.publish:
|
||||
id: heat_power
|
||||
state: 0.0
|
||||
|
||||
sensor:
|
||||
- platform: template
|
||||
name: Basement Bathroom Shower Light
|
||||
id: light_power
|
||||
unit_of_measurement: W
|
||||
device_class: power
|
||||
state_class: measurement
|
||||
accuracy_decimals: 1
|
||||
- platform: template
|
||||
name: Basement Bathroom Heater
|
||||
id: heat_power
|
||||
unit_of_measurement: W
|
||||
device_class: power
|
||||
state_class: measurement
|
||||
accuracy_decimals: 1
|
||||
- platform: total_daily_energy
|
||||
name: Basement Bathroom Shower Light
|
||||
power_id: light_power
|
||||
state_class: measurement
|
||||
- platform: total_daily_energy
|
||||
name: Basement Bathroom Heater
|
||||
power_id: heat_power
|
||||
state_class: measurement
|
||||
|
||||
time:
|
||||
- platform: homeassistant
|
||||
|
@ -40,3 +40,7 @@ light:
|
||||
double_click_while_off_stays_off: true
|
||||
on_double_click_while_on:
|
||||
- script.execute: double_click
|
||||
power:
|
||||
id: power
|
||||
name: ${device_name} Power
|
||||
light_wattage: 21.6
|
||||
|
@ -15,7 +15,7 @@ script:
|
||||
entity_id: switch.basement_tv, switch.xbox, light.basement_tv, light.basement, light.bar, switch.pool_table_light, light.basement_bathroom_light, light.basement_shower_light
|
||||
|
||||
packages:
|
||||
feit_dimmer: !include ../packages/feit_dimmer.yaml
|
||||
feit_dimmer: !include ../packages/feit_dimmer_without_power.yaml
|
||||
|
||||
light:
|
||||
- platform: tuya_light_plus
|
||||
|
@ -26,3 +26,7 @@ light:
|
||||
night_default_brightness: 1
|
||||
day_auto_off_time: 0 min
|
||||
night_auto_off_time: 15 min
|
||||
power:
|
||||
id: power
|
||||
name: ${device_name} Power
|
||||
light_wattage: 11.8
|
||||
|
@ -26,3 +26,7 @@ light:
|
||||
night_default_brightness: 1
|
||||
day_auto_off_time: 0 min
|
||||
night_auto_off_time: 15 min
|
||||
power:
|
||||
id: power
|
||||
name: ${device_name} Power
|
||||
light_wattage: 22.6
|
||||
|
@ -26,3 +26,7 @@ light:
|
||||
night_default_brightness: 1
|
||||
day_auto_off_time: 0 min
|
||||
night_auto_off_time: 15 min
|
||||
power:
|
||||
id: power
|
||||
name: ${device_name} Power
|
||||
light_wattage: 21.6
|
||||
|
@ -26,3 +26,7 @@ light:
|
||||
night_default_brightness: 1
|
||||
day_auto_off_time: 0 min
|
||||
night_auto_off_time: 15 min
|
||||
power:
|
||||
id: power
|
||||
name: ${device_name} Power
|
||||
light_wattage: 33.8
|
||||
|
@ -7,7 +7,7 @@ substitutions:
|
||||
ap_wifi_pwd: !secret front_entry_lights_2_ap_wifi_pwd
|
||||
|
||||
packages:
|
||||
feit_dimmer: !include ../packages/feit_dimmer.yaml
|
||||
feit_dimmer: !include ../packages/feit_dimmer_without_power.yaml
|
||||
|
||||
light:
|
||||
- platform: tuya_light_plus
|
||||
|
@ -23,3 +23,7 @@ light:
|
||||
double_click_while_off_stays_off: false
|
||||
on_turn_off:
|
||||
- lambda: tuya_tuyalightplus->set_auto_off_time(30 * 60 * 1000);
|
||||
power:
|
||||
id: power
|
||||
name: ${device_name} Power
|
||||
light_wattage: 73.4
|
||||
|
@ -26,3 +26,7 @@ light:
|
||||
night_default_brightness: 1
|
||||
day_auto_off_time: 0 min
|
||||
night_auto_off_time: 15 min
|
||||
power:
|
||||
id: power
|
||||
name: ${device_name} Power
|
||||
light_wattage: 32.4
|
||||
|
@ -26,3 +26,7 @@ light:
|
||||
night_default_brightness: 1
|
||||
day_auto_off_time: 0 min
|
||||
night_auto_off_time: 15 min
|
||||
power:
|
||||
id: power
|
||||
name: ${device_name} Power
|
||||
light_wattage: 55.1
|
||||
|
@ -26,3 +26,7 @@ light:
|
||||
night_default_brightness: 1
|
||||
day_auto_off_time: 0 min
|
||||
night_auto_off_time: 15 min
|
||||
power:
|
||||
id: power
|
||||
name: ${device_name} Power
|
||||
light_wattage: 117.6
|
||||
|
@ -5,6 +5,7 @@ substitutions:
|
||||
ota_pwd: !secret master_bath_fan_ota_pwd
|
||||
api_pwd: !secret master_bath_fan_api_pwd
|
||||
ap_wifi_pwd: !secret master_bath_fan_ap_wifi_pwd
|
||||
fan_wattage: "26.6"
|
||||
|
||||
packages:
|
||||
device_base: !include ../packages/feit_dimmer_as_fan.yaml
|
||||
|
@ -26,3 +26,7 @@ light:
|
||||
night_default_brightness: 1
|
||||
day_auto_off_time: 0 min
|
||||
night_auto_off_time: 15 min
|
||||
power:
|
||||
id: power
|
||||
name: ${device_name} Power
|
||||
light_wattage: 35.5
|
||||
|
@ -7,7 +7,7 @@ substitutions:
|
||||
ap_wifi_pwd: !secret master_bath_lights_2_ap_wifi_pwd
|
||||
|
||||
packages:
|
||||
feit_dimmer: !include ../packages/feit_dimmer.yaml
|
||||
feit_dimmer: !include ../packages/feit_dimmer_without_power.yaml
|
||||
|
||||
light:
|
||||
- platform: tuya_light_plus
|
||||
|
@ -26,3 +26,7 @@ light:
|
||||
night_default_brightness: 1
|
||||
day_auto_off_time: 0 min
|
||||
night_auto_off_time: 15 min
|
||||
power:
|
||||
id: power
|
||||
name: ${device_name} Power
|
||||
light_wattage: 36.7
|
||||
|
@ -11,12 +11,46 @@ substitutions:
|
||||
packages:
|
||||
device_base: !include ../packages/device_base.yaml
|
||||
|
||||
external_components:
|
||||
- source: github://cbpowell/ESPSense
|
||||
components: [ espsense ]
|
||||
|
||||
espsense:
|
||||
plugs:
|
||||
- name: Patio Lights
|
||||
power_sensor: power
|
||||
voltage: 120
|
||||
|
||||
light:
|
||||
- platform: binary
|
||||
name: "Patio Lights"
|
||||
output: patio_lights_output
|
||||
on_turn_on:
|
||||
- sensor.template.publish:
|
||||
id: power
|
||||
state: 15.3
|
||||
on_turn_off:
|
||||
- sensor.template.publish:
|
||||
id: power
|
||||
state: 0.0
|
||||
|
||||
output:
|
||||
- platform: gpio
|
||||
id: patio_lights_output
|
||||
pin: D1
|
||||
|
||||
sensor:
|
||||
- platform: template
|
||||
name: Patio Lights Power
|
||||
id: power
|
||||
unit_of_measurement: W
|
||||
device_class: power
|
||||
state_class: measurement
|
||||
accuracy_decimals: 1
|
||||
- platform: total_daily_energy
|
||||
name: Patio Lights
|
||||
power_id: power
|
||||
state_class: measurement
|
||||
|
||||
time:
|
||||
- platform: homeassistant
|
||||
|
@ -15,6 +15,10 @@ esphome:
|
||||
includes:
|
||||
- ../custom/TreoLedPoolLight.h
|
||||
|
||||
external_components:
|
||||
- source: github://cbpowell/ESPSense
|
||||
components: [ espsense ]
|
||||
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
id: patio_lights_button
|
||||
@ -54,6 +58,12 @@ binary_sensor:
|
||||
then:
|
||||
- switch.turn_off: patio_lights_indicator
|
||||
|
||||
espsense:
|
||||
plugs:
|
||||
- name: Pool Lights
|
||||
power_sensor: pool_light_power
|
||||
voltage: 120
|
||||
|
||||
light:
|
||||
- platform: custom
|
||||
lambda: |-
|
||||
@ -63,6 +73,27 @@ light:
|
||||
lights:
|
||||
- id: pool_lights
|
||||
name: "Pool Lights"
|
||||
on_turn_on:
|
||||
- sensor.template.publish:
|
||||
id: pool_light_power
|
||||
state: 10.0
|
||||
on_turn_off:
|
||||
- sensor.template.publish:
|
||||
id: pool_light_power
|
||||
state: 0.0
|
||||
|
||||
sensor:
|
||||
- platform: template
|
||||
name: Pool Lights Power
|
||||
id: pool_light_power
|
||||
unit_of_measurement: W
|
||||
device_class: power
|
||||
state_class: measurement
|
||||
accuracy_decimals: 1
|
||||
- platform: total_daily_energy
|
||||
name: Pool Lights
|
||||
power_id: pool_light_power
|
||||
state_class: measurement
|
||||
|
||||
status_led:
|
||||
pin:
|
||||
@ -73,3 +104,6 @@ switch:
|
||||
- platform: gpio
|
||||
id: patio_lights_indicator
|
||||
pin: 13
|
||||
|
||||
time:
|
||||
- platform: homeassistant
|
@ -11,6 +11,21 @@ substitutions:
|
||||
packages:
|
||||
device_base: !include ../packages/device_base.yaml
|
||||
|
||||
external_components:
|
||||
- source: github://cbpowell/ESPSense
|
||||
components: [ espsense ]
|
||||
|
||||
espsense:
|
||||
plugs:
|
||||
- name: Pool Pump
|
||||
power_sensor: pool_pump_power
|
||||
current_sensor: pool_pump_current
|
||||
voltage_sensor: voltage
|
||||
- name: Pool Cleaner
|
||||
power_sensor: pool_cleaner_power
|
||||
current_sensor: pool_cleaner_current
|
||||
voltage_sensor: voltage
|
||||
|
||||
i2c:
|
||||
sda: GPIO12
|
||||
scl: GPIO14
|
||||
@ -19,10 +34,12 @@ sensor:
|
||||
- platform: ade7953
|
||||
voltage:
|
||||
name: ${device_name} Voltage
|
||||
id: voltage
|
||||
filters:
|
||||
- multiply: 2
|
||||
current_a:
|
||||
name: Pool Cleaner Current
|
||||
id: pool_cleaner_current
|
||||
filters:
|
||||
- lambda: |-
|
||||
// Filter the initial high current spike when the motor starts to prevent tripping the on_value_range logic
|
||||
@ -43,6 +60,7 @@ sensor:
|
||||
- switch.turn_off: pool_cleaner
|
||||
current_b:
|
||||
name: Pool Pump Current
|
||||
id: pool_pump_current
|
||||
filters:
|
||||
- lambda: |-
|
||||
// Filter the initial high current spike when the motor starts to prevent tripping the on_value_range logic
|
||||
@ -63,10 +81,12 @@ sensor:
|
||||
- switch.turn_off: pool_pump
|
||||
active_power_a:
|
||||
name: Pool Cleaner Power
|
||||
id: pool_cleaner_power
|
||||
filters:
|
||||
- lambda: "return x < .1 ? 0 : x * 2;"
|
||||
active_power_b:
|
||||
name: Pool Pump Power
|
||||
id: pool_pump_power
|
||||
filters:
|
||||
- lambda: "return abs(x) < .1 ? 0 : abs(x) * 2;"
|
||||
update_interval: 2s
|
||||
@ -92,6 +112,14 @@ sensor:
|
||||
name: "Pool Mode Id"
|
||||
id: pool_mode_id
|
||||
internal: true
|
||||
- platform: total_daily_energy
|
||||
name: "Pool Pump Total Daily Energy"
|
||||
power_id: pool_pump_power
|
||||
state_class: "measurement"
|
||||
- platform: total_daily_energy
|
||||
name: "Pool Cleaner Total Daily Energy"
|
||||
power_id: pool_cleaner_power
|
||||
state_class: "measurement"
|
||||
|
||||
status_led:
|
||||
pin:
|
||||
|
@ -7,10 +7,27 @@ external_components:
|
||||
type: local
|
||||
path: ../components
|
||||
components: [ tuya, tuya_light_plus ]
|
||||
- source: github://cbpowell/ESPSense
|
||||
components: [ espsense ]
|
||||
|
||||
espsense:
|
||||
plugs:
|
||||
- name: ${device_name}
|
||||
power_sensor: power
|
||||
voltage: 120
|
||||
|
||||
packages:
|
||||
base: !include device_base.yaml
|
||||
logger: !include logger/logger_no_serial.yaml
|
||||
uart: !include uart/tuya.yaml
|
||||
|
||||
sensor:
|
||||
- platform: total_daily_energy
|
||||
name: ${device_name}
|
||||
power_id: power
|
||||
state_class: measurement
|
||||
|
||||
time:
|
||||
- platform: homeassistant
|
||||
|
||||
tuya:
|
||||
|
@ -7,13 +7,19 @@ external_components:
|
||||
type: local
|
||||
path: ../components
|
||||
components: [ tuya, tuya_dimmer_as_fan ]
|
||||
- source: github://cbpowell/ESPSense
|
||||
components: [ espsense ]
|
||||
|
||||
packages:
|
||||
base: !include device_base.yaml
|
||||
logger: !include logger/logger_no_serial.yaml
|
||||
uart: !include uart/tuya.yaml
|
||||
|
||||
tuya:
|
||||
espsense:
|
||||
plugs:
|
||||
- name: ${device_name}
|
||||
power_sensor: power
|
||||
voltage: 120
|
||||
|
||||
fan:
|
||||
- platform: tuya_dimmer_as_fan
|
||||
@ -22,3 +28,18 @@ fan:
|
||||
switch_datapoint: 1
|
||||
dimmer_datapoint: 2
|
||||
dimmer_max_value: 1000
|
||||
power:
|
||||
id: power
|
||||
name: ${device_name} Power
|
||||
fan_wattage: ${fan_wattage}
|
||||
|
||||
sensor:
|
||||
- platform: total_daily_energy
|
||||
name: ${device_name}
|
||||
power_id: power
|
||||
state_class: measurement
|
||||
|
||||
time:
|
||||
- platform: homeassistant
|
||||
|
||||
tuya:
|
||||
|
16
packages/feit_dimmer_without_power.yaml
Normal file
16
packages/feit_dimmer_without_power.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
substitutions:
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
|
||||
external_components:
|
||||
- source:
|
||||
type: local
|
||||
path: ../components
|
||||
components: [ tuya, tuya_light_plus ]
|
||||
|
||||
packages:
|
||||
base: !include device_base.yaml
|
||||
logger: !include logger/logger_no_serial.yaml
|
||||
uart: !include uart/tuya.yaml
|
||||
|
||||
tuya:
|
Loading…
Reference in New Issue
Block a user