www-ShapeLabs-de / Judo-i-soft-save-plus-to-mqtt-bridge

A small device to write and read settings to Judo i-soft safe+ water softening system with homeassistant
MIT License
20 stars 6 forks source link

Script error #10

Closed LineF closed 1 year ago

LineF commented 1 year ago

Hello,

very nice work! Didn't ever expect to get my isoft safe+ connected to HomeAssistant...

I installed it on AppDaemon on the HA instance as described, but I get errors:

2023-02-09 22:50:34.185511 INFO AppDaemon: Adding /config/appdaemon/apps to module import path 2023-02-09 22:50:34.185961 INFO AppDaemon: Adding /config/appdaemon/apps/main to module import path 2023-02-09 22:50:34.191977 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hello.py - ignoring 2023-02-09 22:50:34.193047 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/main/config_getjudo.py - ignoring 2023-02-09 22:50:34.194095 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/main/getjudo.py - ignoring 2023-02-09 22:50:34.195080 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/main/main_entity.py 2023-02-09 22:50:34.224711 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/main/messages_getjudo.py - ignoring 2023-02-09 22:50:34.225911 INFO AppDaemon: Initializing app main_app using class main_loop from module main_entity Verbunden mit MQTT Broker... Topics wurden abonniert... Autoconfigs wurden gesendet... Login erfolgreich, neuer Token: hahahahaha !!!!Achtung, Diesen Token nirgendwo Posten oder Verschicken. Hierdurch erhält man Vollzugriff auf die Anlage!!!! Lade gespeicherte Variablen

['Scriptfehler - Laden der Variablen aus Datei fehlgeschlagen in Zeile: 319', FileNotFoundError(2, 'No such file or directory')] Initialisierung erfolgreich! 2023-02-09 22:50:55.014569 WARNING AppDaemon: Suspect incorrect signature type for callback main() in main_app, should be f(self, kwargs) - discarding 2023-02-09 22:50:55.014943 WARNING main_app: ------------------------------------------------------------ 2023-02-09 22:50:55.015167 WARNING main_app: Unexpected error in worker for App main_app: 2023-02-09 22:50:55.015379 WARNING main_app: Worker Ags: {'id': 'hohohoho', 'name': 'main_app', 'objectid': 'hohohoho', 'type': 'scheduler', 'function': <function main at 0x7fac67da7a30>, 'pin_app': True, 'pin_thread': 0, 'kwargs': {'__thread_id': 'thread-0'}} 2023-02-09 22:50:55.015560 WARNING main_app: ------------------------------------------------------------ 2023-02-09 22:50:55.018149 WARNING main_app: Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/appdaemon/threading.py", line 904, in worker funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"])) TypeError: main() takes 0 positional arguments but 1 was given 2023-02-09 22:50:55.018458 WARNING main_app: ------------------------------------------------------------

Could you help, please?

Martin

LineF commented 1 year ago

Just tested latest version (commit 69b8ff) - same problem. Then I tried it directly within a debian installation - working. So it is probably a problem within AppDaemon in HAOS.

danielegger1 commented 1 year ago

Hi That error means that you did something wrong at copying steps It cannot find the temp file, did you copied all files into the "appdaemon/apps/main" folder? If not, you need to change the config file.

danielegger1 commented 1 year ago

Henning, can you upload the temp file from pickle to the python folder? That one is needed on AppDaemon, as it cannot be created automatically.

LineF commented 1 year ago

Yes, with "normal" linux I got at the first start, that the temp file is corrupted and would be recreated. With AppDaemon there was no such message. The file existed (zero bytes), but it wasn't touched in any way...

danielegger1 commented 1 year ago

Can you please sent a screenshot of your folder structure? I think there is something not ok

LineF commented 1 year ago

Hi, here are some screenshots of the filesystem structure and contents of files. I can't see any issues. With the latest version the temp file has been written, but still the same error:

image

image

image

image

image

Martin

danielegger1 commented 1 year ago

Interesting, I have an idea Can you change the AppDaemon config file to the following please?

init_commands: [] python_packages:

(Attention; the system_packages: should be in line with pyton_packages, but the comment shifts it for some reason) It seems the main_entity file is the issue

