ESPHOME devices wifi signal strength - how calculated? Varies by software?

I wrote a tiny script and have included it in my installs where if the signal is, over a long period, below -80dBm, the device reboots to hunt for a new wifi access point. This was to solve problems when an AP was briefly down, that a device would get “stuck” on a poor choice and not roam.

If there’s a better way would love to know but …

I have two devices that have very low signal strength as shown on the device, and it doesn’t make physical sense. As an example, one is a ratgdo device on a garage door. It is about 15’ from an AP running at full power, though through a brick wall. It runs about -85dBm.

On the same rough line from the AP but over twice as far away, AND in a metal box (plastic cover) is an esphome device that is -73dBm. It’s a top greener wall switch. There are many such examples.

I think they are both 8266’s (I bought both already built, I just wired them). I am wondering what could have such large impact on signal. Here is how they self report:

Poor signal:

2024.5.5|Flash: 1024kB Speed:40MHz Mode:DOUT|
Chip: 0x00ea39ed|
SDK: 2.2.2-dev(38a443e)|
Core: 3.1.2|
Boot: 7|
Mode: 1|
CPU: 80|
Flash: 0x001640ef|

Strong signal much further away:

2024.5.5|Flash: 1024kB Speed:40MHz Mode:DOUT|
Chip: 0x00a627f8|
SDK: 2.2.2-dev(38a443e)|
Core: 3.1.2|
Boot: 31|
Mode: 1|
CPU: 80|
Flash: 0x001540c8|

As mentioned, the one with strong signal is much further, same height, in a metal box.

For the weak signal I have it in a plastic box, I moved that box away from all wiring and have it hanging in free air in direct line with the AP (except that brick wall). Both are pretty close to the same line from the AP, a few degrees difference but should be about the same amount of attenuating materials.

Similar devices in a second garage, different AP (closer). The same ratgdo is -71dBm but a shelly 1+ is at -57 and is literally about 18" apart. That’s a huge difference in strength and Shelly’s are not known for good wifi signals.

Are these esphome devices estimating signal based on wifi connection speed, or some such?

Are some just that much worse?

I admit the most likely thing is some physical issue, antenna position and intervening construction.

But some of these seem so extreme I am just wondering if there is more I should be checking, some software tuning or change?

Linwood

norm3D1p5
The murky world of antennas. Farfield patterns. Orientation of antenna, interference. There are many factors that will influence transmission and reception.
An esp with external antenna may solve your problem.

Yeah, the ones that tend to be an issue are commercial ones. One is naked (not boxed) but I am not sure there is any simple way to install an antenna. I could try to reproduce the ratgdo, it’s well documented, but the in-wall switches not so much.

I get that there are almost an infinite number of variables in any physical install. My question really is whether I should believe the signal level indication reported from the software. At -85dBm it should be a pretty poor connection, but I have had no issues with these devices.

With some devices (like floodlights) at that level they started to act flakey, which is why I put this check in.

I can simply remove the test in these devices and let ignorance be bliss I guess.

The measurement of dBm should be standard acoss all devices. Your devices may be dropping a lot of packets but amount of data may be so low that it needs to send it can send them again very quickly. Might be different if you were sending VOIP.

I guess it’s possible, not sure how to get its measurements of retransmissions, though I suspect I could.

I do ping it every 60s with 10 pings and record any failures. The last 24 hours for example, had 2 losses for further device (stronger signal) and one ping loss for the closer (weaker) signal. Nothing significant there, 1 or 2 dropped icmp packets out of 14,400.

But anyway… your first sentence I think answers the core of my question. Thank you.

I use “percent” sensor. I found this formula somewhere on this forum…
If i remember correctly it shows 100% above -50dBm and 0% below -100dBm. I guess it’s less accurate, but more friendly than dBm, and it does the job.

 - platform: wifi_signal # internal: wifi signal in dBm, needed for second sensor below
    id: ${device_name}_wifi
    update_interval: 60s
    internal: true

  - platform: copy # wifi signal in %
    source_id: ${device_name}_wifi
    name: ${friendly_name} WiFi
    filters:
      - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
    unit_of_measurement: "%"
    entity_category: "diagnostic"
    device_class: ""

I’m happy with dBm. It’s a rather fundamental difference to linearize it, bear in mind 3dbm is double the power, so going from 50 to 60dBm might 20% in your case, but is really about 9-10 times the power.