Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hdpowerview] Wrong re-discovery of existing Things #18149

Open
GeorgeEsper opened this issue Jan 21, 2025 · 12 comments · May be fixed by #18200
Open

[hdpowerview] Wrong re-discovery of existing Things #18149

GeorgeEsper opened this issue Jan 21, 2025 · 12 comments · May be fixed by #18200
Assignees
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@GeorgeEsper
Copy link

Your Environment

  • Version used: openHab 4.3.1
  • Operating System and version: Windows 10

The binding works very well, but keeps auto-discovering my Hunter-Douglas PowerView Gen 2 Hub, even after ignoring it.

According to the following, https://www.openhab.org/docs/developer/bindings/thing-xml.html#representation-property, a representation property is used to auto-ignore discovery results of Things that already exist in the system. This can happen if, a) a Thing has been created manually, or b) the Thing has been discovered separately by two mechanisms e.g. by mDNS, and by NetBios, or UPnP. If this is the case, the Thing in the inbox is automatically ignored. Note that this Thing is automatically removed when the manually added Thing is removed. A new discovery would then automatically find this Thing again and add it to the inbox properly.

See also Implementing a Discovery Service

It would be great to add this feature.

@GeorgeEsper GeorgeEsper added the enhancement An enhancement or new feature for an existing add-on label Jan 21, 2025
@andrewfg
Copy link
Contributor

The binding does already implement representation properties.

So we need to find out more about what is going wrong in your particular system. Can you please give information about 1) your Thing and Item configurations, and 2) your LAN configuration? And concerning the latter, is your system LAN using IPv4 or IPv6 or both?

@GeorgeEsper
Copy link
Author

The LAN uses IPv4.

Here's the code.

Thing:

Bridge hdpowerview:hub:shady "H-D PowerView Gen 2 Hub" @ "Service Room" [
    host="PowerViewHub",
    refresh="60000",
    hardRefreshBatteryLevel="0",
    hardRefresh="180"
    ] {
        Thing shade s22094 "Sunroom West" @ "Sun Room" [id="22094"]
        Thing shade s7497  "Sunroom North" @ "Sun Room" [id="7497"]
        Thing shade s31345 "West Bedroom" @ "West Bedroom" [id="31345"]
    //    Thing shade s733   "Hallway" @ "Hallway" [id="733"]
        Thing repeater r11886 "Repeater" @ "Hallway" [id="11886"]
}

Items (one shade included; the others follow the same pattern):

Group Home_Shades   "Home Shades" <blinds> (HC)

Group Sunroom_West_Shade "Sunroom West Shade" <blinds> (F1_Sunroom, Home_Shades, gShades) ["Blinds"]

Rollershutter               F1_Sunroom_W_Shade_Bottom_Pos       "Sunroom West Shade Bottom [%.0f %%]"   <blinds>            (Sunroom_West_Shade, gBottomTracks) ["Blinds"]    {channel="hdpowerview:shade:shady:s22094:position"}
Rollershutter               F1_Sunroom_W_Shade_Top_Pos          "Sunroom West Shade Top [%.0f %%]"      <blinds>            (Sunroom_West_Shade, gTopTracks) ["Blinds"]    {channel="hdpowerview:shade:shady:s22094:secondary"}
Number                      F1_Sunroom_W_Shade_SignalStrength   "Sunroom West Shade Signal Strength"    <QualityOfService>  (Sunroom_West_Shade) ["Measurement", "Level"] {channel="hdpowerview:shade:shady:s22094:signalStrength"}
Number:ElectricPotential    F1_Sunroom_W_Shade_Battery_Voltage  "Sunroom West Shade Line Voltage"       <energy>            (Sunroom_West_Shade) ["Measurement", "Voltage"]   {channel="hdpowerview:shade:shady:s22094:batteryVoltage"}
String                      F1_Sunroom_W_Shade_Command          "Sunroom West Shade Command"            <blinds>            (Sunroom_West_Shade) ["Command"]   {channel="hdpowerview:shade:shady:s22094:command"}

Repeater:

Group PowerView_Repeater    "PowerView Repeater"  <f7:circle>  (F2_Hallway)   ["Blinds"]

Color  Repeater_Color           "Repeater Color"                 <blinds> (PowerView_Repeater) {channel="hdpowerview:repeater:shady:r11886:color"}
Dimmer Repeater_Brightness      "Repeater Brightness"            <blinds> (PowerView_Repeater) {channel="hdpowerview:repeater:shady:r11886:color"}
String Repeater_Identify        "Repeater Identify"              <blinds> (PowerView_Repeater) {channel="hdpowerview:repeater:shady:r11886:identify"}
Switch Repeater_BlinkingEnabled "Repeater Blinking Enabled [%s]" <blinds> (PowerView_Repeater) {channel="hdpowerview:repeater:shady:r11886:blinkingEnabled"}

Scenes & Automations:

Group Shade_Controls    "PowerView Scenes & Automations" <blinds> (HC) ["Blinds"]

Group Shade_Scenes "PowerView Scenes" <terrace> (Shade_Controls, Home_Shades) ["Blinds"]

