esphome sntp offline fixes
This commit is contained in:
127
esphome/common/athompowermonv3_common.yaml
Normal file
127
esphome/common/athompowermonv3_common.yaml
Normal file
@@ -0,0 +1,127 @@
|
||||
##########################################################################################
|
||||
# GLOBAL VARIABLES
|
||||
# https://esphome.io/guides/automations.html?highlight=globals#global-variables
|
||||
##########################################################################################
|
||||
globals:
|
||||
####################################################
|
||||
# total_energy: cumulative power
|
||||
# Not restored, so each boot starts fresh at 0.
|
||||
####################################################
|
||||
- id: total_energy
|
||||
type: float
|
||||
restore_value: yes
|
||||
initial_value: '0.0'
|
||||
|
||||
##########################################################################################
|
||||
# GENERAL COMMON SENSORS
|
||||
# https://esphome.io/components/sensor/
|
||||
##########################################################################################
|
||||
sensor:
|
||||
#############################################
|
||||
# CSE7766 POWER SENSOR
|
||||
# https://esphome.io/components/sensor/cse7766.html
|
||||
#############################################
|
||||
- platform: cse7766
|
||||
id: athom_cse7766
|
||||
current:
|
||||
name: "Current"
|
||||
icon: mdi:current-ac
|
||||
filters:
|
||||
- throttle_average: "10s"
|
||||
- lambda: if (x < 0.060) return 0.0; else return x; #For the chip will report less than 3w power when no load is connected
|
||||
on_value_range:
|
||||
- above: "${local_current_limit}"
|
||||
then:
|
||||
- switch.turn_off: relay
|
||||
voltage:
|
||||
name: "Voltage"
|
||||
icon: mdi:sine-wave
|
||||
filters:
|
||||
- throttle_average: "10s"
|
||||
power:
|
||||
name: "Power"
|
||||
id: power_sensor
|
||||
icon: mdi:power
|
||||
filters:
|
||||
- throttle_average: "10s"
|
||||
- lambda: if (x < 3.0) return 0.0; else return x; #For the chip will report less than 3w power when no load is connected
|
||||
energy:
|
||||
name: "Energy"
|
||||
id: energy
|
||||
icon: mdi:lightning-bolt
|
||||
unit_of_measurement: kWh
|
||||
filters:
|
||||
- throttle: "10s"
|
||||
# Multiplication factor from W to kW is 0.001
|
||||
- multiply: 0.001
|
||||
on_value:
|
||||
then:
|
||||
- lambda: |-
|
||||
static float previous_energy_value = 0.0;
|
||||
float current_energy_value = id(energy).state;
|
||||
id(total_energy) += current_energy_value - previous_energy_value;
|
||||
previous_energy_value = current_energy_value;
|
||||
id(total_energy_sensor).update();
|
||||
apparent_power:
|
||||
name: "Apparent Power"
|
||||
icon: mdi:power
|
||||
filters:
|
||||
- throttle_average: "10s"
|
||||
reactive_power:
|
||||
name: "Reactive Power"
|
||||
icon: mdi:flash
|
||||
filters:
|
||||
- throttle_average: "10s"
|
||||
power_factor:
|
||||
name: "Power Factor"
|
||||
icon: mdi:percent-outline
|
||||
filters:
|
||||
- throttle_average: "10s"
|
||||
|
||||
#############################################
|
||||
# Total Energy (All Time)
|
||||
#############################################
|
||||
- platform: template
|
||||
name: "Total Energy"
|
||||
id: total_energy_sensor
|
||||
unit_of_measurement: kWh
|
||||
device_class: "energy"
|
||||
state_class: "total_increasing"
|
||||
icon: mdi:lightning-bolt
|
||||
accuracy_decimals: 3
|
||||
lambda: |-
|
||||
return id(total_energy);
|
||||
update_interval: "60s"
|
||||
|
||||
#############################################
|
||||
# Total Daily Energy
|
||||
# https://esphome.io/components/sensor/total_daily_energy.html
|
||||
#############################################
|
||||
- platform: total_daily_energy
|
||||
name: "Total Daily Energy"
|
||||
restore: true
|
||||
power_id: power_sensor
|
||||
unit_of_measurement: kWh
|
||||
icon: mdi:hours-24
|
||||
accuracy_decimals: 3
|
||||
filters:
|
||||
- multiply: 0.001
|
||||
##########################################################################################
|
||||
# STATUS LED
|
||||
# https://esphome.io/components/status_led.html
|
||||
##########################################################################################
|
||||
status_led:
|
||||
pin:
|
||||
number: GPIO06
|
||||
inverted: False
|
||||
|
||||
##########################################################################################
|
||||
# UART Bus
|
||||
# https://esphome.io/components/uart.html
|
||||
##########################################################################################
|
||||
uart:
|
||||
rx_pin: GPIO20
|
||||
baud_rate: 4800
|
||||
data_bits: 8
|
||||
stop_bits: 1
|
||||
parity: EVEN
|
Reference in New Issue
Block a user