Closed bmorgenthaler closed 3 years ago
User-facing entity IDs (not the internal entity unique IDs) are intentionally generated from device labels. That's also how other integrations I've used work (Hue, Dyson, others). It allows the user to more easily find entities (because you can search by name), and it provides a name that isn't dependent on the back end managing the device (so you can, say, swap out a Hubitat RGB bulb for a Hue bulb with the same name and all your automations will still work).
Makes sense, my mind was thinking of the names in Hubitat as "friendly names" and wanted the device not to move around, not thinking about replacing the device with a new one named the same.
What brought this on is a Aeotec Plug that I cannot get to show up as a switch, it keeps showing up as a light no mater what I name it, and every time I renamed it I would have orphaned device names or device_name_2, device_name_3, etc. showing up in Home Assistant.
Edit: Plug not Pug, I guess Aeotec is into dog breeding now.
🐶
Try requesting the device info from the maker API with something like:
http://10.0.1.99/apps/api/2269/devices/1571?access_token=your-access-token&prettyPrint=true
You should get back something like:
{
"id": "1571",
"name": "Generic Z-Wave Smart Switch",
"label": "Barn Lights",
"attributes": [
{
"name": "switch",
"currentValue": "off",
"dataType": "ENUM",
"values": [
"on",
"off"
]
}
],
"capabilities": [
"Configuration",
"Actuator",
"Refresh",
"Switch",
{
"attributes": [
{
"name": "switch",
"dataType": null
}
]
}
],
"commands": [
"refresh",
"configure",
"off",
"on",
"flash"
]
}
In particular, I'm interested to know what's under 'capabilities'.
{
"name": "Aeotec Smart Switch 6",
"label": "MyQ Power",
"type": "Aeotec Smart Switch 6",
"id": "402",
"date": "2020-12-05T18:18:49+0000",
"model": null,
"manufacturer": null,
"capabilities": [
"Configuration",
"Actuator",
"VoltageMeasurement",
"Refresh",
"PowerMeter",
"EnergyMeter",
"Outlet",
"SwitchLevel",
"Switch",
"Sensor"
],
"attributes": {
"energyDuration": "19.73 Minutes",
"dataType": "NUMBER",
"values": null,
"powerL": "0.000",
"switch": "on",
"current": "0.000",
"energy": "0.000",
"voltageH": "122.507",
"power": "0.000",
"currentH": "0.000",
"currentL": "0.000",
"voltage": "122.182",
"level": "99",
"powerH": "0.000",
"voltageL": "122.182"
},
"commands": [
{
"command": "resetEnergy"
},
{
"command": "resetPower"
},
{
"command": "refresh"
},
{
"command": "resetVoltage"
},
{
"command": "resetCurrent"
},
{
"command": "configure"
},
{
"command": "setLevel"
},
{
"command": "off"
},
{
"command": "on"
}
]
}```
It's the "SwitchLevel" capability. Right now any switch with a level (dimmer) capability is assumed to be either a cover device (like window blinds or a garage door opener) or a light.
Is there anyway to override the autodetection?
There is not at the moment, although that would certainly be useful. I created #92 for that.
Closing this since the original question seems to have been answered (I think)
Is there a reason that entity id's in Home Assistant aren't unique and based off the Device ID that is returned from the Hubitat MakerAPI? If I rename a device in Hubitat (say an outdoor plug that is used for different reasons, i.e. holiday lights right now) it changes the entity in Home Assistant were it should stay the same because the device id hasn't changed.