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

RAS-3M18G3AVG-E Inverter / Restart Integration #201

Open
tux1980 opened this issue Aug 31, 2024 · 19 comments
Open

RAS-3M18G3AVG-E Inverter / Restart Integration #201

tux1980 opened this issue Aug 31, 2024 · 19 comments

Comments

@tux1980
Copy link

tux1980 commented Aug 31, 2024

Hi,

I do have a weird issue with this integration. At least once a day I have to restart the Integration because it claims "invalid credentials". So this indicates an authentication error I think:).

Is disturbing and annoying a bit since I'm using automation to control and regulate my ac devices. As soon I restart the integration it's been working again.

Excerpt from the log book:
2024-08-31 12:31:11.957 ERROR (MainThread) [toshiba_ac.device] State reload failed: 2024-08-31 12:31:32.760 ERROR (MainThread) [toshiba_ac.device] State reload failed: 2024-08-31 13:01:11.530 ERROR (MainThread) [toshiba_ac.device] State reload failed: 2024-08-31 13:34:50.603 ERROR (MainThread) [toshiba_ac.device] State reload failed: File "/config/custom_components/toshiba_ac/climate.py", line 197, in async_set_hvac_mode await self._device.set_ac_status(ToshibaAcStatus.ON) File "/usr/local/lib/python3.12/site-packages/toshiba_ac/device/__init__.py", line 269, in set_ac_status File "/usr/local/lib/python3.12/site-packages/toshiba_ac/device/__init__.py", line 259, in send_state_to_ac File "/usr/local/lib/python3.12/site-packages/toshiba_ac/utils/amqp_api.py", line 100, in send_message 2024-08-31 16:01:28.193 ERROR (MainThread) [toshiba_ac.device] State reload failed: 2024-08-31 16:31:37.953 ERROR (MainThread) [toshiba_ac.device] State reload failed: File "/config/custom_components/toshiba_ac/climate.py", line 197, in async_set_hvac_mode await self._device.set_ac_status(ToshibaAcStatus.ON) File "/usr/local/lib/python3.12/site-packages/toshiba_ac/device/__init__.py", line 269, in set_ac_status File "/usr/local/lib/python3.12/site-packages/toshiba_ac/device/__init__.py", line 259, in send_state_to_ac File "/usr/local/lib/python3.12/site-packages/toshiba_ac/utils/amqp_api.py", line 100, in send_message 2024-08-31 16:44:34.929 ERROR (MainThread) [custom_components.toshiba_ac] Unload Toshiba integration 2024-08-31 16:44:35.377 WARNING (MainThread) [custom_components.toshiba_ac] Initial connection failed, trying to get new sas_token... 2024-08-31 17:01:17.277 ERROR (MainThread) [toshiba_ac.device] State reload failed: 2024-08-31 17:31:02.835 ERROR (MainThread) [toshiba_ac.device_manager] Fetching energy consumption failed:

Every hint is very welocme
thanks!
tux1980

@tux1980
Copy link
Author

tux1980 commented Sep 3, 2024

The Problem is obviously that the Token is running out and it will be generate a new Token after restarting the Integration:
"username": "tuxxxxxxxx", "password": "xxxxxxxxxxxxxxx",
"device_id": "5c6afa0d301309d5",
"sas_token": "SharedAccessSignature sr=toshibasmaciothubprod.azure-devices.net%2Fdevices%2Ftux19....."

Any Idea how I can assign a task to ha to generate that token eg all 30 minutes and put in "core.config_entries" file?

thanks

@KaSroka
Copy link
Contributor

KaSroka commented Sep 6, 2024

What is the expiry date of your sas token? You can check it with cat /config/.storage/core.config_entries | jq '.data.entries[] | select(.domain == "toshiba_ac") | .data.sas_token | split("&") | map(select(startswith("se="))) | .[0] | ltrimstr("se=") | tonumber | todate' in my case I have tokens valid for 100 years.

Also, duplicate of #197

@h4de5
Copy link
Owner

h4de5 commented Sep 7, 2024

same here.. my ends in 2124

@tux1980
Copy link
Author

tux1980 commented Sep 7, 2024

cat /config/.storage/core.config_entries | jq '.data.entries[] | select(.domain == "toshiba_ac") | .data.sas_token  | split("&") | map(select(startswith("se="))) | .[0] | ltrimstr("se=") | tonumber | todate'
"2124-08-13T23:42:44Z"

@tux1980
Copy link
Author

tux1980 commented Sep 7, 2024

Yes, same here, but nevertheless. It dows not work - I still have to restart the integration in regular intervals.
Screenshot from 2024-09-07 11-47-27

Logger: homeassistant.helpers.entity_platform
Quelle: helpers/entity_platform.py:415
Erstmals aufgetreten: 03:00:42 (1 Vorkommnisse)
Zuletzt protokolliert: 03:00:42

