plugwise / python-plugwise

Plugwise python module for Smiles (Anna, Adam, P1) and Stretch
https://pypi.org/project/plugwise
MIT License
10 stars 9 forks source link

[FEATURE] List zigbee devices #151

Closed Sennevds closed 11 months ago

Sennevds commented 2 years ago

I'm trying to setup extra repeaters because the Adam is in the basement and my Tom's are on the first floor and the zigbee signal doesn't reach there. I'm using custom flashed CC2531 and CC2530+CC2591. At this moment I'm checking the core/modules xml document and comparing them with a previous version before I tried to connect the CCxxxx device to see if it connected. Would be nice if I can query the Adam to see what zigbee device's are connected and what their neighbors are. The CC stick looks like this in the xml:

<module id="fef68e8b0ace4e369ba7c76a00bbc8f9">
  <vendor_name/>
  <vendor_model/>
  <hardware_version/>
  <firmware_version/>
  <upgrade/>
  <created_date>2022-03-02T15:31:22.616+01:00</created_date>
  <modified_date>2022-03-02T15:31:22.666+01:00</modified_date>
  <deleted_date/>
  <services/>
  <protocols>
    <zig_bee_node id="d2365aa43b0a4e8b9e3a60364d983403">
      <mac_address>00124B001938CDFB</mac_address>
      <type>router</type>
      <reachable>true</reachable>
      <zig_bee_coordinator id="7e8af5e986214a429011774db820dae7"/>
      <neighbors>
        <zig_bee_node id="0f3ea7a23026449da097c29a35d90c19"/>
        <zig_bee_node id="8690706ba92f4a0e9af0b2cbf3800448"/>
      </neighbors>
    </zig_bee_node>
  </protocols>
</module>

If this is out of scope I will try to make myself something :)

bouwew commented 2 years ago

From @frenck I've understood that this kind of info will be available in HA Core sometime in the future. I'm not sure how that will look like though.

Regarding your request, yes, we could implement functionality that does that. But it will not be shown in HA Core without the fitting displaying-function. And the plugwise-output would need to fit to the input required by HA Core. So we can't do anything without clear instructions from the Core devs. Or from you if you were to develop the displaying-function for Core yourself :)

@frenck anything you would like to add?

Sennevds commented 2 years ago

I'll wait on Frenck's input :) and in the meantime I will create small python script to get me the necessary information πŸ™‚

frenck commented 2 years ago

We could create an empty shell device to provide a connection internally for Home Assistant, but it won't provide a graph you can view or any entities for such a device either.

Sennevds commented 2 years ago

I don't need a entity. For my use case just a sensor with a list of connected ZigBee device's would suffice. But I don't know the bigger picture for Hass.

bouwew commented 2 years ago

@Sennevds can you specify in detail what you are looking for? From what you write above, you want to know from each zigbee-capable device to which router/coordinator/neighbours they are connected?

Also, feel free to provide a PR that implements your requested functionality.

frenck commented 2 years ago

For my use case just a sensor with a list of connected ZigBee devices would suffice.

Integration cannot provide such a thing at this moment in time.

bouwew commented 2 years ago

@frenk you mean this can't be a sensor? This info could be added as extra_state_attributes?

Sennevds commented 2 years ago

@Sennevds can you specify in detail what you are looking for? From what you write above, you want to know from each zigbee-capable device to which router/coordinator/neighbours they are connected?

Also, feel free to provide a PR that implements your requested functionality.

Something like that or a list of devices connected to the coordinator. Like I said in my initial FR you can add CCxxxx devices to extend the network by opening the ZigBee network on the Adam but you don't have any confirmation that it worked. If you look at core/modules you can view the devices so I thought that it would be nice to integrate them in this package but it looks like this python package is only used for Hass and I get there is no interest in this because it's not officially supported by plugwise

Sennevds commented 2 years ago

@Frenk you mean this can't be a sensor? This info could be added as extra_state_attributes?

This would be sufficient for me πŸ™‚

frenck commented 2 years ago

There is no state in here... (so no entity to create) Additionally, extra attributes is something that Home Assistant is avoid/phasing out as much as possible.

