diff --git a/README.md b/README.md index 9e19ce1..86b842f 100644 --- a/README.md +++ b/README.md @@ -45,9 +45,6 @@ This a modified version of the [Tuya fan](https://esphome.io/components/fan/tuya ### Tuya Light Plus This an enhanced version of the standard [Tuya light](https://esphome.io/components/light/tuya.html) component that adds a bunch of extra features. I use this component with [Feit Dimmers](https://www.feit.com/product/smart-wi-fi-dimmer/) but it will likely work with other Tuya dimmers. More details on features and how to use this component are available [here](./components/tuya_light_plus/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) @@ -77,6 +74,11 @@ This project was one of the first projects I have done that I would call woodwor

FrontBack +## Energy Monitor +### [Emporia Gen 2 Vue](https://www.emporiaenergy.com/how-the-vue-energy-monitor-works) +This device is sinificantly cheaper then a Sense Energy Monitor, can monitor 16 circuits in addition to the mains (Sense can only do 2 additional), and comes with all of the additional CT clamps. Like the Sense it is intended to work with a cloud service but because it is based on an ESP32 it can be flashed with ESPHome and made a local only device. More details can be found [here](https://gist.github.com/flaviut/93a1212c7b165c7674693a45ad52c512). + + ## Smart Plugs ### [TOPGREENER TGWF115PQM Smart Plugs](https://www.amazon.com/gp/product/B07D8ZVJN2) I have a bunch of these smart plugs that I use for various things where I want to monitor the power consumption and/or be able to completely turn off the power (because they have a significant standby power draw). The TOPGREENER units are cheap, can be flashed with [Tuya-Convert](https://github.com/ct-Open-Source/tuya-convert) (or they could last time I bought one), and have power monitoring. diff --git a/devices/basement-bathroom-light-fan.yaml b/devices/basement-bathroom-light-fan.yaml index 71df8f2..6cda377 100644 --- a/devices/basement-bathroom-light-fan.yaml +++ b/devices/basement-bathroom-light-fan.yaml @@ -15,8 +15,6 @@ external_components: type: local path: ../components components: [ binary_light_with_power ] - - source: github://cbpowell/ESPSense - components: [ espsense ] binary_sensor: - platform: gpio @@ -36,12 +34,6 @@ 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 @@ -76,6 +68,3 @@ sensor: name: Basement Bathroom Light power_id: light_power method: left - -time: - - platform: homeassistant diff --git a/devices/basement-bathroom-shower-light-heater.yaml b/devices/basement-bathroom-shower-light-heater.yaml index 4b19a7c..a091a64 100644 --- a/devices/basement-bathroom-shower-light-heater.yaml +++ b/devices/basement-bathroom-shower-light-heater.yaml @@ -15,8 +15,6 @@ external_components: type: local path: ../components components: [ binary_light_with_power, gpio_switch_with_power ] - - source: github://cbpowell/ESPSense - components: [ espsense ] binary_sensor: - platform: gpio @@ -36,15 +34,6 @@ binary_sensor: then: - switch.toggle: heater -espsense: - plugs: - - name: Basement Shower Light - power_sensor: light_power - voltage: 120 - - name: Basement Bathroom Heater - power_sensor: heat_power - voltage: 120 - light: - platform: binary_light_with_power id: the_light @@ -85,6 +74,3 @@ sensor: name: Basement Bathroom Heater power_id: heat_power method: left - -time: - - platform: homeassistant diff --git a/devices/emporia-vue2.yaml b/devices/emporia-vue2.yaml new file mode 100644 index 0000000..8d3ac37 --- /dev/null +++ b/devices/emporia-vue2.yaml @@ -0,0 +1,123 @@ +substitutions: + device_id: emporia-vue2 + device_name: Emporia Vue2 Power Monitor + board: esp32dev + ip_address: !secret emporia-vue2-ip + ota_pwd: !secret emporia-vue2-ota-pwd + api_pwd: !secret emporia-vue2-api-pwd + ap_wifi_pwd: !secret emporia-vue2-ap-pwd + +packages: + device_base: !include ../packages/device_base_esp32.yaml + +wifi: + power_save_mode: light + +external_components: + - source: github://flaviut/esphome@emporia-vue-2022.4.0 + components: [ emporia_vue ] + +i2c: + sda: 21 + scl: 22 + scan: false + frequency: 200kHz + id: i2c_a + +# these are called references in YAML. They allow you to reuse +# this configuration in each sensor, while only defining it once +.defaultfilters: + - &moving_avg + # we capture a new sample every 0.24 seconds, so the time can + # be calculated from the number of samples as n * 0.24. + sliding_window_moving_average: + # we average over the past 2.88 seconds + window_size: 12 + # we push a new value every 1.44 seconds + send_every: 6 + - &invert + # invert and filter out any values below 0. + lambda: 'return max(-x, 0.0f);' + - &pos + # filter out any values below 0. + lambda: 'return max(x, 0.0f);' + - &abs + # take the absolute value of the value + lambda: 'return abs(x);' + +sensor: + - platform: emporia_vue + i2c_id: i2c_a + phases: + - id: phase_a # Verify that this specific phase/leg is connected to correct input wire color on device listed below + input: BLACK # Vue device wire color + calibration: 0.022 # 0.022 is used as the default as starting point but may need adjusted to ensure accuracy + # To calculate new calibration value use the formula * / + voltage: + name: "Phase A Voltage" + filters: [*moving_avg, *pos] + - id: phase_b # Verify that this specific phase/leg is connected to correct input wire color on device listed below + input: RED # Vue device wire color + calibration: 0.022 # 0.022 is used as the default as starting point but may need adjusted to ensure accuracy + # To calculate new calibration value use the formula * / + voltage: + name: "Phase B Voltage" + filters: [*moving_avg, *pos] + ct_clamps: + - phase_id: phase_a + input: "A" # Verify the CT going to this device input also matches the phase/leg + power: + name: "Phase A Power" + id: phase_a_power + device_class: power + filters: [*moving_avg, *pos] + - phase_id: phase_b + input: "B" # Verify the CT going to this device input also matches the phase/leg + power: + name: "Phase B Power" + id: phase_b_power + device_class: power + filters: [*moving_avg, *pos] + # Pay close attention to set the phase_id for each breaker by matching it to the phase/leg it connects to in the panel + - { phase_id: phase_b, input: "1", power: { name: "Furnace Power", id: cir1, filters: [ *moving_avg, *pos ] } } + - { phase_id: phase_b, input: "2", power: { name: "Dryer Power", id: cir2, filters: [ *moving_avg, *pos, multiply: 2 ] } } + - { phase_id: phase_b, input: "3", power: { name: "Garage 1 Power", id: cir3, filters: [ *moving_avg, *pos ] } } + - { phase_id: phase_b, input: "4", power: { name: "Hot Water Heater Power", id: cir4, filters: [ *moving_avg, *pos, multiply: 2 ] } } + # - { phase_id: phase_a, input: "5", power: { name: "Circuit 5 Power", id: cir5, filters: [ *moving_avg, *pos ] } } + # - { phase_id: phase_a, input: "6", power: { name: "Circuit 6 Power", id: cir6, filters: [ *moving_avg, *pos ] } } + # - { phase_id: phase_a, input: "7", power: { name: "Circuit 7 Power", id: cir7, filters: [ *moving_avg, *pos ] } } + # - { phase_id: phase_b, input: "8", power: { name: "Circuit 8 Power", id: cir8, filters: [ *moving_avg, *pos ] } } + - { phase_id: phase_a, input: "9", power: { name: "Fire Pit/Fountain Power", id: cir9, filters: [ *moving_avg, *pos ] } } + - { phase_id: phase_a, input: "10", power: { name: "Pool Accessories Total Power", id: cir10, filters: [ *moving_avg, *pos ] } } + - { phase_id: phase_a, input: "11", power: { name: "Garage 2 Power", id: cir11, filters: [ *moving_avg, *pos ] } } + - { phase_id: phase_a, input: "12", power: { name: "Air Conditioner Power", id: cir12, filters: [ *moving_avg, *pos, multiply: 2 ] } } + - { phase_id: phase_a, input: "13", power: { name: "Dish Washer Power", id: cir13, filters: [ *moving_avg, *pos ] } } + - { phase_id: phase_b, input: "14", power: { name: "Garbage Disposal Power", id: cir14, filters: [ *moving_avg, *pos ] } } + - { phase_id: phase_b, input: "15", power: { name: "Kitchen 1 Power", id: cir15, filters: [ *moving_avg, *pos ] } } + - { phase_id: phase_a, input: "16", power: { name: "Kitchen 2 Power", id: cir16, filters: [ *moving_avg, *pos ] } } + - platform: template + name: "Total Power" + lambda: return id(phase_a_power).state + id(phase_b_power).state; + update_interval: 1s + id: total_power + unit_of_measurement: "W" + - platform: total_daily_energy + name: "Total Daily Energy" + power_id: total_power + accuracy_decimals: 0 + - { power_id: cir1, platform: total_daily_energy, accuracy_decimals: 0, name: "Furnace" } + - { power_id: cir2, platform: total_daily_energy, accuracy_decimals: 0, name: "Dryer" } + - { power_id: cir3, platform: total_daily_energy, accuracy_decimals: 0, name: "Garage 1" } + - { power_id: cir4, platform: total_daily_energy, accuracy_decimals: 0, name: "Hot Water Heater" } + # - { power_id: cir5, platform: total_daily_energy, accuracy_decimals: 0, name: "Circuit 5 Daily Energy" } + # - { power_id: cir6, platform: total_daily_energy, accuracy_decimals: 0, name: "Circuit 6 Daily Energy" } + # - { power_id: cir7, platform: total_daily_energy, accuracy_decimals: 0, name: "Circuit 7 Daily Energy" } + # - { power_id: cir8, platform: total_daily_energy, accuracy_decimals: 0, name: "Circuit 8 Daily Energy" } + - { power_id: cir9, platform: total_daily_energy, accuracy_decimals: 0, name: "Fire Pit/Fountain" } + - { power_id: cir10, platform: total_daily_energy, accuracy_decimals: 0, name: "Pool Accessories Total" } + - { power_id: cir11, platform: total_daily_energy, accuracy_decimals: 0, name: "Garage 2" } + - { power_id: cir12, platform: total_daily_energy, accuracy_decimals: 0, name: "Air Conditioner" } + - { power_id: cir13, platform: total_daily_energy, accuracy_decimals: 0, name: "Dish Washer" } + - { power_id: cir14, platform: total_daily_energy, accuracy_decimals: 0, name: "Garbage Disposal" } + - { power_id: cir15, platform: total_daily_energy, accuracy_decimals: 0, name: "Kitchen 1" } + - { power_id: cir16, platform: total_daily_energy, accuracy_decimals: 0, name: "Kitchen 2" } \ No newline at end of file diff --git a/devices/garage-fridge.yaml b/devices/garage-fridge.yaml index dfdebeb..5bf9f20 100644 --- a/devices/garage-fridge.yaml +++ b/devices/garage-fridge.yaml @@ -14,10 +14,6 @@ packages: wifi: power_save_mode: light -external_components: - - source: github://cbpowell/ESPSense - components: [ espsense ] - climate: - platform: pid name: Garage Fridge @@ -39,15 +35,8 @@ climate: esp32_ble_tracker: scan_parameters: - interval: 16ms - window: 16ms - -# espsense: -# plugs: -# - name: ${device_name} -# power_sensor: garage_fridge_power -# current_sensor: garage_fridge_current -# voltage_sensor: garage_fridge_voltage + interval: 1100ms + window: 1100ms modbus: diff --git a/devices/patio-lights.yaml b/devices/patio-lights.yaml index adfd9d9..b18c905 100644 --- a/devices/patio-lights.yaml +++ b/devices/patio-lights.yaml @@ -15,14 +15,6 @@ external_components: type: local path: ../components components: [ binary_light_with_power ] - - source: github://cbpowell/ESPSense - components: [ espsense ] - -espsense: - plugs: - - name: ${device_name} - power_sensor: power - voltage: 120 light: - platform: binary_light_with_power @@ -43,6 +35,3 @@ sensor: name: ${device_name} power_id: power method: left - -time: - - platform: homeassistant diff --git a/devices/pool-and-patio-lights.yaml b/devices/pool-and-patio-lights.yaml index b8dfca1..424b97d 100644 --- a/devices/pool-and-patio-lights.yaml +++ b/devices/pool-and-patio-lights.yaml @@ -15,8 +15,6 @@ external_components: type: local path: ../components components: [ treo_led_pool_light, binary_light_with_power ] - - source: github://cbpowell/ESPSense - components: [ espsense ] binary_sensor: - platform: gpio @@ -57,12 +55,6 @@ binary_sensor: then: - switch.turn_off: patio_lights_indicator -espsense: - plugs: - - name: Pool Lights - power_sensor: pool_light_power - voltage: 120 - light: - platform: treo_led_pool_light id: pool_lights @@ -89,6 +81,3 @@ switch: - platform: gpio id: patio_lights_indicator pin: 13 - -time: - - platform: homeassistant diff --git a/devices/pool-pumps.yaml b/devices/pool-pumps.yaml index 6489b76..85b4f3a 100644 --- a/devices/pool-pumps.yaml +++ b/devices/pool-pumps.yaml @@ -15,19 +15,6 @@ external_components: type: local path: ../components components: [ pool_controller ] - - 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 @@ -127,7 +114,3 @@ switch: id: pool_cleaner icon: mdi:robot-vacuum restore_mode: Always Off - -time: - - platform: homeassistant - id: the_time diff --git a/packages/device_base.yaml b/packages/device_base.yaml index baae8fb..a7a2aff 100644 --- a/packages/device_base.yaml +++ b/packages/device_base.yaml @@ -28,4 +28,5 @@ packages: restart_button: !include button/restart.yaml version_sensor: !include text_sensor/version.yaml wifi_info_sensor: !include text_sensor/wifi_info.yaml + time: !include time/time.yaml diff --git a/packages/feit_dimmer.yaml b/packages/feit_dimmer.yaml index d3c5c9d..689e2e4 100644 --- a/packages/feit_dimmer.yaml +++ b/packages/feit_dimmer.yaml @@ -6,19 +6,11 @@ external_components: type: local path: ../components components: [ tuya_light_plus ] - - source: github://cbpowell/ESPSense - components: [ espsense ] packages: base: !include device_base_esp8266.yaml uart: !include uart/tuya.yaml -espsense: - plugs: - - name: ${device_name} - power_sensor: power - voltage: 120 - sensor: - platform: total_daily_energy name: ${device_name} @@ -26,7 +18,4 @@ sensor: power_id: power method: left -time: - - platform: homeassistant - tuya: diff --git a/packages/feit_dimmer_as_fan.yaml b/packages/feit_dimmer_as_fan.yaml index 0766de6..fde44b5 100644 --- a/packages/feit_dimmer_as_fan.yaml +++ b/packages/feit_dimmer_as_fan.yaml @@ -7,19 +7,11 @@ external_components: type: local path: ../components components: [ tuya_dimmer_as_fan ] - - source: github://cbpowell/ESPSense - components: [ espsense ] packages: base: !include device_base_esp8266.yaml uart: !include uart/tuya.yaml -espsense: - plugs: - - name: ${device_name} - power_sensor: power - voltage: 120 - fan: - platform: tuya_dimmer_as_fan id: tuya_fan @@ -38,7 +30,4 @@ sensor: power_id: power method: left -time: - - platform: homeassistant - tuya: diff --git a/packages/shelly_1l.yaml b/packages/shelly_1l.yaml index 23d1283..2116d6e 100644 --- a/packages/shelly_1l.yaml +++ b/packages/shelly_1l.yaml @@ -7,8 +7,6 @@ external_components: type: local path: ../components components: [ binary_light_with_power ] - - source: github://cbpowell/ESPSense - components: [ espsense ] packages: base: !include device_base_esp8266.yaml @@ -34,12 +32,6 @@ binary_sensor: 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 @@ -63,6 +55,3 @@ sensor: status_led: pin: GPIO0 - -time: - - platform: homeassistant diff --git a/packages/time/time.yaml b/packages/time/time.yaml new file mode 100644 index 0000000..cde8aac --- /dev/null +++ b/packages/time/time.yaml @@ -0,0 +1,5 @@ +substitutions: + time_platform: homeassistant + +time: + - platform: ${time_platform} diff --git a/packages/topgreener_smart_plug.yaml b/packages/topgreener_smart_plug.yaml index 69b84f3..3c59db5 100644 --- a/packages/topgreener_smart_plug.yaml +++ b/packages/topgreener_smart_plug.yaml @@ -4,10 +4,6 @@ substitutions: restore_mode: ALWAYS_ON log_baud_rate: '0' -external_components: - - source: github://cbpowell/ESPSense - components: [ espsense ] - packages: base: !include device_base_esp8266.yaml @@ -20,12 +16,6 @@ binary_sensor: on_press: then: - switch.toggle: relay - -espsense: - plugs: - - name: ${device_name} - power_sensor: power - voltage: 120 sensor: - platform: hlw8012 @@ -64,6 +54,3 @@ switch: id: relay pin: GPIO14 restore_mode: ${restore_mode} - -time: - - platform: homeassistant diff --git a/packages/topgreener_smart_plug_as_fan.yaml b/packages/topgreener_smart_plug_as_fan.yaml index d774af0..34fac98 100644 --- a/packages/topgreener_smart_plug_as_fan.yaml +++ b/packages/topgreener_smart_plug_as_fan.yaml @@ -4,10 +4,6 @@ substitutions: restore_mode: ALWAYS_ON log_baud_rate: '0' -external_components: - - source: github://cbpowell/ESPSense - components: [ espsense ] - packages: base: !include device_base_esp8266.yaml @@ -21,12 +17,6 @@ binary_sensor: then: - switch.toggle: relay -espsense: - plugs: - - name: ${device_name} - power_sensor: power - voltage: 120 - fan: - platform: binary name: ${device_name} @@ -66,6 +56,3 @@ status_led: pin: number: GPIO13 inverted: False - -time: - - platform: homeassistant