Hi, Not sure if this is the proper place for this matter but here goes.
I resently bought a couple of Xiaomi Mi Temperatur-sensors. The sensors measures both temperatur and humidity and are picked up using my Rfxtrx together with deConz/deConz-sensors, so far so good.
My issue is that when the sensors get imported into HA each physical sensor gets picked up as two separate sensors - one for temp and one for humidity. The problem is that the naming seems to be random and can as such not be predicted for use in automations etc.
For instance:
Sensor is named temp1 in deConz - in HA it gets the entityid sensor.temp1 AND sensor.temp1_2 but this changes each time HA is restarted. One time the temperatur-sensor gets id temp1 and the next temp1_2.
Is this a bug? or is there a way to enforce the name?
It’s expected behaviour, though I would think the entity registry in 0.63 would ensure that the same sensor gets the same entity id each time. You can also rename the sensors using the deconz service or using the API directly with a program like postman (each sensor has its own representation in the deconz rest API and can be renamed separately - I did this with my hue sensor, which has temperature, motion, and light level sensors that at first present the same way your Xiaomi sensors do). If you rename the sensors they’ll get better entity ids.
Ok, I am currently using 0.62.1 so maby the randomnes goes away by just updating to the latest version (usualy abit reluctant to picking up new versions - thats why im a bit behind). Im fine with the name just as long as the remain during reboots
Im not sure what you mean by deconz service - i used the Phoscon app to add the sensors and i also renamed them there. I have also used the older webinterface (Wireless Light Control?) for adding lights previously and i guess those rely on the rest-api. Could you provide an example of how the call to the rest-api would look to be able to rename the sensors-functionalitys individualy?
The problem is that phoscon and the web GUI expose them as one sensor but the rest API sends two devices, as you’ve seen. So you can’t use the GUIs to rename them, renaming one renames both. Here’s how to use the rest API to rename. You’ll need a program like Postman to do this.
First send a GET request (replacing apikey with the value in deconz.conf in your config dir) to: http://your-deconz-ip/api/<apikey>/sensors
That will return you a list of all your sensors. Note down the id of the sensor that you wish to change (eg I had three sensors for my one physical hue sensor, all called Motion Sensor but with different types, so it was easy to figure out which was which).
Now send a PUT request (again replacing apikey and now id) to: http://your-deconz-ip/api/<apikey>/sensors/<id>
With the body: {"name":"<name you want to rename the sensor to>"}
This will rename that sensor. Do that as many times as you need to. Now restart HA and your sensors will have different names!
As @marthocoo says; the issue with random suffix to multi sensor devices is fixed for 0.63. If you want to stay on 0.62 you can rename each sensor individually through the api and then restart hass.
Cheers m8,
Think im gonna give that a try even if a simple HA update should solve the issue. Familiarity with the deConz restapi can always be usefull.
With 0.63 you can use hass service to send commands over the rest api and with 0.64 you can also use entity ids to specify sensor you want to send rest api commands to.