toshiba_ac raises exception ConfigEntryNotReady in forwarded platform climate; Instead raise ConfigEntryNotReady before calling async_forward_entry_setups

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.toshiba_ac.climate
Quelle: custom_components/toshiba_ac/climate.py:57
Integration: Toshiba AC (Dokumentation, Probleme)
Erstmals aufgetreten: 03:00:42 (1 Vorkommnisse)
Zuletzt protokolliert: 03:00:42

Error during connection to Toshiba server

@tux1980
Copy link
Author

tux1980 commented Sep 7, 2024

This occurred at 3am - now I restarted the Integration again and everything works fine again.

@h4de5
Copy link
Owner

h4de5 commented Sep 7, 2024

does something happen at 3am that would make integration to restart? also the logs from above looks like it happens more or less every 30 minutes. in the current version there should be some kind of randomness to prevent DoS like behavior.

@KaSroka
Copy link
Contributor

KaSroka commented Sep 8, 2024

Can you please enable debug logs and post the log output when issue happens?

To enable logs, please add this to your configuration.yaml

logger:
  default: warning
  logs:
    # log level toshiba-ac
    toshiba_ac: debug
    custom_components.toshiba_ac: debug

@tux1980
Copy link
Author

tux1980 commented Sep 9, 2024

Hi,

I activated the debugging Modus and the outcome we can find here:

home-assistant_toshiba_ac_debug.log

@h4de5
Copy link
Owner

h4de5 commented Sep 10, 2024

do you have some kind of automation that reloads the integration regulary?

@tux1980
Copy link
Author

tux1980 commented Sep 10, 2024

Yes, but that did not help as a workaround and I deactivated it yesterday.

@h4de5
Copy link
Owner

h4de5 commented Sep 10, 2024

in the logs its this on, right?

@tux1980
Copy link
Author

tux1980 commented Sep 10, 2024

Yes, it is on in the logs. It is weird nevertheless that a manual restart helps to activate the entities again but via an automation the integration didn't start up at all.....

@KaSroka
Copy link
Contributor

KaSroka commented Sep 10, 2024

I have created #203 that may fix the issue.

@tux1980
Copy link
Author

tux1980 commented Sep 11, 2024

Thanks for merging the Repos. I did the update today and will stay tuned - activated debugging too in the case anything goes south again.

That's the great thing with Open Source....:). If I would have the capabilities as developer, as you, I would contribute myself for sure.
So thanks again both of you!

@tux1980
Copy link
Author

tux1980 commented Sep 11, 2024

Hi. Just testet it and it seemed to working at least the entities are all there now - but now I get the message when e.g. starting cooling modus or something else:
The Action climate/set_hvac_mode could not be executed. Cannot execute method - Pipeline is not running
Screenshot from 2024-09-11 13-42-29
Same after restart of the Integration.

And the debug Log:
home-assistant_toshiba_ac_2024-09-11T11-41-35.108Z.log

Any Ideas are welcome

@tux1980
Copy link
Author

tux1980 commented Sep 15, 2024

Hello. I just flushed the pipeline yesterday and it worked.

But, unfortunately, the original error with the sas token stays with the new version. After couple of hours the entities are not available any longer and I have to restart my toshiba integration to make it work again.

@tux1980
Copy link
Author

tux1980 commented Sep 16, 2024

Hi, error stays.... :(. I will attach the debug protocol again. Any Idea?
home-assistant_toshiba_ac_2024-09-16T18-23-36.654Z.log

@KaSroka
Copy link
Contributor

KaSroka commented Sep 16, 2024

Other user reported that it is working with the fix. I can see that there is something wrong with your setup as it shouldn't take that long to setup the integration:

2024-09-15 15:00:14.094 WARNING (MainThread) [homeassistant.components.climate] Setup of climate platform toshiba_ac is taking over 10 seconds.
2024-09-15 15:00:14.094 WARNING (MainThread) [homeassistant.components.select] Setup of select platform toshiba_ac is taking over 10 seconds.
2024-09-15 15:00:14.095 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform toshiba_ac is taking over 10 seconds.
2024-09-15 15:00:14.095 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform toshiba_ac is taking over 10 seconds.
2024-09-15 15:01:03.789 ERROR (MainThread) [homeassistant.components.climate] Setup of platform toshiba_ac is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2024-09-15 15:01:03.792 ERROR (MainThread) [homeassistant.components.select] Setup of platform toshiba_ac is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2024-09-15 15:01:03.792 ERROR (MainThread) [homeassistant.components.sensor] Setup of platform toshiba_ac is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2024-09-15 15:01:03.793 ERROR (MainThread) [homeassistant.components.switch] Setup of platform toshiba_ac is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2024-09-15 15:01:36.514 ERROR (MainThread) [custom_components.toshiba_ac.climate] Error during connection to Toshiba server

The unloading you are doing is definitely hurting your setup, and I can see other integrations are also failing. Is your internet connection stable, many warnings are suggesting you have problem with connectivity?

Also, there is nothing regarding the SAS token in the attached log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants