athom-tech / athom-configs

Athom Technology Official Center
MIT License
192 stars 127 forks source link

Update athom-smart-plug.yaml #4

Closed ianchi closed 2 months ago

ianchi commented 2 years ago

It seems that the actual chip used en PG03 is not HLW8012 but BL0937. I haven't open the plug, but it is apparent from the readings. In that case, using the new model option, the multipliers are correctly computed and no linear filter is needed. This way all measures are correct, while the current implementation shows an incorrect energy if it is used directly (instead of the integration). I calculated the voltage multiplier empirically. You could provide the actual resistors value.

AlexCPU commented 2 years ago

I'm using a PG04 (UK Plug), and testing with a 1kVA AC source and a Yokogawa WT310E (power meter) and this seems to work for me, except the voltage is way off (which it also is in the original code).

Hence I was just about to raise a different PR to add a linear filter to the voltage, and the same filter seems to work for me both with and without your changes. Can you try it out on your PG03?

          - calibrate_linear:
            - 89.4 -> 80.0
            - 100.7 -> 90.0
            - 111.8 -> 100.0
            - 123.0 -> 110.0
            - 134.2 -> 120.0
            - 145.4 -> 130.0
            - 235.4 -> 210.0
            - 246.5 -> 220.0
            - 258.2 -> 230.0
            - 269.0 -> 240.0
            - 277.5 -> 250.0
ianchi commented 2 years ago

Hi @AlexCPU, have you tried adjusting the voltage_divider parameter instead of applying a filter? With your numbers, it seems that you could try with 1550 and check how it affects power (it will decrease in the same proportion). When you tested against the reference, only voltage was off? Current and power where correct?

In my case your filter would shield too low a voltage.

AlexCPU commented 2 years ago

Thanks, that's improved it, nice update :)

adamlc commented 2 years ago

1550 seems to give me better results. My voltage was showing about 269V with the default config which is WAY off!

saviothecnic commented 9 months ago

Sorry, I'm not very expert But I can no longer update ESPHome, it gives me a space error How can I solve it?

image

My yaml

`substitutions: name: presa-235-athom-smart-plug-v2 friendly_name: Presa 235 Athon V2 packages: Athom_Technology.Smart_Plug_V2: github://athom-tech/athom-configs/athom-smart-plug-v2.yaml esphome: name: ${name} name_add_mac_suffix: false friendly_name: ${friendly_name} api: encryption: key: Bch2rF8jfi9HtSJc5bolF8xv+Qpcj8nNJ0ZGnIpH7s=

wifi: ssid: !secret wifi_ssid password: !secret wifi_password

# Optional manual IP

manual_ip: static_ip: 192.168.1.235 gateway: 192.168.1.254 subnet: 255.255.255.0

mqtt: broker: !secret mqtt_host port: !secret mqtt_port username: !secret mqtt_username password: !secret mqtt_password id: mqtt_client`