ironsheep / RPi-Reporter-MQTT2HA-Daemon

Linux service to collect and transfer Raspberry Pi data via MQTT to Home Assistant (for RPi Monitoring)
GNU General Public License v3.0
442 stars 62 forks source link

Sensor Naming #54

Open CFenner opened 2 years ago

CFenner commented 2 years ago

When I add my RPi (which is name RPi-MagicMirror) the name is split and the sensor name is put in between.

Bildschirmfoto 2022-04-25 um 09 51 59

sensor.rpi_temp_magicmirror

I would like to have the sensor name appended to the end of the Pi name. How can I change this behavior (pointing me to the code line is also fine).

peteh commented 1 year ago

sensor_name = 'rpi-{}'.format(rpi_hostname) I think it's this one, but I don't understand what exactly you want.

bsimmo commented 1 year ago

No, it is this line I think you are talking about, you may need to do it for all the other sensors as well https://github.com/ironsheep/RPi-Reporter-MQTT2HA-Daemon/blob/8fbb4f140ad722f8779bc61bd7dadb79f63f0423/ISP-RPi-mqtt-daemon.py#L1116 you'll need to rearrange the formatting to get Rpi Weatherhat Cpu Use

title="RPi Temp {}".format(rpi_hostname)

In more modern python that would be title=f"RPi {rpi_hostname} Temp"

But that's just the visual display, not the entity naming itself, Do you want them to be name sensor.rpi_magicmirror_temp ?