Switch Shade_Scenes_Good_Night                       "Good Night"                          (Shade_Scenes) ["Point"]  { channel="hdpowerview:hub:shady:scenes#47229" }
Switch Shade_Scenes_Good_Morning                     "Good Morning"                        (Shade_Scenes) ["Point"]  { channel="hdpowerview:hub:shady:scenes#5150" }
Switch Shade_Scenes_Summer_Hot                       "Summer Hot"                          (Shade_Scenes) ["Point"]  { channel="hdpowerview:hub:shady:scenes#18658" }
Switch Shade_Scenes_All_Open                         "All Open"                            (Shade_Scenes) ["Point"]  { channel="hdpowerview:hub:shady:scenes#1631" }

Group Shade_Automations "PowerView Automations" <f7:gear> (Shade_Controls, Home_Shades) ["Blinds"]

Switch Shade_Automations_Good_Night_At_sunset_All_days    "Good Night, At sunset, All days"     (Shade_Automations) ["Point"]  { channel="hdpowerview:hub:shady:automations#32905" }
Switch Shade_Automations_Good_Morning_At_sunrise_All_days "Good Morning, At sunrise, All days"  (Shade_Automations) ["Point"]  { channel="hdpowerview:hub:shady:automations#46214" }
Switch Shade_Automations_Summer_Hot_1500_All_days         "Summer Hot, 15:00, All days"         (Shade_Automations) ["Point"]  { channel="hdpowerview:hub:shady:automations#62600" }

@andrewfg
Copy link
Contributor

Ok. Many thanks. So what are you seeing resp. not seeing in the Inbox?

@andrewfg
Copy link
Contributor

Also: is your Gen 2 Hub connected via Ethernet or via WiFi (or both)? I see that you have configured the hub to use a host name rather than an Ip address. If the hub is connected via both Ethernet and Wifi then it will have different Ip addresses on each interface. And probably the host name applies to one or other of those Ip addresses but not both. In which case the hub will indeed present as two hubs in the Inbox since the representation property is the Ip address (or the mac address , I forget; but either way each interface has separate Ip addresses and mac addresses).

@GeorgeEsper
Copy link
Author

Here the image of the Inbox:
Image

The Gen 2 Hub is connected via Ethernet only. The address is 192.168.2.190. I used the hosts file to translate the name, which resolves to 192.168.2.190. This is the same address that is always discovered.

Is it possible that the binding itself is seeing that the hub name is different from its IP address?

@GeorgeEsper
Copy link
Author

I've reverted to using the IP address instead of the host name. Perhaps this will change the behaviour.

@jlaur
Copy link
Contributor

jlaur commented Jan 29, 2025

I've reverted to using the IP address instead of the host name. Perhaps this will change the behaviour.

Yes, the problem is that the hostname/IP address is used as representation property, and the IP address found by discovery doesn't match your configured hostname.

@jlaur
Copy link
Contributor

jlaur commented Jan 29, 2025

I"m at my phone now, but did a quick check. I think we could switch to using serial number as representation property. It requires an additional call (I think), but we already have one call to detect generation 1/2, so that's probably not a big issue. Alternatively we could resolve the hostname, but it still feels awkward to use it as representation property. WDYT, @andrewfg?

@andrewfg
Copy link
Contributor

@jlaur in principle we could use either the serial number or the host name. In the former case the discovery services must make an extra HTTP call to read it, whereas in the latter case they must do a host name lookup. I think the overhead is trivial either way.

Nevertheless I do more strongly support using the serial number rather than the host name for the following reasons.

  • hubs always have a serial number, whereas they may or may not have a host name; so it requires less conditional code.
  • users may change the host name, whereas the serial number is fixed.
  • we can handle the case where the hub is on both Wifi and Ethernet since serial number is the same for both.

@jlaur
Copy link
Contributor

jlaur commented Jan 29, 2025

I do more strongly support using the serial number rather than the host name

I agree, that was also my primary and preferred proposal. 👍

@andrewfg
Copy link
Contributor

andrewfg commented Jan 29, 2025

@jlaur shall I create a PR or do you prefer to do it yourself?

EDIT I already started work on it :)

@GeorgeEsper
Copy link
Author

Thank you both for your quick attention. Your efforts are truly appreciated.

@andrewfg andrewfg changed the title [hdpowerview] Hunter Douglas PowerView Binding - Auto-discovery of Existing Thing [hdpowerview] Auto-discovery of Existing Thing Feb 1, 2025
@andrewfg andrewfg changed the title [hdpowerview] Auto-discovery of Existing Thing [hdpowerview] Auto-discovery of existing Thing Feb 1, 2025
@andrewfg andrewfg added bug An unexpected problem or unintended behavior of an add-on and removed enhancement An enhancement or new feature for an existing add-on labels Feb 1, 2025
@andrewfg andrewfg self-assigned this Feb 1, 2025
@andrewfg andrewfg changed the title [hdpowerview] Auto-discovery of existing Thing [hdpowerview] Re-discovery of existing Things Feb 3, 2025
@andrewfg andrewfg changed the title [hdpowerview] Re-discovery of existing Things [hdpowerview] Wrong re-discovery of existing Things Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
3 participants