Breina / PowerTagGateway

HomeAssistant integration for EcoStruxure gateways; SmartLink, PowerTag Link and Panel Servers.
MIT License
13 stars 7 forks source link

Compatibility Smartlink SI D #15

Open D2702 opened 7 months ago

D2702 commented 7 months ago

Is it also possible to use an Acti 9 Smartlink SI D gateway? I saw in another topic that there was a possibility for a Smartlink SI B.

I certainly cannot add these automatically and manually at the moment.

Breina commented 7 months ago

These ones? https://www.se.com/uk/en/product-range/64482-acti9-smartlink-si-d/44105740929-gateways

Yeah they're supported. Are you seeing any errors?

D2702 commented 7 months ago

Yes, this is it, it is an old type, not what is available now, it does have the latest firmware version (V2.4.6) It does not work either automatically or manually.

I can find the errors below in the "home assistant.log" Are there any places I should look?

2024-01-30 18:07:20.161 WARNING (MainThread) [homeassistant.util.async_] Detected blocking call to sleep inside the event loop by custom integration 'powertag_gateway' at custom_components/powertag_gateway/soap_communication.py, line 42: services = wsd.searchServices(types=[QName(NAMESPACE_SCHNEIDER, LOCAL_NAME_GATEWAY_SERVER)]), please create a bug report at https://github.com/Breina/PowerTagGateway/issues 2024-01-30 18:07:20.286 WARNING (Thread-3) [daemon] could not find handler for: _handle_probe 2024-01-30 18:37:58.131 WARNING (MainThread) [homeassistant.components.modbus.modbus] modbus hub1 communication closed

Breina commented 7 months ago

Ah I see.

Can you check that your web interface has this configured as such?

image

We should be able to get more logs through HomeAssistant through Settings > System > Logs, then search for powertag_gateway and click 'Load full logs', for example:

image

Please send me all of those logs, that should be more helpful.

D2702 commented 7 months ago

Hi,

Below is the configuration of the Smartlink. Pic01

I get the following error when I want to connect to the Smarlink from HA. Pic02

Unfortunately, I cannot find much in the log you requested. see below. Pic03

Breina commented 7 months ago

Ah man I didn't log that error, that's on me. Sorry about that!

In custom_components/powertag_gateway/config_flow.py on line 169, please add logging.error(e) (indentation matters).

image

Then restart and check logs.

Is it possible that your Gateway is unreachable through the network?

D2702 commented 7 months ago

I have adjusted the code. The gateway is available from the network (located in the same subnet). I can also read this via a modbus client.

Below is the logging: PIc04

Also an image of the TAG configuration: Pic05

When I change the IP address of the modbus port in the gateway, I get an error below. Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.100.31:502)]

This error also occurs immediately if the gateway is not reachable. If this is accessible, it will take quite a while before I get the other error.

Breina commented 7 months ago

If this is accessible, it will take quite a while before I get the other error.

Yeah that's because we need to search for the synthesis table first;

image

So it's going through all 247 tables before throwing this error.

Can you please use your modbus client to check that this one exists on address 247? I use this first one to check we got the right one;

image (reference: https://www.productinfo.schneider-electric.com/powertaglinkuserguide/powertag-link-user-guide/English/BM_PowerTag%20Link%20D%20User%20Manual_4af62430_T000501355.xml/$/TPC_SynthesisTableIdentificationREF_0000550649)

D2702 commented 7 months ago

I think the "Smartlink SI D" doesn't have a synthesis table. I can't find this anywhere in the manual. This is only stated in the manual of the "PowerTag Link Gateway".

Breina commented 7 months ago

Aaah ok! I get it. Yes.

Alright I know what to do, give me a moment to develop this for you.

Uploading manual for my own reference DOCA0115EN-03.pdf

Breina commented 7 months ago

Please test v0.2.2-alpha: https://github.com/Breina/PowerTagGateway/releases/tag/v0.2.2-alpha

D2702 commented 7 months ago

I see the option in the configuration menu, but when I click connect I immediately get an error.

Pic06

Breina commented 7 months ago

Alright thanks for testing. Added more logs and made one thing more resilient. Please report back.

Breina commented 7 months ago

https://github.com/Breina/PowerTagGateway/releases/tag/v0.2.2-alpha2

D2702 commented 7 months ago

Unfortunately, the error code is also still the same.

Pic07

Breina commented 7 months ago

I think the code didn't quite update, it must print some logging before the crash;

image

Can you see these in custom_components/powertag_gateway/config_flow.py?

D2702 commented 7 months ago

Yes, I see.

Pic08

Breina commented 7 months ago

Ok thanks for clearing this up.

This one should log better; https://github.com/Breina/PowerTagGateway/releases/tag/v0.2.2-alpha3

D2702 commented 7 months ago

Pic09

Breina commented 7 months ago

Much better!

Fixed https://github.com/Breina/PowerTagGateway/releases/tag/v0.2.2-alpha4

D2702 commented 7 months ago

A step forward, but no tags are added.

Pic10 Pic11

Breina commented 7 months ago

Getting there :)

https://github.com/Breina/PowerTagGateway/releases/tag/v0.2.2-alpha5

D2702 commented 7 months ago

Sorry... It seems the same.

Pic12 Pic13

Breina commented 7 months ago

No, this is better. We're getting further :)

Hold on

Breina commented 7 months ago

