|
@@ -71,23 +71,23 @@ sensor:
|
|
|
sel_pin: # I believe that cf_pin reports either Voltage or Current depending on this select pin
|
|
sel_pin: # I believe that cf_pin reports either Voltage or Current depending on this select pin
|
|
|
inverted: true # determine whether true reports Voltage
|
|
inverted: true # determine whether true reports Voltage
|
|
|
number: P11
|
|
number: P11
|
|
|
- cf_pin: # current or voltage (ele_pin: 7)
|
|
|
|
|
- # inverted: true # the logic of BL0937 is opposite from HLW8012
|
|
|
|
|
|
|
+ cf1_pin:
|
|
|
|
|
+ inverted: true
|
|
|
number: P24
|
|
number: P24
|
|
|
- cf1_pin: # Power (vi_pin: 8)
|
|
|
|
|
- # inverted: true # the logic of BL0937 is opposite from HLW8012
|
|
|
|
|
|
|
+ cf_pin:
|
|
|
|
|
+ inverted: true
|
|
|
number: P26
|
|
number: P26
|
|
|
- update_interval: $update_interval_seconds
|
|
|
|
|
-
|
|
|
|
|
- # PC191HA measures and returns Voltage OR Current according to the value of sel_pin,
|
|
|
|
|
- # but it can change the value of sel_pin periodically
|
|
|
|
|
- initial_mode: "VOLTAGE"
|
|
|
|
|
- change_mode_every: "5"
|
|
|
|
|
|
|
+ update_interval: 5s
|
|
|
|
|
+ change_mode_every: 4
|
|
|
|
|
+ # update_interval: 5s
|
|
|
|
|
+ # initial_mode: "VOLTAGE"
|
|
|
|
|
+ # change_mode_every: 4294967295
|
|
|
# Adjust according to the actual resistor values on board to calibrate the specific unit
|
|
# Adjust according to the actual resistor values on board to calibrate the specific unit
|
|
|
- voltage_divider: "895" # LOWER VALUE GIVES LOWER VOLTAGE
|
|
|
|
|
- current_resistor: "0.0006" # HIGHER VALUE GIVES LOWER WATTAGE
|
|
|
|
|
-
|
|
|
|
|
-# how the power monitoring values are returned to ESPHome
|
|
|
|
|
|
|
+ # voltage_divider: "895" # LOWER VALUE GIVES LOWER VOLTAE
|
|
|
|
|
+ # current_resistor: "0.0006" # HIGHER VALUE GIVES LOWER WATTAGE
|
|
|
|
|
+ voltage_divider: "795"
|
|
|
|
|
+ current_resistor: "0.001"
|
|
|
|
|
+ # how the power monitoring values are returned to ESPHome
|
|
|
voltage:
|
|
voltage:
|
|
|
name: $friendly_devicename Voltage
|
|
name: $friendly_devicename Voltage
|
|
|
id: ${low_devicename}_voltage
|
|
id: ${low_devicename}_voltage
|
|
@@ -95,21 +95,36 @@ sensor:
|
|
|
accuracy_decimals: 1
|
|
accuracy_decimals: 1
|
|
|
filters:
|
|
filters:
|
|
|
- skip_initial: 2
|
|
- skip_initial: 2
|
|
|
|
|
+ - sliding_window_moving_average:
|
|
|
|
|
+ window_size: 4
|
|
|
|
|
+ send_every: 2
|
|
|
|
|
+ on_value:
|
|
|
|
|
+ component.update: ${low_devicename}_apparent_power
|
|
|
power:
|
|
power:
|
|
|
name: $friendly_devicename Power
|
|
name: $friendly_devicename Power
|
|
|
id: ${low_devicename}_power
|
|
id: ${low_devicename}_power
|
|
|
unit_of_measurement: W
|
|
unit_of_measurement: W
|
|
|
- accuracy_decimals: 2
|
|
|
|
|
|
|
+ accuracy_decimals: 0
|
|
|
|
|
+ on_value:
|
|
|
|
|
+ component.update: ${low_devicename}_power_factor
|
|
|
filters:
|
|
filters:
|
|
|
|
|
+ # - skip_initial: 15
|
|
|
- skip_initial: 2
|
|
- skip_initial: 2
|
|
|
|
|
+ - sliding_window_moving_average:
|
|
|
|
|
+ window_size: 4
|
|
|
|
|
+ send_every: 2
|
|
|
current:
|
|
current:
|
|
|
name: $friendly_devicename Current
|
|
name: $friendly_devicename Current
|
|
|
id: ${low_devicename}_current
|
|
id: ${low_devicename}_current
|
|
|
unit_of_measurement: A
|
|
unit_of_measurement: A
|
|
|
- accuracy_decimals: 2
|
|
|
|
|
|
|
+ accuracy_decimals: 3
|
|
|
filters:
|
|
filters:
|
|
|
- - multiply: 0.18
|
|
|
|
|
|
|
+ # - multiply: 1
|
|
|
|
|
+ - multiply: 0.450
|
|
|
- skip_initial: 2
|
|
- skip_initial: 2
|
|
|
|
|
+ - sliding_window_moving_average:
|
|
|
|
|
+ window_size: 4
|
|
|
|
|
+ send_every: 2
|
|
|
|
|
|
|
|
# power is simply current x voltage -- except that the pc191ha doesn't follow that formula.
|
|
# power is simply current x voltage -- except that the pc191ha doesn't follow that formula.
|
|
|
# Setting current_resistor to give an accurate Amperage does NOT also give the correct Wattage
|
|
# Setting current_resistor to give an accurate Amperage does NOT also give the correct Wattage
|
|
@@ -124,6 +139,37 @@ sensor:
|
|
|
# return (id(${low_devicename}_power).state / id(${low_devicename}_voltage).state);
|
|
# return (id(${low_devicename}_power).state / id(${low_devicename}_voltage).state);
|
|
|
# filters:
|
|
# filters:
|
|
|
# - skip_initial: 5 # give time for data to settle to avoid NaN
|
|
# - skip_initial: 5 # give time for data to settle to avoid NaN
|
|
|
|
|
+ - platform: total_daily_energy
|
|
|
|
|
+ name: $friendly_devicename daily consumption
|
|
|
|
|
+ id: ${low_devicename}_total_daily_energy
|
|
|
|
|
+ power_id: ${low_devicename}_apparent_power
|
|
|
|
|
+ filters:
|
|
|
|
|
+ - multiply: 0.001 # to kWh
|
|
|
|
|
+ unit_of_measurement: kWh
|
|
|
|
|
+ - platform: template
|
|
|
|
|
+ name: "Apparent power"
|
|
|
|
|
+ id: ${low_devicename}_apparent_power
|
|
|
|
|
+ unit_of_measurement: VA
|
|
|
|
|
+ device_class: apparent_power
|
|
|
|
|
+ lambda: |-
|
|
|
|
|
+ return id(${low_devicename}_voltage).state * id(${low_devicename}_current).state;
|
|
|
|
|
+ update_interval: never
|
|
|
|
|
+ on_value:
|
|
|
|
|
+ component.update: ${low_devicename}_power_factor
|
|
|
|
|
+ - platform: template
|
|
|
|
|
+ name: "Power factor"
|
|
|
|
|
+ id: ${low_devicename}_power_factor
|
|
|
|
|
+ unit_of_measurement: ''
|
|
|
|
|
+ device_class: power_factor
|
|
|
|
|
+ lambda: |-
|
|
|
|
|
+ return id(${low_devicename}_power).state / id(${low_devicename}_apparent_power).state;
|
|
|
|
|
+ filters:
|
|
|
|
|
+ - clamp:
|
|
|
|
|
+ min_value: 0
|
|
|
|
|
+ max_value: 1
|
|
|
|
|
+ update_interval: never
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
text_sensor:
|
|
text_sensor:
|
|
|
- platform: template
|
|
- platform: template
|
|
@@ -143,10 +189,8 @@ light:
|
|
|
pin:
|
|
pin:
|
|
|
number: P8
|
|
number: P8
|
|
|
inverted: true
|
|
inverted: true
|
|
|
- - platform: status_led
|
|
|
|
|
- name: "netled"
|
|
|
|
|
- internal: true
|
|
|
|
|
- id: netled
|
|
|
|
|
|
|
+
|
|
|
|
|
+status_led:
|
|
|
pin:
|
|
pin:
|
|
|
number: P10
|
|
number: P10
|
|
|
inverted: true
|
|
inverted: true
|
|
@@ -183,6 +227,12 @@ switch:
|
|
|
- light.turn_on: led
|
|
- light.turn_on: led
|
|
|
on_turn_off:
|
|
on_turn_off:
|
|
|
- light.turn_off: led
|
|
- light.turn_off: led
|
|
|
|
|
+ restore_mode: RESTORE_DEFAULT_OFF
|
|
|
# Switch to restart the plug
|
|
# Switch to restart the plug
|
|
|
- platform: restart
|
|
- platform: restart
|
|
|
name: ${friendly_devicename} Restart Switch
|
|
name: ${friendly_devicename} Restart Switch
|
|
|
|
|
+
|
|
|
|
|
+# Enable time component to reset energy at midnight
|
|
|
|
|
+time:
|
|
|
|
|
+ - platform: homeassistant
|
|
|
|
|
+ id: homeassistant_time
|