Distinguishing (and Naming) Multiple Sensors

Hello OMG Experts,

I’m running OMG on an ESP32 to feed readings from several different Ruuvi Tag sensors into my Home Assistant. I’m currently experimenting with two Ruuvi Tags, but i have a total of four lying around waiting to get deployed.

OMG works in that it automatically picks up braodcasts from any Ruuvi Tag in BLE range and successfully feeds them to my Home Assistant. However, they show up in Home Assistant like this

You can see that there are two distinct sensors (readings are different) with the same name. The entities are helpfully named “sensor.ruuvitag_rawv2_tempc” and “sensor.ruuvitag_rawv2_tempc_2”. From the way I have set up the system, it appears to me as if OMG numbers the devices in the order it discovers them - which may change when I get around to reset my OMG, e.g. for a software update. In addition, the only way to identify which sensors in the dashboard is which physical device is to go around and manually check measurements at each location - kind of defeating the purpose of having wireless sensors in the first place.

So I would like to tell OMG names for these sensors (e.g., associated to their BLE MAC) to be able tell them apart and to get them published unter a telling name. At the very least, I would like to ensure a consistent numbering of sensors across reboot.

I’m open to patch the names and MACs of my sensors into the code I install to my ESP32, but a OMG-like solution would be prefereable :slight_smile:

Is this somehow doable?



This may be due to the change of unique_id introduced recently, you will have to delete the older MQTT messages into the homeassistant/sensor topic see here

You should not see a sensor name change upon reboot, OMG publish the discovery messages with a unique_id compose of -, example :

{"stat_t":"+/+/BTtoMQTT/481234564789","name":"IBEACON-power","uniq_id":"481234564789-power","val_tpl":"{{ value_json.power | is_defined }}","state_class":"measurement","device":{"identifiers":["481234564789"],"connections":[["mac","481234564789"]],"manufacturer":"GENERIC","model":"IBEACON","name":"IBEACON","via_device":"OMG_PLUG"}}

I’m a tad bit confused here. Looking at the MQTT Messages, there is no mention of a “uniq_it” tag in there. I also cannot correlate the MQTT message with the resulting device in Home Assistant, save for comparing the reading values. There is however an ID shown, with a value equal to the BLE MAC address of each RuuVi Tag. This is true for RuuviTags that were added using v0.9.9 as well as for another tag I added a few hours ago, now on v0.9.11.

Here is an example MQTT message:


So now I am unsure - is the feature already active, where devices are given unique IDs and retain therir identity upon OMG reboot, and I’m just not seeing it (which would be fine for me)? Or did I just get lucky on the reboot with devices showing up in the same order?

Omg publish 2 types of msg when autodiscovery is activated (per default)

  • sensors payload to home/<gateway name/xxtoMQTT topic
  • entities discovery message to homeassistant topic
    The last one is published one time with a retain flag only per gateway power cycle and define the sensor in hass. Per default it should be active.
    If you look for the homeassistant topic you should find your discovery messages.

Hi @1technophile,

got it - found it - case closed. Thank you very much!


1 Like