Btw 'Unknown' is I can't read the device's name. So it's going to be called Unknown. Please suggest a better default if you have one. :)

Breina commented 7 months ago

Getting close now

https://github.com/Breina/PowerTagGateway/releases/tag/v0.2.2-alpha6

D2702 commented 7 months ago

Same fault

Pic14

Breina commented 7 months ago

Not the same fault, we're actually making great progress!

I'll fix these tomorrow.

D2702 commented 7 months ago

Ok, good night and thank you very much for checking this out!

Breina commented 7 months ago

This might well be the last fix we needed! :)

https://github.com/Breina/PowerTagGateway/releases/tag/v0.2.2-alpha7

D2702 commented 7 months ago

Another step closer, I no longer receive any error messages. Only the power tags are not visible. Do I need to configure anything else?

Pic15

Breina commented 7 months ago

It's me, not you. You should have been seeing powertags.

So since on your device, there's no way to determine how many devices are connected, I just have to try slave addresses starting from 150 until one fails. What's happening now is that it fails immediately.

Can you please try reading this table on slave id 150?

image

D2702 commented 7 months ago

I can read this value via a modbus client, see below. FYI, this value also corresponds to the installed tag.

Pic16

Breina commented 7 months ago

Alright thanks for confirming!

Found and fixed an off-by-one error. :)

https://github.com/Breina/PowerTagGateway/releases/tag/v0.2.2-alpha8

D2702 commented 7 months ago

Thanks for the update. The power tags are not added yet, but I do get the error below. Hopefully you can do something with this.

Pic17

If it is too difficult or takes too much time, you can also say so and I will do it in a different way. I really like that you are still trying to integrate this module!

Breina commented 7 months ago

In schneider_modbus.py on line 531, can you please change identifier = self.__read_int_16(0x792F, power_tag_index) into identifier = self.__read_int_16(0x7930, power_tag_index)? I believe I made a mistake.

If it is too difficult or takes too much time, you can also say so and I will do it in a different way.

Not at all! :) This is normal error driven development progress. I appreciate you testing so much for me. I would really like to support your device!

D2702 commented 7 months ago

Good to hear! I have adjusted the modbus address, I no longer get error messages, but the tags are not added either.

Breina commented 7 months ago

I haven't forgotten you, just have been busy the last few days.

The lack of errors is the bane of error-driven-development, so I'm scratching my head a bit. I can add a bunch of logs tomorrow to see what it's doing and where it fails.

Breina commented 7 months ago

Alright, please try this one: https://github.com/Breina/PowerTagGateway/releases/tag/v0.2.2-alpha9

And please fetch me all of its logs. Should be able to figure out where it goes wrong.

D2702 commented 7 months ago

Attached is the requested log.

Pic18

Breina commented 6 months ago

Ok my brain finally managed to understand this problem during my dog walk. I fixed this. Try it out! :)

https://github.com/Breina/PowerTagGateway/releases/tag/v0.2.2-alpha10

KingandQ commented 6 months ago

I recently started using Home Assistant. So, little experience yet.

During installation the option “Perform automatic DWPS discovery” didn’t work. But it was successful via manually entering the Host IP-Address. No error messages during installation.

It seems I have a similar problem.: now devices or entities are found.

I would like to install the patch, but unfortunately, I have no knowledge how to do this. After unzipping the alpha10-zip-file I recognize existing directory structure, but also new ones. Can you please provide instructions on how to install this patch correctly?

Breina commented 6 months ago

Hi, welcome to the club! :) Thanks for being willing to test as well!

Yeah you have to specifically enable pre-releases: https://hacs.xyz/docs/faq/beta/. Then you can just update through HACS (restart afterwards).

You can also do it manually through downloading the release, copying the custom_components/powertag_gateway folder into the custom_components folder of your HomeAssistant. Then restart.

KingandQ commented 6 months ago

Thanks for explaining.

After installing patch alpha10, there is an additional option for selecting type of Gateway. I’ve tried all 3.

When selecting: Panel server

When selecting: PowerTag Link

When selecting type of Gateway: Smartlink SI D

My configuration:

Breina commented 6 months ago

Oh looks like we've made progress then! We found one of your powertags, but the sensors don't work properly yet. It's the smartlink one that you should pick, this is the one I'm setting up for this issue.

Can you please go to Settings > System > Logs and filter on powertag_gateway, then copy paste here what you see there.

KingandQ commented 6 months ago

As requested: image

Breina commented 6 months ago

Ah man something is wrong with these logs. Missing a lot of crucial information.

How is your logged configured in your configuration yaml?

Here's an example:

logger:
  default: info
  logs:
    custom_components.powertag_gateway: debug
Breina commented 6 months ago

The code is very verbose in telling me what's going on;

image

KingandQ commented 6 months ago

Sorry, but I recently started using Home Assistant. All new to me ;-)

Configuration.yaml modified as indicated. Logging filtered by: powertag

image
Breina commented 6 months ago

Please don't apologise! I had to learn this at one point too. :)

I appreciate you taking your time to wrestle through this.

Please upgrade to v0.2.2-alpha11, restart, add the integration again and check your logs. Won't fix anything, but should be more verbose around where it's going wrong.

KingandQ commented 6 months ago

After installing patch:

image

Logging filtered by: powertag

image

I do not see mutch diference. I’ve gone through the rest of the logging but don’t see any Powertag related info.