diff --git a/components/binary_light_with_power/light.py b/components/binary_light_with_power/light.py index 01f290f..ed6bc46 100644 --- a/components/binary_light_with_power/light.py +++ b/components/binary_light_with_power/light.py @@ -9,7 +9,7 @@ from esphome.const import ( UNIT_WATT, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT, - ICON_POWER, + ICON_FLASH, CONF_UPDATE_INTERVAL, ) @@ -27,7 +27,7 @@ CONFIG_SCHEMA = light.BINARY_LIGHT_SCHEMA.extend( accuracy_decimals=1, device_class=DEVICE_CLASS_POWER, state_class=STATE_CLASS_MEASUREMENT, - icon=ICON_POWER, + icon=ICON_FLASH, ).extend( { cv.Optional(CONF_LIGHT_WATTAGE): cv.positive_float, diff --git a/components/gpio_switch_with_power/gpio_switch_with_power.h b/components/gpio_switch_with_power/gpio_switch_with_power.h index 708660a..1655a03 100644 --- a/components/gpio_switch_with_power/gpio_switch_with_power.h +++ b/components/gpio_switch_with_power/gpio_switch_with_power.h @@ -1,7 +1,7 @@ #pragma once #include "esphome/core/component.h" -#include "esphome/core/gpio.h" +#include "esphome/core/hal.h" #include "esphome/components/sensor/sensor.h" #include "esphome/components/switch/switch.h" diff --git a/components/gpio_switch_with_power/switch.py b/components/gpio_switch_with_power/switch.py index 6121a67..a656b6d 100644 --- a/components/gpio_switch_with_power/switch.py +++ b/components/gpio_switch_with_power/switch.py @@ -11,7 +11,7 @@ from esphome.const import ( UNIT_WATT, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT, - ICON_POWER, + ICON_FLASH, CONF_UPDATE_INTERVAL, ) @@ -47,7 +47,7 @@ CONFIG_SCHEMA = switch.SWITCH_SCHEMA.extend( accuracy_decimals=1, device_class=DEVICE_CLASS_POWER, state_class=STATE_CLASS_MEASUREMENT, - icon=ICON_POWER, + icon=ICON_FLASH, ).extend( { cv.Optional(CONF_DEVICE_WATTAGE): cv.positive_float, diff --git a/components/pool_controller/pump_switch.cpp b/components/pool_controller/pump_switch.cpp index 0ddf2d8..6e4cb3c 100644 --- a/components/pool_controller/pump_switch.cpp +++ b/components/pool_controller/pump_switch.cpp @@ -45,7 +45,7 @@ void PumpSwitch::setup() { void PumpSwitch::loop() { this->update_physical_switch_(); - this->check_current_(); + //this->check_current_(); } void PumpSwitch::update() { diff --git a/components/treo_led_pool_light/light.py b/components/treo_led_pool_light/light.py index be49d75..60f3e87 100644 --- a/components/treo_led_pool_light/light.py +++ b/components/treo_led_pool_light/light.py @@ -9,7 +9,7 @@ from esphome.const import ( UNIT_WATT, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT, - ICON_POWER, + ICON_FLASH, CONF_UPDATE_INTERVAL, ) @@ -30,7 +30,7 @@ CONFIG_SCHEMA = cv.All( accuracy_decimals=1, device_class=DEVICE_CLASS_POWER, state_class=STATE_CLASS_MEASUREMENT, - icon=ICON_POWER, + icon=ICON_FLASH, ).extend( { cv.Optional(CONF_LIGHT_WATTAGE): cv.positive_float, diff --git a/components/tuya_dimmer_as_fan/fan.py b/components/tuya_dimmer_as_fan/fan.py index 05dd0b0..4e0b3e7 100644 --- a/components/tuya_dimmer_as_fan/fan.py +++ b/components/tuya_dimmer_as_fan/fan.py @@ -1,7 +1,7 @@ from esphome.components import fan, sensor import esphome.config_validation as cv import esphome.codegen as cg -from esphome.components.tuya import CONF_TUYA_ID, Tuya +from esphome.components.tuya import tuya_ns, CONF_TUYA_ID, Tuya from esphome.const import ( CONF_OUTPUT_ID, CONF_SWITCH_DATAPOINT, @@ -19,8 +19,8 @@ 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) +TuyaFan = tuya_ns.class_("TuyaDimmerAsFan", cg.PollingComponent, fan.Fan) + CONFIG_SCHEMA = cv.All( fan.FAN_SCHEMA.extend( @@ -49,12 +49,10 @@ CONFIG_SCHEMA = cv.All( async def to_code(config): parent = await cg.get_variable(config[CONF_TUYA_ID]) - state = await fan.create_fan_state(config) - var = cg.new_Pvariable( - config[CONF_OUTPUT_ID], parent, state - ) + var = cg.new_Pvariable(config[CONF_OUTPUT_ID], parent) await cg.register_component(var, config) + await fan.register_fan(var, config) cg.add(var.set_switch_id(config[CONF_SWITCH_DATAPOINT])) cg.add(var.set_dimmer_id(config[CONF_DIMMER_DATAPOINT])) diff --git a/components/tuya_dimmer_as_fan/tuya_dimmer_as_fan.cpp b/components/tuya_dimmer_as_fan/tuya_dimmer_as_fan.cpp index 053f371..73eb35c 100644 --- a/components/tuya_dimmer_as_fan/tuya_dimmer_as_fan.cpp +++ b/components/tuya_dimmer_as_fan/tuya_dimmer_as_fan.cpp @@ -8,19 +8,10 @@ namespace tuya { static const char *const TAG = "tuya.fan"; void TuyaDimmerAsFan::setup() { - auto traits = fan::FanTraits(false, false, false, 1); - this->fan_->set_traits(traits); - this->parent_->register_listener(*this->switch_id_, [this](const TuyaDatapoint &datapoint) { - 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->state = datapoint.value_bool; + this->publish_state(); + this->update(); }); this->parent_->register_listener(*this->dimmer_id_, [this](const TuyaDatapoint &datapoint) { @@ -30,8 +21,6 @@ void TuyaDimmerAsFan::setup() { } }); - this->fan_->add_on_state_callback([this]() { this->parent_->set_boolean_datapoint_value(*this->switch_id_, this->fan_->state); }); - // Make sure we start at the max value this->parent_->set_integer_datapoint_value(*this->dimmer_id_, this->dimmer_max_value_); } @@ -42,11 +31,16 @@ void TuyaDimmerAsFan::dump_config() { ESP_LOGCONFIG(TAG, " Dimmer has datapoint ID %u", *this->dimmer_id_); } +void TuyaDimmerAsFan::control(const fan::FanCall &call) { + this->parent_->set_boolean_datapoint_value(*this->switch_id_, *call.get_state()); +} + void TuyaDimmerAsFan::update() { - if (this->fan_wattage_.has_value() && this->power_sensor_ != nullptr && this->fan_->state) + if (this->fan_wattage_.has_value() && this->power_sensor_ != nullptr) { - this->power_sensor_->publish_state(this->fan_wattage_.value()); + float power = this->state ? this->fan_wattage_.value() : 0.0f; + this->power_sensor_->publish_state(power); } } diff --git a/components/tuya_dimmer_as_fan/tuya_dimmer_as_fan.h b/components/tuya_dimmer_as_fan/tuya_dimmer_as_fan.h index 9f66a5a..cb26099 100644 --- a/components/tuya_dimmer_as_fan/tuya_dimmer_as_fan.h +++ b/components/tuya_dimmer_as_fan/tuya_dimmer_as_fan.h @@ -8,9 +8,9 @@ namespace esphome { namespace tuya { -class TuyaDimmerAsFan : public PollingComponent { +class TuyaDimmerAsFan : public PollingComponent, public fan::Fan { public: - TuyaDimmerAsFan(Tuya *parent, fan::FanState *fan) : parent_(parent), fan_(fan) {} + TuyaDimmerAsFan(Tuya *parent) : parent_(parent) {} void setup() override; void dump_config() override; void set_switch_id(uint8_t switch_id) { this->switch_id_ = switch_id; } @@ -18,14 +18,16 @@ class TuyaDimmerAsFan : public PollingComponent { 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; } + fan::FanTraits get_traits() override { return fan::FanTraits(false, false, false, 1); } void update() override; protected: + void control(const fan::FanCall &call) override; + Tuya *parent_; optional switch_id_{}; optional dimmer_id_{}; uint32_t dimmer_max_value_ = 255; - fan::FanState *fan_; optional fan_wattage_{}; sensor::Sensor *power_sensor_; }; diff --git a/components/tuya_light_plus/tuya_light_plus.cpp b/components/tuya_light_plus/tuya_light_plus.cpp index dc12eca..3cb229e 100644 --- a/components/tuya_light_plus/tuya_light_plus.cpp +++ b/components/tuya_light_plus/tuya_light_plus.cpp @@ -178,10 +178,8 @@ void TuyaLightPlus::handle_tuya_datapoint_(tuya::TuyaDatapoint datapoint) } } - // When the light is turned on at the switch the level of the Tuya device will stll be 0 so we set it to the current state value - float brightness; - this->state_->current_values_as_brightness(&brightness); - this->parent_->set_integer_datapoint_value(*this->dimmer_id_, this->brightness_to_tuya_level_(brightness)); + // When the light is turned on at the switch the level of the Tuya device will stll be 0 so we set it to the default brightness or 1.0 if no default + this->parent_->set_integer_datapoint_value(*this->dimmer_id_, this->brightness_to_tuya_level_(this->default_brightness_.value_or(1.0))); } // Turned off with the physical button @@ -199,15 +197,12 @@ void TuyaLightPlus::handle_tuya_datapoint_(tuya::TuyaDatapoint datapoint) this->tuya_state_is_on_ = datapoint.value_bool; this->state_->current_values.set_state(datapoint.value_bool); - // If the light was turned off we set the brightness of the Tuya device to 0 to prevent flashes during double clicks and if there is a - // default brightness set the current brightness value to the default so that if it is turned on remotely it will be at the default value + // If the light was turned off we set the brightness of the Tuya device to 0 to prevent flashes during double clicks and set the current + // brightness value to the default value or 1.0 if no default so that if it is turned on remotely it will be at the default value if (!datapoint.value_bool) { this->parent_->set_integer_datapoint_value(*this->dimmer_id_, 0); - if (this->default_brightness_.has_value()) - { - this->state_->current_values.set_brightness(*this->default_brightness_); - } + this->state_->current_values.set_brightness(this->default_brightness_.value_or(1.0)); } } else if (datapoint.id == *this->dimmer_id_) diff --git a/devices/basement_bathroom_light_fan.yaml b/devices/basement_bathroom_light_fan.yaml index 7fe6353..1718d21 100644 --- a/devices/basement_bathroom_light_fan.yaml +++ b/devices/basement_bathroom_light_fan.yaml @@ -1,7 +1,6 @@ substitutions: device_id: basement_bathroom_light_fan device_name: Basement Bathroom Light and Fan - platform: ESP8266 board: esp01_1m ip_address: !secret basement-bathroom-light-fan-ip ota_pwd: !secret basement-bathroom-light-fan-ota-pwd diff --git a/devices/basement_bathroom_sensor.yaml b/devices/basement_bathroom_sensor.yaml index 3b7e9cf..ffa1c41 100644 --- a/devices/basement_bathroom_sensor.yaml +++ b/devices/basement_bathroom_sensor.yaml @@ -1,7 +1,6 @@ substitutions: device_id: basement_bathroom_sensor device_name: Basement Bathroom Sensor - platform: ESP8266 board: d1_mini ip_address: !secret basement-bathroom-sensor-ip ota_pwd: !secret basement-bathroom-sensor-ota-pwd diff --git a/devices/basement_bathroom_shower_light_heater.yaml b/devices/basement_bathroom_shower_light_heater.yaml index aaa95af..dc109a7 100644 --- a/devices/basement_bathroom_shower_light_heater.yaml +++ b/devices/basement_bathroom_shower_light_heater.yaml @@ -1,7 +1,6 @@ substitutions: device_id: basement_bath_shower_light_heat device_name: Basement Bathroom Shower Light and Heater - platform: ESP8266 board: esp01_1m ip_address: !secret basement-bathroom-shower-light-heater-ip ota_pwd: !secret basement-bathroom-shower-light-heater-ota-pwd diff --git a/devices/coffee_maker.yaml b/devices/coffee_maker.yaml index f4c605b..4ff0ca4 100644 --- a/devices/coffee_maker.yaml +++ b/devices/coffee_maker.yaml @@ -1,7 +1,6 @@ substitutions: device_id: coffee_maker device_name: Coffee Maker - platform: ESP8266 board: nodemcuv2 ip_address: !secret coffee-maker-ip ota_pwd: !secret coffee-maker-ota-pwd diff --git a/devices/computer_light.yaml b/devices/computer_light.yaml index c57d1e0..72b80cd 100644 --- a/devices/computer_light.yaml +++ b/devices/computer_light.yaml @@ -29,4 +29,5 @@ light: power: id: power name: ${device_name} Power + icon: mdi:flash light_wattage: 11.8 diff --git a/devices/fire_pit_fountain.yaml b/devices/fire_pit_fountain.yaml index adc3c53..707bd9d 100644 --- a/devices/fire_pit_fountain.yaml +++ b/devices/fire_pit_fountain.yaml @@ -1,7 +1,6 @@ substitutions: device_id: fire_pit_fountain device_name: Fire Pit and Fountain - platform: ESP8266 board: d1_mini ip_address: !secret fire-pit-fountain-ip ota_pwd: !secret fire-pit-fountain-ota-pwd diff --git a/devices/garage-lights.yaml b/devices/garage-lights.yaml new file mode 100644 index 0000000..326e3e6 --- /dev/null +++ b/devices/garage-lights.yaml @@ -0,0 +1,11 @@ +substitutions: + device_id: garage-lights + device_name: Garage Lights + ip_address: !secret garage-lights-ip + ota_pwd: !secret garage-lights-ota-pwd + api_pwd: !secret garage-lights-api-pwd + ap_wifi_pwd: !secret garage-lights-ap-pwd + light_wattage: '378' + +packages: + shelly_1l: !include ../packages/shelly_1l.yaml diff --git a/devices/master_bath_humidity_temp_sensor.yaml b/devices/master-bath-hum-temp-sensor.yaml similarity index 78% rename from devices/master_bath_humidity_temp_sensor.yaml rename to devices/master-bath-hum-temp-sensor.yaml index c277cfa..3499439 100644 --- a/devices/master_bath_humidity_temp_sensor.yaml +++ b/devices/master-bath-hum-temp-sensor.yaml @@ -1,12 +1,11 @@ substitutions: - device_id: master_bath_humidity_temp_sensor + device_id: master-bath-hum-temp-sensor device_name: Master Bathroom Humidity and Temperature Sensor - platform: ESP8266 board: d1_mini - ip_address: !secret master-bath-humidity-temp-sensor-ip - ota_pwd: !secret master-bath-humidity-temp-sensor-ota-pwd - api_pwd: !secret master-bath-humidity-temp-sensor-api-pwd - ap_wifi_pwd: !secret master-bath-humidity-temp-sensor-ap-pwd + ip_address: !secret master-bath-hum-temp-sensor-ip + ota_pwd: !secret master-bath-hum-temp-sensor-ota-pwd + api_pwd: !secret master-bath-hum-temp-sensor-api-pwd + ap_wifi_pwd: !secret master-bath-hum-temp-sensor-ap-pwd packages: device_base: !include ../packages/device_base.yaml diff --git a/devices/master_bed.yaml b/devices/master_bed.yaml index 8b3256e..e9b201a 100644 --- a/devices/master_bed.yaml +++ b/devices/master_bed.yaml @@ -1,7 +1,6 @@ substitutions: device_id: master_bed device_name: Master Bed - platform: ESP8266 board: nodemcuv2 ip_address: !secret master-bed-ip ota_pwd: !secret master-bed-ota-pwd diff --git a/devices/patio_lights.yaml b/devices/patio-lights.yaml similarity index 95% rename from devices/patio_lights.yaml rename to devices/patio-lights.yaml index f5edbdb..efa29a7 100644 --- a/devices/patio_lights.yaml +++ b/devices/patio-lights.yaml @@ -1,7 +1,6 @@ substitutions: - device_id: patio_lights + device_id: patio-lights device_name: Patio Lights - platform: ESP8266 board: d1_mini ip_address: !secret patio-lights-ip ota_pwd: !secret patio-lights-ota-pwd diff --git a/devices/pool_and_patio_lights.yaml b/devices/pool_and_patio_lights.yaml index 998a90f..9c1fdd9 100644 --- a/devices/pool_and_patio_lights.yaml +++ b/devices/pool_and_patio_lights.yaml @@ -1,7 +1,6 @@ substitutions: device_id: pool_and_patio_lights device_name: Pool and Patio Lights - platform: ESP8266 board: esp01_1m ip_address: !secret pool-and-patio-lights-ip ota_pwd: !secret pool-and-patio-lights-ota-pwd @@ -77,6 +76,7 @@ light: sensor: - platform: total_daily_energy name: Pool Lights + icon: mdi:flash power_id: pool_light_power method: left min_save_interval: 10min diff --git a/devices/pool_pumps.yaml b/devices/pool_pumps.yaml index f8df514..10e488f 100644 --- a/devices/pool_pumps.yaml +++ b/devices/pool_pumps.yaml @@ -1,7 +1,6 @@ substitutions: device_id: pool_pumps device_name: Pool Pumps - platform: ESP8266 board: modwifi ip_address: !secret pool-pumps-ip ota_pwd: !secret pool-pumps-ota-pwd @@ -97,11 +96,13 @@ sensor: pin: A0 - platform: total_daily_energy name: "Pool Pump Total Daily Energy" + icon: mdi:flash power_id: pool_pump_power method: left min_save_interval: 10min - platform: total_daily_energy name: "Pool Cleaner Total Daily Energy" + icon: mdi:flash power_id: pool_cleaner_power method: left min_save_interval: 10min diff --git a/devices/scripture_of_the_day_test.yaml b/devices/scripture_of_the_day_test.yaml new file mode 100644 index 0000000..ff19db9 --- /dev/null +++ b/devices/scripture_of_the_day_test.yaml @@ -0,0 +1,53 @@ +substitutions: + platform: esp32 + board: esp32dev + log_level: none + wifi_ssid: secret_wifi_ssid + wifi_password: secret_wifi_password + device_id: scripture-of-the-day-test + device_name: Scripture of the Day Test + +esphome: + name: ${device_id} + platform: ${platform} + board: ${board} + arduino_version: latest + build_path: ../build/${device_id} + +packages: + wifi: !include ../packages/wifi/wifi_dhcp.yaml + logger: !include ../packages/logger/logger.yaml + +external_components: + - source: + type: local + path: ../../esphome/esphome/components + components: [ ds3231 ] + +i2c: + +ds3231: + id: ds_rtc + +time: + - platform: sntp + id: sntp_cmp + timezone: America/Chicago + - platform: ds3231 + id: rtc + timezone: America/Chicago + on_time_sync: + then: + - ds3231.set_alarm_1: + id: ds_rtc + alarm_type: match_day_of_month_hour_minute_second + second: 1 + minute: 2 + hour: 3 + day: 4 + - ds3231.reset_alarm_1: + id: ds_rtc + - ds3231.set_alarm_2: + id: ds_rtc + alarm_type: every_minute + - ds3231.reset_alarm_2: ds_rtc diff --git a/packages/feit_dimmer.yaml b/packages/feit_dimmer.yaml index d9e9d80..1e1a10e 100644 --- a/packages/feit_dimmer.yaml +++ b/packages/feit_dimmer.yaml @@ -1,5 +1,4 @@ substitutions: - platform: ESP8266 board: esp01_1m external_components: @@ -24,6 +23,7 @@ espsense: sensor: - platform: total_daily_energy name: ${device_name} + icon: mdi:flash power_id: power method: left min_save_interval: 10min diff --git a/packages/feit_dimmer_as_fan.yaml b/packages/feit_dimmer_as_fan.yaml index 8bbb7b5..fc56240 100644 --- a/packages/feit_dimmer_as_fan.yaml +++ b/packages/feit_dimmer_as_fan.yaml @@ -1,5 +1,4 @@ substitutions: - platform: ESP8266 board: esp01_1m external_components: diff --git a/packages/feit_dimmer_without_power.yaml b/packages/feit_dimmer_without_power.yaml index 8391e48..cf2a9fd 100644 --- a/packages/feit_dimmer_without_power.yaml +++ b/packages/feit_dimmer_without_power.yaml @@ -1,5 +1,4 @@ substitutions: - platform: ESP8266 board: esp01_1m external_components: diff --git a/packages/shelly_1l.yaml b/packages/shelly_1l.yaml new file mode 100644 index 0000000..9df38cc --- /dev/null +++ b/packages/shelly_1l.yaml @@ -0,0 +1,69 @@ +substitutions: + board: esp01_1m + light_wattage: '0' + +external_components: + - source: + type: local + path: ../components + components: [ binary_light_with_power ] + - source: github://cbpowell/ESPSense + components: [ espsense ] + +packages: + base: !include device_base.yaml + logger: !include logger/logger.yaml + +binary_sensor: + - platform: gpio + id: on_button + pin: + number: GPIO4 + filters: + - delayed_on_off: 50ms + on_press: + then: + - light.turn_on: shelly_light + - platform: gpio + id: off_button + pin: + number: GPIO14 + filters: + - delayed_on_off: 50ms + on_press: + then: + - light.turn_off: shelly_light + +espsense: + plugs: + - name: ${device_name} + power_sensor: light_power + voltage: 120 + +light: + - platform: binary_light_with_power + id: shelly_light + name: ${device_name} + output: shelly_relay + power: + id: light_power + name: ${device_name} Power + light_wattage: ${light_wattage} + +output: + - platform: gpio + pin: GPIO5 + id: shelly_relay + +sensor: + - platform: total_daily_energy + name: ${device_name} + power_id: light_power + method: left + min_save_interval: 10min + +status_led: + pin: GPIO0 + +time: + - platform: homeassistant diff --git a/packages/topgreener_smart_plug.yaml b/packages/topgreener_smart_plug.yaml index 007352e..c4dc0b1 100644 --- a/packages/topgreener_smart_plug.yaml +++ b/packages/topgreener_smart_plug.yaml @@ -1,6 +1,5 @@ # Model TGWF115PQM substitutions: - platform: ESP8266 board: esp01_1m restore_mode: ALWAYS_ON @@ -14,7 +13,7 @@ packages: binary_sensor: - platform: gpio - id: button + id: power_button pin: number: GPIO3 inverted: True @@ -49,6 +48,7 @@ sensor: update_interval: 2s - platform: total_daily_energy name: ${device_name} + icon: mdi:flash power_id: power method: trapezoid min_save_interval: 10min @@ -61,6 +61,7 @@ status_led: switch: - platform: gpio name: ${device_name} Power Switch + icon: mdi:power id: relay pin: GPIO14 restore_mode: ${restore_mode} diff --git a/packages/topgreener_smart_plug_as_fan.yaml b/packages/topgreener_smart_plug_as_fan.yaml new file mode 100644 index 0000000..1a16366 --- /dev/null +++ b/packages/topgreener_smart_plug_as_fan.yaml @@ -0,0 +1,72 @@ +# Model TGWF115PQM +substitutions: + board: esp01_1m + restore_mode: ALWAYS_ON + +external_components: + - source: github://cbpowell/ESPSense + components: [ espsense ] + +packages: + base: !include device_base.yaml + logger: !include logger/logger_no_serial.yaml + +binary_sensor: + - platform: gpio + id: button + pin: + number: GPIO3 + inverted: True + on_press: + then: + - switch.toggle: relay + +espsense: + plugs: + - name: ${device_name} + power_sensor: power + voltage: 120 + +fan: + - platform: binary + name: ${device_name} + output: relay + +output: + - platform: gpio + name: ${device_name} + id: relay + pin: GPIO14 + +sensor: + - platform: hlw8012 + sel_pin: + number: GPIO12 + inverted: True + cf_pin: GPIO04 + cf1_pin: GPIO5 + current_resistor: "0.0019" + voltage_divider: "2150" + current: + name: ${device_name} Current + unit_of_measurement: A + power: + id: power + name: ${device_name} Power + unit_of_measurement: W + initial_mode: CURRENT + change_mode_every: 4294967295 + update_interval: 2s + - platform: total_daily_energy + name: ${device_name} + power_id: power + method: trapezoid + min_save_interval: 10min + +status_led: + pin: + number: GPIO13 + inverted: False + +time: + - platform: homeassistant