[Solved] Girier 16A power monitoring

Update

Well… I’m an idiot. I decided to go back to Tasmota to see if that was still working. I had no voltage reading there either. So I figured: alright, maybe because some pins weren’t set right I fried the power metering chip, no biggy, I’ll try another device. There everything worked fine.

[Insert spongebob meme about an enternity later here]

I realized that I had one of these that didn’t have functioning power metering out of the box. That was the one I was trying to work with. I feel like an idiot.


I converted my 16 Girier smart sockets over from Tasmota to ESPHome without thinking. They were the only smart sockets with power monitoring, so I didn’t even think about PM.

Months later, I noticed it, so I’m trying to implement it, but I can’t get it to work, mostly because I can’t find a lot of info about the device. I get a voltage reading of about 76V, current and power are at 0, regardless of the connected load.

My attempt at the config (basically just taken from here and slightly modified):

sensor:
  # Reports the Current, Voltage, and Power used by the plugged-in device (not counting this plug's own usage of about 0.8W/0.019A, so subtract those when calibrating with this plugged into a Kill-A-Watt type meter)
  - platform: hlw8012
    model: BL0937
    sel_pin:
      number: GPIO3
      inverted: true
    cf_pin: GPIO4
    cf1_pin: GPIO5
    current_resistor: 0.001 #The value of the shunt resistor for current measurement. Defaults to the Sonoff POW’s value 0.001 ohm. Verified on https://fccid.io/2ANOO-SM800/Internal-Photos/Internal-Photos-3601477 that we use "R001" = 0.001 ohm
    voltage_divider: 2401 #The value of the voltage divider on the board as (R_upstream + R_downstream) / R_downstream. Defaults to the Sonoff POW’s value 2351. From the pic we use 2x "125" = 2x 1.2Mohm for R_upstream and "102" = 1kohm for R_downstream, so (1,200,000+1,200,000+1,000)/1,000 = 2401
    # but those don't fix the measurement values, probably because we actually have a BL0937 chip instead of a HLW8012, (and part variance aswell) so we have to manually calibrate with a known load or a load and a Kill-A-Watt type meter. My values used below will only be +/-10% of yours I think.
    power:
      name: ${friendlyName} Power
      unit_of_measurement: W
      id: wattage
      filters:
        - calibrate_linear:
            # Map 0.0 (from sensor) to 0.0 (true value)
            - 0.0 -> 0.0 #Need to keep 0 mapped to 0 for when connected device is not drawing any power
            - 4054.3 -> 721.2 #Tested using a meter and 722.0W toaster -0.8W from just this plug with toaster off
    current:
      name: ${friendlyName} Current
      unit_of_measurement: A
      filters:
        - calibrate_linear:
            # Map 0.0 (from sensor) to 0.0 (true value)
            - 0.0 -> 0.0 #Need to keep 0 mapped to 0 for when connected device is not drawing any power
            - 7.4 -> 6.103 #Tested using a meter and 6.122A toaster -0.019A from just this plug with toaster off
    voltage:
      name: ${friendlyName} Voltage
      unit_of_measurement: V
      filters:
        - calibrate_linear:
            # Map 0.0 (from sensor) to 0.0 (true value)
            #- 0.0 -> 0.0 #Don't care if 0 reading aligns with 0 real Volts since we won't ever measure that
            - 294.7 -> 117.8 #Tested using a meter, value while connected toaster was on
            - 321.7 -> 121.6 #value while connected toaster was off
    change_mode_every: 1 #Skips first reading after each change, so this will double the update interval. Default 8
    update_interval: 10s #20 second effective update rate for Power, 40 second for Current and Voltage. Default 60s

Things I’m unsure about, and just left like I found them in the example:

  • current_resistor: No idea what this value is for the device
  • voltage_divider: Again, no idea

The GPIO pins should be correct, based on this.

Calibration I’m not worried about yet, I need values to appear first.

The Girier 16A plug seems to be very uncommon, I can hardly find anything about it, especially combined with ESPHome. Any help would be greatly appreciated.

I suppose you could go back to tasmota?

Could, but don’t really want to. Since I use 4 different APs - not mesh, just regular APs - and still have some deadspots, the plugs on Tasmota tended to simply become unavailable and never return until I went to manually unplug and replug them. ESPHome has this setting to reboot if the device has been offline for 15 minutes. Worth its weight in gold to me.

I’m sure somebody either has a working config, or knows how to get this one working, it’s just a matter of finding that person.