Wifi Signal strengh sensor

A working command for HAOS on RPi (in terminal, ssh), if someone still finds it useful.
RPi4, HAOS 9.5, Core 2023.4.4

ha network info | grep signal | cut -d":" -f2

result without the leading space:

ha net info | grep signal | cut -d":" -f2 | awk ‘{ gsub (" ", “”, $0); print}’

Unfortunately I could not make it work as a command line sensor.

Here we go again, the log shows:

ValueError: Sensor sensor.rpi_wifi_signal has device class 'signal_strength', state class 'None' unit 'dBm' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '' (<class 'str'>)

The configured sensor:

command_line:
  - sensor:
      name: RPi WiFi Signal
      unique_id: rpi_wifi_signal
      command: 'ha net info | grep signal | cut -d":" -f2 | awk ''{ gsub (" ", "", $0); print}'''
      device_class: signal_strength
      unit_of_measurement: "dBm"
      value_template: '{{ value | float(0) if is_number(value) }}'

From the Terminal & SSH addon:

Good evening
For technical reasons I had to move my raspberry pi to the basement without LAN access.
Thanks to wifi, I can still operate the station. Unfortunately, I can’t figure out how to display the signal strength on hassio.
The instructions above all seem to generate errors for me.
I hope someone can briefly explain how I can display the signal as an entity.

Thanks in advance for your support

I like this solution, however it does not work if HA is running inside a container. If you bind-mount the host /proc into the container /host/proc, the resulting cat /host/proc/net/wireless will return only the field names but no data. So the /proc interface does not seem to like that it’s being invoked from within a container, or maybe it gets confused and tries to return data specific to the container?

Anyone with deep understanding of containers care to comment?