TD22057 / insteon-mqtt

Python Insteon PLM <-> MQTT bridge
GNU General Public License v3.0
99 stars 43 forks source link

Modem scene names not included in MQTT Disovery #496

Open kpfleming opened 2 years ago

kpfleming commented 2 years ago

Describe the bug Modem scenes are included in MQTT Discovery, but their names are not (they are published as "Modem Scene ").

Expected behavior Published entities should have the names defined in scenes.yaml.

Additional context I've added logging messages at various places and the population of scene_map for the modem happens long after it has been published in MQTT Discovery. In the log below the discovery message is sent at 10:24:42, but the scene map is not populated until 10:24:48.

Mar 13 10:24:34 house-ha22 systemd[1]: Started Insteon-MQTT.
Mar 13 10:24:41 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:41.735 INFO Modem: Loading configuration data
Mar 13 10:24:41 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:41.735 INFO Modem: Modem address set to 53.bf.fa
Mar 13 10:24:41 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:41.736 INFO Modem: Requesting the modem address.
Mar 13 10:24:41 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:41.737 INFO Protocol: Write message to modem: OutModemInfo
Mar 13 10:24:42 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:42.750 INFO Mqtt: MQTT device opened mqtt.km6g.us 1883 with keepalive=40
Mar 13 10:24:42 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:42.754 INFO Serial: Serial device opened /dev/insteonplm
Mar 13 10:24:42 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:42.757 INFO Mqtt: MQTT message homeassistant/status b'offline'
Mar 13 10:24:42 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:42.775 INFO Protocol: Read 0x60: OutModemInfo ack: True
Mar 13 10:24:42 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:42.776 INFO Modem: Modem address set to 53.bf.fa
Mar 13 10:24:42 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:42.795 INFO Modem: 53.bf.fa database loaded 108 entries
Mar 13 10:24:42 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:42.796 INFO Modem: Modem 53.bf.fa (modem) database loaded 108 entries
Mar 13 10:24:42 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:42.903 INFO Modem: MQTT discovery 53.bf.fa (modem) on: {}
Mar 13 10:24:42 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:42.929 ERROR Modem: scene_map is {}
Mar 13 10:24:42 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:42.943 INFO Base: Device 30.c5.b4 (porch seasonal lights) database loaded 2 entries
Mar 13 10:24:42 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:42.946 INFO Base: Device 58.d8.1b (master bedroom closet lights) database loaded 2 entries
Mar 13 10:24:42 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:42.946 INFO Modem: Created switch at 30.c5.b4 (porch seasonal lights)
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.062 INFO DiscoveryTopic: Publishing discovery for 30.c5.b4 (porch seasonal lights) kwargs: {}
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.089 INFO Modem: Created switch at 58.d8.1b (master bedroom closet lights)
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.197 INFO DiscoveryTopic: Publishing discovery for 58.d8.1b (master bedroom closet lights) kwargs: {}
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.225 INFO Base: Device 38.de.5b (office closet lights) database loaded 2 entries
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.228 INFO Base: Device 4f.79.d8 (master bathroom shelf lights) database loaded 2 entries
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.232 INFO Base: Device 4f.be.f3 (master bathroom ceiling lights) database loaded 2 entries
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.235 INFO Base: Device 4f.c5.61 (stair/hall lights) database loaded 3 entries
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.238 INFO Base: Device 52.85.be (utility room lights) database loaded 4 entries
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.241 INFO Base: Device 52.b0.5d (back door lights) database loaded 1 entries
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.244 INFO Base: Device 55.c2.81 (master bedroom main lights - nook) database loaded 4 entries
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.247 INFO Base: Device 56.8b.54 (master bedroom nook lights) database loaded 2 entries
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.250 INFO Base: Device 57.62.c8 (master bedroom main lights) database loaded 4 entries
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.253 INFO Base: Device 57.62.e5 (front door sconce) database loaded 2 entries
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.256 INFO Base: Device 57.62.fd (first floor bathroom lights) database loaded 2 entries
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.259 INFO Base: Device 57.63.05 (utility room lights 1) database loaded 4 entries
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.262 INFO Base: Device 57.63.ee (office ceiling lights) database loaded 2 entries
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.265 INFO Base: Device 57.6b.30 (porch sconces) database loaded 2 entries
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.268 INFO Base: Device 57.74.35 (porch lights) database loaded 2 entries
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.269 INFO Modem: Created dimmer at 38.de.5b (office closet lights)
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.393 INFO DiscoveryTopic: Publishing discovery for 38.de.5b (office closet lights) kwargs: {}
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.422 INFO Modem: Created dimmer at 4f.79.d8 (master bathroom shelf lights)
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.554 INFO DiscoveryTopic: Publishing discovery for 4f.79.d8 (master bathroom shelf lights) kwargs: {}
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.580 INFO Modem: Created dimmer at 4f.be.f3 (master bathroom ceiling lights)
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.704 INFO DiscoveryTopic: Publishing discovery for 4f.be.f3 (master bathroom ceiling lights) kwargs: {}
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.734 INFO Modem: Created dimmer at 4f.c5.61 (stair/hall lights)
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.862 INFO DiscoveryTopic: Publishing discovery for 4f.c5.61 (stair/hall lights) kwargs: {}
Mar 13 10:24:43 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:43.887 INFO Modem: Created dimmer at 52.85.be (utility room lights)
Mar 13 10:24:44 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:44.011 INFO DiscoveryTopic: Publishing discovery for 52.85.be (utility room lights) kwargs: {}
Mar 13 10:24:44 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:44.040 INFO Modem: Created dimmer at 52.b0.5d (back door lights)
Mar 13 10:24:44 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:44.168 INFO DiscoveryTopic: Publishing discovery for 52.b0.5d (back door lights) kwargs: {}
Mar 13 10:24:44 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:44.200 INFO Modem: Created dimmer at 55.c2.81 (master bedroom main lights - nook)
Mar 13 10:24:44 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:44.280 INFO DiscoveryTopic: Publishing discovery for 55.c2.81 (master bedroom main lights - nook) kwargs: {}
Mar 13 10:24:44 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:44.306 INFO Modem: Created dimmer at 56.8b.54 (master bedroom nook lights)
Mar 13 10:24:44 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:44.438 INFO DiscoveryTopic: Publishing discovery for 56.8b.54 (master bedroom nook lights) kwargs: {}
Mar 13 10:24:44 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:44.464 INFO Modem: Created dimmer at 57.62.c8 (master bedroom main lights)
Mar 13 10:24:44 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:44.587 INFO DiscoveryTopic: Publishing discovery for 57.62.c8 (master bedroom main lights) kwargs: {}
Mar 13 10:24:44 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:44.613 INFO Modem: Created dimmer at 57.62.e5 (front door sconce)
Mar 13 10:24:44 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:44.742 INFO DiscoveryTopic: Publishing discovery for 57.62.e5 (front door sconce) kwargs: {}
Mar 13 10:24:44 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:44.768 INFO Modem: Created dimmer at 57.62.fd (first floor bathroom lights)
Mar 13 10:24:44 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:44.892 INFO DiscoveryTopic: Publishing discovery for 57.62.fd (first floor bathroom lights) kwargs: {}
Mar 13 10:24:44 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:44.918 INFO Modem: Created dimmer at 57.63.05 (utility room lights 1)
Mar 13 10:24:45 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:45.006 INFO DiscoveryTopic: Publishing discovery for 57.63.05 (utility room lights 1) kwargs: {}
Mar 13 10:24:45 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:45.033 INFO Modem: Created dimmer at 57.63.ee (office ceiling lights)
Mar 13 10:24:45 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:45.156 INFO DiscoveryTopic: Publishing discovery for 57.63.ee (office ceiling lights) kwargs: {}
Mar 13 10:24:45 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:45.182 INFO Modem: Created dimmer at 57.6b.30 (porch sconces)
Mar 13 10:24:45 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:45.310 INFO DiscoveryTopic: Publishing discovery for 57.6b.30 (porch sconces) kwargs: {}
Mar 13 10:24:45 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:45.336 INFO Modem: Created dimmer at 57.74.35 (porch lights)
Mar 13 10:24:45 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:45.459 INFO DiscoveryTopic: Publishing discovery for 57.74.35 (porch lights) kwargs: {}
Mar 13 10:24:45 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:45.488 INFO Base: Device 2e.81.24 (stair/hall remote) database loaded 3 entries
Mar 13 10:24:45 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:45.489 INFO Modem: Created mini_remote1 at 2e.81.24 (stair/hall remote)
Mar 13 10:24:45 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:45.546 INFO DiscoveryTopic: Publishing discovery for 2e.81.24 (stair/hall remote) kwargs: {}
Mar 13 10:24:45 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:45.575 INFO Base: Device 53.34.02 (tv room fan) database loaded 10 entries
Mar 13 10:24:45 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:45.609 INFO Base: Device 53.34.a7 (living room fan) database loaded 6 entries
Mar 13 10:24:45 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:45.612 INFO Base: Device 53.34.b3 (master bedroom fan) database loaded 6 entries
Mar 13 10:24:45 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:45.616 INFO Base: Device 53.34.50 (office fan) database loaded 5 entries
Mar 13 10:24:45 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:45.617 INFO Modem: Created fan_linc at 53.34.02 (tv room fan)
Mar 13 10:24:45 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:45.845 INFO DiscoveryTopic: Publishing discovery for 53.34.02 (tv room fan) kwargs: {}
Mar 13 10:24:45 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:45.871 INFO Modem: Created fan_linc at 53.34.a7 (living room fan)
Mar 13 10:24:46 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:46.100 INFO DiscoveryTopic: Publishing discovery for 53.34.a7 (living room fan) kwargs: {}
Mar 13 10:24:46 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:46.126 INFO Modem: Created fan_linc at 53.34.b3 (master bedroom fan)
Mar 13 10:24:46 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:46.355 INFO DiscoveryTopic: Publishing discovery for 53.34.b3 (master bedroom fan) kwargs: {}
Mar 13 10:24:46 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:46.382 INFO Modem: Created fan_linc at 53.34.50 (office fan)
Mar 13 10:24:46 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:46.611 INFO DiscoveryTopic: Publishing discovery for 53.34.50 (office fan) kwargs: {}
Mar 13 10:24:46 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:46.644 INFO Base: Device 58.8a.58 (master bedroom fan keypad) database loaded 14 entries
Mar 13 10:24:46 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:46.648 INFO Base: Device 58.8c.c3 (living room fan keypad) database loaded 14 entries
Mar 13 10:24:46 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:46.653 INFO Base: Device 58.8f.9e (tv room fan keypad) database loaded 18 entries
Mar 13 10:24:46 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:46.657 INFO Base: Device 58.90.da (office fan keypad) database loaded 14 entries
Mar 13 10:24:46 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:46.658 INFO Modem: Created keypad_linc at 58.8a.58 (master bedroom fan keypad)
Mar 13 10:24:47 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:47.021 INFO DiscoveryTopic: Publishing discovery for 58.8a.58 (master bedroom fan keypad) kwargs: {}
Mar 13 10:24:47 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:47.053 INFO Modem: Created keypad_linc at 58.8c.c3 (living room fan keypad)
Mar 13 10:24:47 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:47.411 INFO DiscoveryTopic: Publishing discovery for 58.8c.c3 (living room fan keypad) kwargs: {}
Mar 13 10:24:47 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:47.443 INFO Modem: Created keypad_linc at 58.8f.9e (tv room fan keypad)
Mar 13 10:24:47 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:47.808 INFO DiscoveryTopic: Publishing discovery for 58.8f.9e (tv room fan keypad) kwargs: {}
Mar 13 10:24:47 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:47.836 INFO Modem: Created keypad_linc at 58.90.da (office fan keypad)
Mar 13 10:24:48 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:48.192 INFO DiscoveryTopic: Publishing discovery for 58.90.da (office fan keypad) kwargs: {}
Mar 13 10:24:48 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:48.863 ERROR Scenes: added TV Room Fan Low to scene_map
Mar 13 10:24:48 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:48.865 ERROR Scenes: added TV Room Fan Medium to scene_map
Mar 13 10:24:48 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:48.867 ERROR Scenes: added TV Room Fan High to scene_map
Mar 13 10:24:48 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:48.868 ERROR Scenes: added TV Room Fan Off to scene_map
Mar 13 10:24:48 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:48.871 ERROR Scenes: added Living Room Fan Low to scene_map
Mar 13 10:24:48 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:48.873 ERROR Scenes: added Living Room Fan Medium to scene_map
Mar 13 10:24:48 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:48.875 ERROR Scenes: added Living Room Fan High to scene_map
Mar 13 10:24:48 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:48.876 ERROR Scenes: added Living Room Fan Off to scene_map
Mar 13 10:24:48 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:48.878 ERROR Scenes: added Master Bedroom Fan Low to scene_map
Mar 13 10:24:48 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:48.881 ERROR Scenes: added Master Bedroom Fan Medium to scene_map
Mar 13 10:24:48 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:48.883 ERROR Scenes: added Master Bedroom Fan High to scene_map
Mar 13 10:24:48 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:48.884 ERROR Scenes: added Master Bedroom Fan Off to scene_map
Mar 13 10:24:48 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:48.888 ERROR Scenes: added Office Fan Low to scene_map
Mar 13 10:24:48 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:48.890 ERROR Scenes: added Office Fan Medium to scene_map
Mar 13 10:24:48 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:48.892 ERROR Scenes: added Office Fan High to scene_map
Mar 13 10:24:48 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:48.894 ERROR Scenes: added Office Fan Off to scene_map
Mar 13 10:24:48 house-ha22 insteon-mqtt[9704]: 2022-03-13 10:24:48.896 INFO Modem: Starting device refresh
kpfleming commented 2 years ago

Correction: this only happens on the first discovery run after Insteon-MQTT is started. If discovery is triggered again after that (by an HA restart, for example), then the scene names are included in the discovery data.

krkeegan commented 2 years ago

Yup, this is a known issue -> https://github.com/TD22057/insteon-mqtt/pull/387#issuecomment-827215899

If you can figure out a solution, I am more than happy to merge it.

kpfleming commented 2 years ago

I'll put this on my to-do list.