Skip to content

Commit

Permalink
Simplify device retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerSelwyn committed Dec 24, 2022
1 parent 625306f commit bd23260
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions custom_components/mqtt_discoverystream/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,10 @@ async def _state_publisher(
publish_config = True

if publish_config:
for entry in ent_reg.entities.values():
if entry.entity_id != entity_id:
continue
for device in dev_reg.devices.values():
if device.id != entry.device_id:
continue
entry = ent_reg.async_get(entity_id)
if entry and entry.device_id:
device = dev_reg.async_get(entry.device_id)
if device:
config["dev"] = {}
if device.manufacturer:
config["dev"]["mf"] = device.manufacturer
Expand Down

0 comments on commit bd23260

Please sign in to comment.