There is a connection in the device info, which services this purpose. However, as said above, that would require creating of empty shell devices, which is odd as well.

From the Home Assistant perspective, this will not add much and will also not visualize it. IMHO, it doesn't belong there at this point.

Sennevds commented 2 years ago

Thought so. I will create my own python script to visualize it.

bouwew commented 2 years ago

"but it looks like this python package is only used for Hass and I get there is no interest in this because it's not officially supported by plugwise"

That is a wrong conclusion :) Frenck is the "voice" of HA Core but we can allow ourselves some freedom in the plugwise-library and in plugwise-beta :)

Let's discuss a little more before we close this topic.

@Sennevds On the usefulness of the zigbee-related info, the HA Core ZHA Integration provides a visualization of the network, as stated here https://github.com/zha-ng/zha-map Might this depreciated code be of interest to you?

Sennevds commented 2 years ago

I've created a small python script with dash and gives following output: image Just need to add the names via the appliances xml (damn they didn't make a really accessible api πŸ˜“ )

frenck commented 2 years ago

@Sennevds On the usefulness of the zigbee-related info, the HA Core ZHA Integration provides a visualization of the network, as stated here zha-ng/zha-map

Such a thing cannot be provided directly by (custom) integrations, as it is baked into the Home Assistant frontend.

See: https://github.com/home-assistant/frontend/blob/dev/src/panels/config/integrations/integration-panels/zha/zha-network-visualization-page.ts

bouwew commented 2 years ago

@Sennevds Looking nice! Please see const.py for number (106-03) to name, see util.py for the code to convert number to name.

Sennevds commented 2 years ago

I want to connect the appliances so I can add the display name instead of the product name. Just added the coordinator (has a different node name zig_bee_coordinator)

Sennevds commented 2 years ago

@bouwew could it be that there was an software update? All of a sudden I notice the the neighbors has a sub element neighbor and every neighbor element has a dept and relation element. Previous week it looked different.

Edit: check now I'm on 3.6.7 and last week I was on 3.2.8. Looks like the XML's have changed.

Edit 2: all my entities became unavailable in home assistant I will try to check these evening in the logs

bouwew commented 2 years ago

Yes, I'm reading on Tweakers.net that others have gotten this update too. I'm already on v3.6.x for some time, the python-plugwise code has already been adapted for the XML-changes in this update.

Entities unavailable: please try to restart HA Core, does this resolve the issue?

bouwew commented 2 years ago

@Sennevds I came across this on Gathering of Tweakers:

Nieuwe Adam 3.6.x release: Bug fixes en security verbeteringen Scene voor alle zones in 1x instellen Vakantiemodus Verwarming pauzeren Maximale keteltemperatuur voor OpenTherm ketels kan nu altijd ingesteld worden, ook al ondersteunt de ketel dit niet. De regeling zelf zal niet hoger vragen dan de ingestelde maximale keteltemperatuur. OpenTherm thermostaat kan verwijderd worden Loria dual circuit ondersteuning Plug update Na stroomuitval blijft Plug uitstaan Plug multicasting Nieuwe apparaattypes: koelcontact, elektrische verwarming Plug voor verwarming kan niet meer vergrendeld worden Verbeterde zigbee update stabiliteit Verbeterde Tom temperatuur correctie Tom’s worden 1 voor 1 open of dicht gezet Circulatiepomp wacht langer op Koen voordat die aangaat Plugwise zone-regeling staat nu standaard aan Regeling zet warmtepompen aan met een nog lagere gewenste aanvoertemperatuur Zone verwarmingsfout status toegevoegd

Sennevds commented 2 years ago

That was my message πŸ˜„

bouwew commented 2 years ago

I was wondering about that... :)

Anyway, thanks for providing, there's some good information in the changelog!

bouwew commented 2 years ago

@Sennevds where are you with your experiments? Is there something you could share?

Sennevds commented 2 years ago

Hi, I just started rewriting it today for the changes in the API/xml's. At this moment I'm not using this library but just my own script to understand the links. Next up in line is to use this library and maybe create pr

bouwew commented 11 months ago

Let's close this, no updates in a long time.