kalinrow / geckoclient

A gecko client to publich Gecko in.touch data on a broker
5 stars 4 forks source link

v0.51 / Error at startup + glitch in config.py_template #3

Closed sledge2019 closed 1 year ago

sledge2019 commented 1 year ago

Hi,

just migrated to the new version - here the things I found out:

  1. The provided config.py_template misses the lines for BACKUP_COUNT and GECKOLIB_DEBUG_LEVEL. It is described in the readme, but not in the template
  2. When starting client.py, I get the following error:

root@jarvis:/opt/geckoclient# python3 client.py Traceback (most recent call last): File "/opt/geckoclient/client.py", line 173, in <module> asyncio.run(main()) File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/opt/geckoclient/client.py", line 126, in main logger.info("Spa Name : " + spaman.facade.spa.descriptor.name) AttributeError: 'NoneType' object has no attribute 'spa'

Seems to me that (again?) my SPA is not found?

Happy for a push into the right direction ;-)

sledge2019 commented 1 year ago

Ok, one step further #blush#.

I entered the MAC-adress in SPA_IDENTIFIER in lowercase and the spa seems to become connected. I could even set the temperature, but then the follwing error came up:

root@jarvis:/opt/geckoclient# python3 ./client.py

WaterCare: Standard< changed from None to 1 Traceback (most recent call last): File "/opt/geckoclient/./client.py", line 174, in asyncio.run(main()) File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/opt/geckoclient/./client.py", line 147, in main if (refresh_counter > broker_int): TypeError: '>' not supported between instances of 'int' and 'str'`

From the logfile:

2022-12-31 12:32:49,105 - asyncio - DEBUG - Using selector: EpollSelector 2022-12-31 12:32:49,116 - mqtt - INFO - MQTT successfully connected to broker 192.168.0.22 2022-12-31 12:32:56,911 - mySpa - DEBUG - Refreshing blowers data 2022-12-31 12:32:56,912 - mySpa - DEBUG - Refreshing filter data 2022-12-31 12:32:56,912 - mySpa - DEBUG - Refreshing heater data 2022-12-31 12:32:56,912 - mySpa - DEBUG - Refreshing lights data 2022-12-31 12:32:56,912 - mySpa - DEBUG - Refreshing pumps data 2022-12-31 12:32:56,912 - mySpa - DEBUG - Refreshing reminder data 2022-12-31 12:32:56,913 - mySpa - DEBUG - No reminders received 2022-12-31 12:32:56,913 - mySpa - DEBUG - Refreshing water care data 2022-12-31 12:32:56,913 - mySpa - DEBUG - Refreshing filter data 2022-12-31 12:32:56,913 - mySpa - DEBUG - Refreshing filter data 2022-12-31 12:32:56,913 - mqtt - INFO - Subscribing to whirlpool/water_heater/cmnd 2022-12-31 12:32:57,048 - mqtt - INFO - Subscribing to whirlpool/lights/cmnd 2022-12-31 12:32:57,064 - mySpa - DEBUG - on_spa_change: >WaterCare: Standard< changed from None to 1 2022-12-31 12:32:57,065 - mySpa - DEBUG - Refreshing water care data 2022-12-31 12:32:57,102 - mqtt - INFO - Subscribing to whirlpool/pumps/cmnd 2022-12-31 12:32:57,106 - mqtt - INFO - Subscribing to whirlpool/blowers/cmnd 2022-12-31 12:32:57,110 - mqtt - INFO - Subscribing to whirlpool/water_care/cmnd 2022-12-31 12:32:57,115 - geckoclient - INFO - GeckoClient starting... 2022-12-31 12:32:57,115 - geckoclient - INFO - GC Version : 0.5.1 2022-12-31 12:32:57,115 - geckoclient - INFO - Spa Name : Unser Traum 2022-12-31 12:32:57,116 - geckoclient - INFO - Spa Version : 386 v2.0 2022-12-31 12:32:57,116 - geckoclient - INFO - Spa Revision : 33.00 2022-12-31 12:32:57,116 - geckoclient - INFO - Spa IP address : 192.168.0.159 2022-12-31 12:34:39,009 - mySpa - DEBUG - msg received: topic: whirlpool/water_heater/cmnd, payload: set_temp=37.0 2022-12-31 12:34:57,117 - mySpa - ERROR - Wrong temperature value received: 37.0

Nonetheless the temperature was set on the Spa correctly, then the script exited.

kalinrow commented 1 year ago

Hello, thanks for the hint of the missing config variables in the template file. The are now in there. Also fixed the exception issue. It was a stupid error, where I used quotes around a integer in the config.py. That's why the script stopped. It is not related to the set_temp command. Strangely for me it is the opposite. I get the same error using a comma as decimal separator. But in your case it seems to be a point. I assume that is due to different local setting. I have added a force to use point as decimal separator in the next version. So long you might add

    # force decimal separator to point
    locale._override_localeconv = {'decimal_point': '.'}
    locale._override_localeconv = {'thousands_sep': ','}

at line 85 in client.py. That should do the trick.

Best

sledge2019 commented 1 year ago

Yes and no ;-)

  1. To make "locale" work an "import locale" is required at the beginning of client.py
  2. After some moments after successfully starting python3 ./client.py all values are refreshed but

About 60-120 seconds later I receive the following error message:

root@jarvis:/opt/geckoclient# python3 ./client.py Traceback (most recent call last): File "/opt/geckoclient/./client.py", line 176, in asyncio.run(main()) File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/opt/geckoclient/./client.py", line 149, in main if (refresh_counter > broker_int): TypeError: '>' not supported between instances of 'int' and 'str'

Also I tried (during those 60-120 seconds) to set a parameter via MQTT - did not work.

EDIT: Update did work for the pool, but was not reflected in terms of message in the MQTT world (e.g. target temperature).

kalinrow commented 1 year ago

You are right, you also need to import local. That is part of the fix, but I forgot to mention it here. The problem with crash after 60-120 seconds is due to an error in the config.py file. Please remove the quotes from BROKER_INTERVAL value. Correct line should look like: BROKER_INTERVAL = 10

Did you update the original geckolib to overcome the 120 second refresh issue? See https://github.com/kalinrow/geckoclient#long-waiting-time-for-receiving-value-change-notification I did found a way to overwrite this value programmatically. I only use Phyon for this project because the geckolib is written in Phyton too.

sledge2019 commented 1 year ago

Short update: I provided the output of the locale command on my system.

root@jarvis:/opt/geckoclient# locale LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL=

sledge2019 commented 1 year ago

Stupid me. In config.py I defined BROKER_INTERVAL = "10" - therefor the comparison had to fail with a type mismatch. Argl.

Now everything seems to be running and also "reminders.*" receives updates...

Thanks again for supporting and for providing this nice piece of software.

sledge2019 commented 1 year ago

OK, we had some overlap here while i was writing my answers.

You are right, you also need to import local. That is part of the fix, but I forgot to mention it here. The problem with crash after 60-120 seconds is due to an error in the config.py file. Please remove the quotes from BROKER_INTERVAL value. Correct line should look like: BROKER_INTERVAL = 10

Done - as written above.

Did you update the original geckolib to overcome the 120 second refresh issue? See https://github.com/kalinrow/geckoclient#long-waiting-time-for-receiving-value-change-notification I did found a way to overwrite this value programmatically. I only use Phyon for this project because the geckolib is written in Phyton too.

Actually no. And I don't feel like there is a refresh issue.

The only thing that gets updated slower are the reminders, tbh (ever 120 secs). But that is totally ok for me and suitable to have it as a keepalive timer.