Od kilku godzin walczę z kalibracją tego gniazdka po wgraniu esphome.
Za każdym razem daje nieprawidłowe odczyty. Jedynie z czym sobie poradziłem to z Voltage. Jest już w miarę dokładny.
Niestety W i A niekiedy po wyłączeniu urządzenia dają odczyty nawet na minusie.
Mój config:
esphome:
name: skuter
platform: esp8266
board: esp01_1m
esp8266_restore_from_flash: true
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "key"
ota:
password: "passw"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# use_address: 192.168.254.15
# Optional manual IP
manual_ip:
static_ip: 192.168.254.19
gateway: 192.168.254.254
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Skuter Fallback Hotspot"
password: "pass"
time:
- platform: homeassistant
id: homeassistant_time
timezone: Europe/Warsaw
substitutions:
plug_name: skuter
# Higher value gives lower watt readout
current_res: "0.0012"
# Lower value gives lower voltage readout
voltage_div: "771"
# Enable Web server
web_server:
port: 80
sensor:
- platform: wifi_signal
name: "${plug_name} - WiFi Signal"
update_interval: 60s
- platform: uptime
name: "${plug_name} - Uptime"
icon: mdi:clock-outline
update_interval: 60s
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: True
cf_pin: GPIO05
cf1_pin: GPIO04
current_resistor: ${current_res}
voltage_divider: ${voltage_div}
current:
name: "${plug_name} - Ampere"
unit_of_measurement: A
accuracy_decimals: 3
icon: mdi:flash-outline
filters:
# Map from sensor -> measured value
- calibrate_linear:
- 0.25416 -> 0
- 0.17338 -> 0
- 0.43453 -> 0.4167
- 0.43856 -> 0.4267
- -0.61162 -> 0.000
voltage:
name: "${plug_name} - Volt"
unit_of_measurement: V
accuracy_decimals: 1
icon: mdi:flash-outline
filters:
# Map from sensor -> measured value
- calibrate_linear:
- 242.96107 -> 239
- 239.74483 -> 236
power:
name: "${plug_name} - Watt"
unit_of_measurement: W
id: "${plug_name}_Wattage"
icon: mdi:flash-outline
accuracy_decimals: 0
filters:
# Map from sensor -> measured value
- calibrate_linear:
- -51.42855 -> 0.000
- 18.58305 -> 0.000
- 8.94716 -> 0.000
- 5.31689 -> 0.000
- 3.58723 -> 0
- 2.62106 -> 0
- 91.60732 -> 100
- 166.78029 -> 75
- 199.75945 -> 100
change_mode_every: 4
update_interval: 3s
- platform: total_daily_energy
name: "${plug_name} - Consumption"
power_id: "${plug_name}_Wattage"
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
unit_of_measurement: kWh
icon: mdi:clock-alert
text_sensor:
- platform: version
name: "${plug_name} - ESPHome Version"
- platform: wifi_info
ip_address:
name: skuter IP Address
ssid:
name: skuter Connected SSID
bssid:
name: skuter Connected BSSID
mac_address:
name: skuter Mac Wifi Address
scan_results:
name: skuter Latest Scan Results
binary_sensor:
# Binary sensor for the button press
- platform: gpio
name: Physical Button Sensor
pin:
number: GPIO13
inverted: true
on_press:
- switch.toggle: relay
switch:
# Switch to toggle the relay
- platform: gpio
id: relay
name: skuter
pin: GPIO15
on_turn_on:
- light.turn_on: led
on_turn_off:
- light.turn_off: led
output:
# Relay state led
- platform: esp8266_pwm
id: state_led
pin:
number: GPIO00
inverted: true
light:
# Relay state light
- platform: monochromatic
output: state_led
id: led
# Uses the red LED as a ESPhome status indicator
status_led:
pin:
number: GPIO2
inverted: true
captive_portal: