mnordseth / enet-homeassistant

Enet Smart Home integration for Home Assistant
Apache License 2.0
26 stars 7 forks source link

3-5 seconds delay on first switch #18

Closed archef2000 closed 2 weeks ago

archef2000 commented 1 year ago

First i am thankful for your work and a otherwise seamless integration.

When i haven't toggled something in the last 1-2 minutes it takes up to 5 seconds until the light is turned on after the command in HA. I tried to investigate the code but it is very hard to trace the long taking command.

Do you have an idea what the problem could be.

mnordseth commented 1 year ago

No idea comes to mind, I have never seen this issue myself. Is this always the case in your installation, or are there specific way to reproduce it?

archef2000 commented 1 year ago

it is always even after a fresh restart of HA i am running the latest version of both your component and HA but know no way on how to debug this.

archef2000 commented 1 year ago

Also the integration takes 50s to start: grafik

The delay is the same with blinds.

mnordseth commented 1 year ago

I know the integration takes a long time to start, and that is due to how the inner workings of the enet server. You will see a similar load time if you logon to the enet server and start commissioning. The enet app is also very slow to load.

Turning on/off or dimming lights from Home Assistant is more or less instant in my setup, and I have not heard other complaints either. There can be a few seconds delay if you change something using a light switch or the enet app, and before that is reflected in home assistant. The events generated from the server has a delay.

On Sun, Jul 2, 2023, 22:00 Konstantin @.***> wrote:

Also the integration takes 50s to start: [image: grafik] https://user-images.githubusercontent.com/69057532/250392773-2640d32b-58d2-4074-87b2-778fb83aa80e.png

The delay is the same with blinds.

— Reply to this email directly, view it on GitHub https://github.com/mnordseth/enet-homeassistant/issues/18#issuecomment-1616774838, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARX6LGUVFUATDBDGJFXIN3XOHAOFANCNFSM6AAAAAAZUUFE4Y . You are receiving this because you commented.Message ID: @.***>

archef2000 commented 1 year ago

Turning on/off or dimming lights from Home Assistant takes 3-5 seconds until the light turns on/off

archef2000 commented 1 year ago

What details could i provide to you.

mnordseth commented 1 year ago

I do not really have any idea about the reason for this. Do you experience delays with any other integration I home assistant? Do you notice any delays when controlling your lights from the enet app?

On Sun, Jul 2, 2023, 22:39 Konstantin @.***> wrote:

What details could i provide to you.

— Reply to this email directly, view it on GitHub https://github.com/mnordseth/enet-homeassistant/issues/18#issuecomment-1616796241, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARX6LFKXD67TAOD35YJ55DXOHE5LANCNFSM6AAAAAAZUUFE4Y . You are receiving this because you commented.Message ID: @.***>

archef2000 commented 1 year ago

I don't have a delay with any other integrations or the eNet app (besides first sync)

huglester commented 1 year ago

I think it is an eNET server issue. I was trying different nodejs libs. And I spotted one thing, that device (kind of) goes to sleep or so, no sure. But if you, for a longer time, do not touch lights, yes first one takes longer, like 2 seconds to activate. Afterwards it goes much faster.

It may be some initial slow connection issues or authentication or so I guess

archef2000 commented 1 year ago

But once in the app there is no delay

huglester commented 1 year ago

Because probably when you are inside an app - it is kind of initated/authed

On 2023-07-09, Sun at 21:02 Konstantin @.***> wrote:

But once in the app there is no delay

— Reply to this email directly, view it on GitHub https://github.com/mnordseth/enet-homeassistant/issues/18#issuecomment-1627785482, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABEZS34ADRLEBQQUWLJWA3XPLW47ANCNFSM6AAAAAAZUUFE4Y . You are receiving this because you commented.Message ID: @.***>

archef2000 commented 1 year ago

But in HA i don't have any delay with button presses on the remotes coming in the log

mnordseth commented 1 year ago

Hi, you can try to toggle a light using the API to try to seperate if the issue is a delay on the enet server or if it is home assistant. If you send med the debug information for the integration, I can guide you on how to do that.

On Sun, Jul 9, 2023, 20:05 Konstantin @.***> wrote:

But in HA i don't have any delay with button presses on the remotes comming in the log

— Reply to this email directly, view it on GitHub https://github.com/mnordseth/enet-homeassistant/issues/18#issuecomment-1627786072, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARX6LDJPI4BSBQK6PHPWJ3XPLXHNANCNFSM6AAAAAAZUUFE4Y . You are receiving this because you commented.Message ID: @.***>

archef2000 commented 1 year ago

Delayed on and fast off

2023-07-10 09:41:45.195 INFO (MainThread) [custom_components.enet.light] async_turn_on: (Light) {}
2023-07-10 09:41:45.195 INFO (MainThread) [custom_components.enet.aioenet] Light turn_on()
2023-07-10 09:41:45.195 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization callInputDeviceFunction
2023-07-10 09:41:47.512 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization requestEvents
2023-07-10 09:41:48.614 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization requestEvents
2023-07-10 09:41:49.286 INFO (MainThread) [custom_components.enet.light] async_turn_off: (Light) {}
2023-07-10 09:41:49.286 INFO (MainThread) [custom_components.enet.aioenet] Light turn_off()
2023-07-10 09:41:49.286 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization callInputDeviceFunction
2023-07-10 09:41:49.919 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization requestEvents

Fast on and off right after the first one

2023-07-10 09:41:50.673 INFO (MainThread) [custom_components.enet.light] async_turn_on: (Light) {}
2023-07-10 09:41:50.673 INFO (MainThread) [custom_components.enet.aioenet] Light turn_on()
2023-07-10 09:41:50.673 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization callInputDeviceFunction
2023-07-10 09:41:51.386 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization requestEvents
2023-07-10 09:41:52.153 INFO (MainThread) [custom_components.enet.light] async_turn_off: (Light) {}
2023-07-10 09:41:52.154 INFO (MainThread) [custom_components.enet.aioenet] Light turn_off()
2023-07-10 09:41:52.154 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization callInputDeviceFunction
2023-07-10 09:41:52.634 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization requestEvents
2023-07-10 09:41:54.991 DEBUG (MainThread) [custom_components.enet] Updating value of ActuatorChannel (Name: Light Type: CT_1F02 Value: 0) to 0
2023-07-10 09:41:54.994 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization requestEvents
mnordseth commented 1 year ago

There seems to be no delay on the home assistant side in any of the cases. The requests to callInputDeviceFunctionis the call towards the enet server.

If you download the diagnostic for the integration and send to me, I will help you test it from the command line to further isolate the behaviour.

How long do you have to wait to experience the delay?

On Mon, Jul 10, 2023, 11:48 Konstantin @.***> wrote:

Delayed on and fast off

2023-07-10 09:41:45.195 INFO (MainThread) [custom_components.enet.light] async_turn_on: (Light) {} 2023-07-10 09:41:45.195 INFO (MainThread) [custom_components.enet.aioenet] Light turn_on() 2023-07-10 09:41:45.195 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization callInputDeviceFunction 2023-07-10 09:41:47.512 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization requestEvents 2023-07-10 09:41:48.614 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization requestEvents 2023-07-10 09:41:49.286 INFO (MainThread) [custom_components.enet.light] async_turn_off: (Light) {} 2023-07-10 09:41:49.286 INFO (MainThread) [custom_components.enet.aioenet] Light turn_off() 2023-07-10 09:41:49.286 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization callInputDeviceFunction 2023-07-10 09:41:49.919 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization requestEvents

Fast on and off right after the first one

2023-07-10 09:41:50.673 INFO (MainThread) [custom_components.enet.light] async_turn_on: (Light) {} 2023-07-10 09:41:50.673 INFO (MainThread) [custom_components.enet.aioenet] Light turn_on() 2023-07-10 09:41:50.673 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization callInputDeviceFunction 2023-07-10 09:41:51.386 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization requestEvents 2023-07-10 09:41:52.153 INFO (MainThread) [custom_components.enet.light] async_turn_off: (Light) {} 2023-07-10 09:41:52.154 INFO (MainThread) [custom_components.enet.aioenet] Light turn_off() 2023-07-10 09:41:52.154 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization callInputDeviceFunction 2023-07-10 09:41:52.634 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization requestEvents 2023-07-10 09:41:54.991 DEBUG (MainThread) [custom_components.enet] Updating value of ActuatorChannel (Name: DeckenlichtKind Type: CT_1F02 Value: 0) to 0 2023-07-10 09:41:54.994 DEBUG (MainThread) [custom_components.enet.aioenet] Requesting https://192.168.188.12/jsonrpc/visualization requestEvents

— Reply to this email directly, view it on GitHub https://github.com/mnordseth/enet-homeassistant/issues/18#issuecomment-1628610957, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARX6LADUZJ763JZSDUIMSTXPPFVPANCNFSM6AAAAAAZUUFE4Y . You are receiving this because you commented.Message ID: @.***>

archef2000 commented 1 year ago

Send via E-Mail

archef2000 commented 1 year ago

Do you have found any idea what the problem could be

mnordseth commented 1 year ago

Unfortunately I have no idea what can cause your problem.

archef2000 commented 1 week ago

It still persists with the latest update. I deleted the integration and added it again.

archef2000 commented 1 week ago

How can I check what causes the second /jsonrpc/visualization requestEvents request?

mnordseth commented 1 week ago

I closed this issue as I have no idea what is causing it, and have not heard from anyone else with similar issues.

/jsonrpc/visualization requestEvents is called in an infinite loop. Not sure that I understand your question?

-Magnus

On Sun, 25 Aug 2024 at 17:55, Konstantin @.***> wrote:

How can I check what causes the second /jsonrpc/visualization requestEvents request?

— Reply to this email directly, view it on GitHub https://github.com/mnordseth/enet-homeassistant/issues/18#issuecomment-2308904529, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARX6LEDKFMVHINQHB4UB63ZTH46HAVCNFSM6AAAAABNA467OKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBYHEYDINJSHE . You are receiving this because you modified the open/close state.Message ID: @.***>

archef2000 commented 1 week ago

In the log it is only requested twice when I switch it the first time after that it is only called once. Is there a way to run it outside of HA to inspect it deeper? Can aioenet.py be run standalone?

mnordseth commented 1 week ago

Yes, clone the repo, and then

python examples/run_cli.py server_uri username password