www-ShapeLabs-de commented 1 year ago

Hello everyone, I am working on a new commit, in which the structure of the temp file will also change. There will be more information stored in it, like the token and the serial etc.. The advantage of this is that the token can be used further and a new token is not generated every time the script is started. I don't know how the Judo server will react in the long run if new tokens are generated all the time. I will commit the script to the repo including a new temp_getjudo.pkl. So make sure that you also update the getjudo.py when you take over the temp-file.

LineF commented 1 year ago

Hi,

adbase loaded, but problem still exists:

image

image

image

Greetings, Martin

danielegger1 commented 1 year ago

I found the problem, please use the code from my repository and retry it

kwargs is essential

def loop(kwargs):

AND I had to change one line: response = http.request('GET',f"https://www.myjudo.eu/interface/?token={mydata.token}&group=register&command=get%20device%20data")

instead of

    response = http.request('GET',f"https://www.myjudo.eu/interface/?token={mydata[token]}&group=register&command=get%20device%20data")

I will create a Pull Request

danielegger1 commented 1 year ago

Small hint @www-ShapeLabs-de , if you start the app with an old temp file it crashes because of mydata discrepances

LineF commented 1 year ago

Hello @danielegger1, yust tried your commit (a35e94), but got following error now:

image

henning commented 1 year ago

what ?????

On Sun 12. Feb 2023 at 09:37, danielegger1 @.***> wrote:

I found the problem, please use the code from my repository and retry it

@henning https://github.com/henning, kwargs is essential

def loop(kwargs):

AND I had to change one line: response = http.request('GET',f" https://www.myjudo.eu/interface/?token={mydata.token}&group=register&command=get%20device%20data https://www.myjudo.eu/interface/?token=%7Bmydata.token%7D&group=register&command=get%20device%20data ")

instead of

response = http.request('GET',f"https://www.myjudo.eu/interface/?token={mydata[token]}&group=register&command=get%20device%20data <https://www.myjudo.eu/interface/?token=%7Bmydata[token]%7D&group=register&command=get%20device%20data>")

I will create a Pull Request

— Reply to this email directly, view it on GitHub https://github.com/www-ShapeLabs-de/Judo-i-soft-save-plus-to-mqtt-bridge/issues/10#issuecomment-1426972690, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAJ2UCMVLL5ZZL3567KPXTWXCONRANCNFSM6AAAAAAUXCPZBM . You are receiving this because you were mentioned.Message ID: <www-ShapeLabs-de/Judo-i-soft-save-plus-to-mqtt-bridge/issues/10/1426972690 @github.com>

-- Henning Sprang http://www.sprang.de

LineF commented 1 year ago

Sorry, I missed the change in config_getjudo.py. Now the code ist working in AppDaemon. Thanks! Great project! Martin

henning commented 1 year ago

why am i getting these emails? i am not involved in this project.

On Sun 12. Feb 2023 at 14:11, Martin Patzel @.***> wrote:

Sorry, I missed the change in config_getjudo.py. Now the code ist working in AppDaemon. Thanks! Great project! Martin

— Reply to this email directly, view it on GitHub https://github.com/www-ShapeLabs-de/Judo-i-soft-save-plus-to-mqtt-bridge/issues/10#issuecomment-1427029892, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAJ2UH5OLQ3C7LMYJGOMKLWXDOPRANCNFSM6AAAAAAUXCPZBM . You are receiving this because you were mentioned.Message ID: <www-ShapeLabs-de/Judo-i-soft-save-plus-to-mqtt-bridge/issues/10/1427029892 @github.com>

-- Henning Sprang http://www.sprang.de

www-ShapeLabs-de commented 1 year ago

why am i getting these emails? i am not involved in this project.

Hi Henning

I don't know, but you can unsubscribe ;-)

BR Henning

danielegger1 commented 1 year ago

ups,... sorry Henning that was my bad when using @ henning instead of the correct one

danielegger1 commented 1 year ago

Sorry, I missed the change in config_getjudo.py. Now the code ist working in AppDaemon. Thanks! Great project! Martin

that is great :) now just do a merge with the pull request and we should be good to close this issue

www-ShapeLabs-de commented 1 year ago

PR was merged :-)