kalinrow / geckoclient

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

Client.py is not working #4

Closed Zippochonda closed 1 year ago

Zippochonda commented 1 year ago

Hi there,

I tried to gain a rebuilded connection to the Spa. The Gecko Lib is working flawless if i start it via Python3. I can control everything Lights, Blower and Temp.

If I start the gecko Service via python3 /opt/geckoclient/client.py i get an error

Traceback (most recent call last):
  File "/opt/geckoclient/client.py", line 175, 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 128, in main
    logger.info("Spa Name       : " + spaman.facade.spa.descriptor.name)
AttributeError: 'NoneType' object has no attribute 'spa'

The log is logging: 2023-01-06 11:57:28,341 - mqtt - INFO - MQTT successfully connected to broker 192.168.178.50 2023-01-06 11:57:38,354 - mqtt - INFO - Subscribing to whirlpool/water_heater/cmnd 2023-01-06 11:57:38,358 - mqtt - INFO - Subscribing to whirlpool/lights/cmnd 2023-01-06 11:57:38,360 - mqtt - INFO - Subscribing to whirlpool/pumps/cmnd 2023-01-06 11:57:38,362 - mqtt - INFO - Subscribing to whirlpool/blowers/cmnd 2023-01-06 11:57:38,364 - mqtt - INFO - Subscribing to whirlpool/water_care/cmnd 2023-01-06 11:57:38,367 - mqtt - INFO - Subscribing to whirlpool/control/cmnd 2023-01-06 11:57:38,369 - geckoclient - INFO - GeckoClient starting... 2023-01-06 11:57:38,370 - geckoclient - INFO - GC Version : 0.5.2

kalinrow commented 1 year ago

Hello, I understand correctly, that using the gecko lib from gazoodle works correctly and you have issue with my client? The error occurs when the SPA can't be connected in the beginning. In the next version the program will end with an error message. The problem is most like in the configuration file. Please check if the SPA_NAME and the SPA_IDENTIFIER are set correctly. For the identifier please ensure, that you use lowercase characters. If all is correct and you still have issues, you can try to provide the IP address. If the SPA and the server are on different networks, that is even mandatory. Can you please post the content of your config.py. You can sightly change the name, IP and identifier, if you like.

Zippochonda commented 1 year ago

Yes, that was the problem. Changed the SPA_IDENTIFIER and now is it working. Thank you! Issue is solved.

thomasklein1975 commented 1 year ago

maybe i can hijack, because i have similar issue:

`pi@raspberrypi-iob:/opt/geckoclient $ sudo systemctl start gecko.service pi@raspberrypi-iob:/opt/geckoclient $ sudo systemctl status gecko.service ● gecko.service - Gecko client service Loaded: loaded (/etc/systemd/system/gecko.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Fri 2023-01-13 12:04:19 CET; 4s ago Process: 6339 ExecStart=/usr/bin/python3 /opt/geckoclient/client.py (code=exited, status=1/FAILURE) Main PID: 6339 (code=exited, status=1/FAILURE)

Jan 13 12:04:19 raspberrypi-iob systemd[1]: gecko.service: Service RestartSec=100ms expired, scheduling restart. Jan 13 12:04:19 raspberrypi-iob systemd[1]: gecko.service: Scheduled restart job, restart counter is at 5. Jan 13 12:04:19 raspberrypi-iob systemd[1]: Stopped Gecko client service. Jan 13 12:04:19 raspberrypi-iob systemd[1]: gecko.service: Start request repeated too quickly. Jan 13 12:04:19 raspberrypi-iob systemd[1]: gecko.service: Failed with result 'exit-code'. Jan 13 12:04:19 raspberrypi-iob systemd[1]: Failed to start Gecko client service. pi@raspberrypi-iob:/opt/geckoclient $ python3.10 client.py Traceback (most recent call last): File "/opt/geckoclient/client.py", line 175, in asyncio.run(main()) File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/opt/geckoclient/client.py", line 128, in main logger.info("Spa Name : " + spaman.facade.spa.descriptor.name) AttributeError: 'NoneType' object has no attribute 'spa' ` here is my config: grafik I tried it with "SPAae..." too.

Ther is no log in /var/log

Zippochonda commented 1 year ago

Could it be that there is a digit to much in your Identifer? I thing it's SPAxx:xx:xx:xx... in your Case you have SPAxxx:xx:xx:xx...

thomasklein1975 commented 1 year ago

ist relate to # it think `SPA_NAME = "wellness"

SPA_IDENTIFIER = "SPAAE8:EB:1B:1C:5E:46"

SPA_IDENTIFIER = "SPAae8:eb:1b:1c:5e:46" SPA_IP_ADDRESS = "192.168.0.167" # either the IP address or DHCP in case of dynamic assignment `

meanwhile this is working: `pi@raspberrypi-iob:/opt/geckoclient $ python3.10 Python 3.10.9 (main, Jan 7 2023, 17:15:23) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.

from geckolib import GeckoShell GeckoShell.run()

    <Disclaimer>
    ----------------------------- USE AT YOUR OWN RISK -----------------------------

    This code will allow you to make changes to your spa configuration that is
    outside of what the app, top panel and side panel settings allow. I've not
    tested every setting and it might be that you prevent your spa pack from
    operating as it used to do.

    I strongly suggest dumping the configuration values with the "config" command
    and recording them somewhere safe.

    </Disclaimer>

Starting discovery process...Found 1 spas Connecting to spa Wellness at 192.168.0.167 ... connected! Heater: Temperature 37.5°C, SetPoint 37.5°C, Real SetPoint 37.5°C, Operation Idle Pump 2: OFF Pump 1: OFF Waterfall: OFF Lights: OFF WaterCare: Waiting... Smart Winter Mode:Risk: NO Circulating Pump: OFF Ozone: OFF Smart Winter Mode:Active: False Filter Status:Clean: False Filter Status:Purge: False Economy Mode: False Welcome to the Gecko shell. Type help or ? to list commands. `

thomasklein1975 commented 1 year ago

update:

should it look like that? `pi@raspberrypi-iob:/opt/geckoclient $ python3.10 client.py

WaterCare: Standard< changed from None to 1 Reminders: [<geckolib.automation.reminders.GeckoReminders.Reminder object at 0xb5b02520>, <geckolib.automation.reminders.GeckoReminders.Reminder object at 0xb5b02568>, <geckolib.automation.reminders.GeckoReminders.Reminder object at 0xb5b02598>, <geckolib.automation.reminders.GeckoReminders.Reminder object at 0xb5b025c8>]< changed from None to None `

Zippochonda commented 1 year ago

yes

thomasklein1975 commented 1 year ago

great -)

one step ahead now. now try to find issue in mqtt. data was send to serve once. no reation when sending commands

grafik

kalinrow commented 1 year ago

Hello Thomas, glad to see some progress. We will solve the last issues as well ;) For some improvements also for logging information, can you please update to the last version 0.5.3. Then please change DEBUG_LEVEL in the config.py from INFO to DEBUG. You can leave the GECKOLIB level at WARN. You will get more information that might help to find the problem.

thomasklein1975 commented 1 year ago

ok i will update