-
Can someone tell me or give me an example code how I can re-address a device (e.g. a lamp)? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 9 replies
-
If a device already has a short address that you know, and you just want to change it to a different address, you can use
If it's the only device on the bus you could send SetShortAddress as a broadcast. Don't do this if there is more than one device, they will all send up with the same address!
If you have multiple devices to assign addresses to, you would use Obviously the details of how you send these commands on the bus depend on the type of interface that you are using. |
Beta Was this translation helpful? Give feedback.
-
By default the |
Beta Was this translation helpful? Give feedback.
-
Have you managed to get the LUBA interface working? Have a look at |
Beta Was this translation helpful? Give feedback.
-
I have the problem that when I address the devices, I can only find half of them after addressing. This is the code I used for addressing: async def assign_addresses(self, mapping):
print("Starte Adresszuweisung absteigend sortiert")
assigned = 0
sorted_mapping = sorted(mapping, key=lambda x: x[0], reverse=True)
for new_addr, old_addr, _ in sorted_mapping:
if new_addr != old_addr:
try:
await self.driver.send(DTR0(new_addr))
await asyncio.sleep(0.1)
await self.driver.send(SetShortAddress(old_addr))
print(f"Adresse {old_addr} geändert zu {new_addr}")
assigned += 1
await asyncio.sleep(0.4)
except Exception as e:
print(f"Fehler bei Adresszuweisung {old_addr} → {new_addr}: {e}")
print(f"Adresszuweisung abgeschlossen ({assigned} Änderungen durchgeführt)")
|
Beta Was this translation helpful? Give feedback.
Aha. I've realised what it is! My advice at the start of the discussion was not actually correct.
The comment for
SetShortAddress()
says the following:So instead of sending
DTR0(new_address)
you should be sendingDTR0((new_address << 1) | 1)
Apologies for the bad advice.