VRGhost / OctoPrint-PSUControl-Meross

Adds Meross Smart Plug support to OctoPrint-PSUControl
GNU Affero General Public License v3.0
4 stars 6 forks source link

Cannot connect to host 'iotx-eu.meross.com':443 ssl:default [Name or service not known] #19

Open jtenniswood opened 5 months ago

jtenniswood commented 5 months ago

When trying to login, I get this error... Cannot connect to host 'iotx-eu.meross.com':443 ssl:default [Name or service not known]

I'm pretty sure my login details are fine, I'm using a password manager and just copying the details across

newntech commented 5 months ago

Same for me. { "error": true, "rv": "Cannot connect to host 'iotx-eu.meross.com':443 ssl:default [Name or service not known]" }

jtenniswood commented 5 months ago

I gave up and used the home assistant add-on, but I already had HA setup, so was pretty simple

jeepinjason commented 5 months ago

Same issue here.

dogwoodfire commented 5 months ago

Same here as well/ Screenshot 2024-01-27 at 16 04 16

igox commented 5 months ago

Same here as well...

image

Note: When SSH-ing on the Octoprint host machine (Raspberry Pi 3B+):

❯ /home/pi/oprint/bin/python --version
Python 3.9.2
❯ host iotx-eu.meross.com
iotx-eu.meross.com has address 63.33.113.50
iotx-eu.meross.com has address 54.74.83.94
iotx-eu.meross.com has address 52.19.205.222
❯ dig iotx-eu.meross.com

; <<>> DiG 9.16.44-Raspbian <<>> iotx-eu.meross.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26158
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;iotx-eu.meross.com.        IN  A

;; ANSWER SECTION:
iotx-eu.meross.com. 20  IN  A   63.33.113.50
iotx-eu.meross.com. 20  IN  A   54.74.83.94
iotx-eu.meross.com. 20  IN  A   52.19.205.222

;; Query time: 29 msec
;; SERVER: 192.168.1.170#53(192.168.1.170)
;; WHEN: Mon Jan 29 09:38:06 CET 2024
;; MSG SIZE  rcvd: 95

I've got the same error whatever the zone I'm trying (AP, US, or EU).

jeloneal commented 5 months ago

Also experiencing this errors. I already contacted the person who provided the changes needed for the Meross API update. But so far no luck in fixing it. If anyone has a solution or idea, please feel free to create a PR.

matmat07 commented 2 months ago

Issue is still there today

milmber commented 2 months ago

Tried upgrading to the latest version of the meross-iot library using /home/pi/oprint/pip3 install meross-iot --upgrade but this has not resolved the issue.

There seems to be similar reports of this specific issue in the meross-iot project

What is interesting is that there is a warning from the meross-iot library regarding HTTPS. Not sure if this is relevant...

2024-05-05 14:28:31,269 - octoprint.plugins.psucontrol_meross.meross_client.async_client - INFO - Performing full auth login for the user 'REDACTED'.
2024-05-05 14:28:31,274 - meross_iot.http_api - WARNING - Missing HTTP/HTTPS schema from Base API url. Assuming it's HTTPS://...

I can see that the base_url is set without any https:// prefix here - https://github.com/VRGhost/OctoPrint-PSUControl-Meross/blob/3c7c543e40a45a52fdd50a170cfb86ccc8a948e7/src/octoprint_psucontrol_meross/plugin.py#L50

I have tried to update installed plugin to show the raw endpoint being called to further debug the issue here - https://github.com/VRGhost/OctoPrint-PSUControl-Meross/blob/3c7c543e40a45a52fdd50a170cfb86ccc8a948e7/src/octoprint_psucontrol_meross/meross_client.py#L126.

However it is not clear to me how to get the installed version of the library to pick up the manual updates. @luizbon , @VRGhost , @jeloneal - your plugin is great - hopefully this helps narrow down a fix for this issue?

milmber commented 2 months ago

Fix for this issue in this pull request - #20

WarrenSchultz commented 1 month ago

Fix for this issue in this pull request - #20

I tried your pull request, but it failed for me (as it did for the CI check). Did you get this working?

milmber commented 1 month ago

@WarrenSchultz , I manually copied the code over to my Pi with the fixes in plugin.py and meross_client.py

scp src/octoprint_psucontrol_meross/plugin.py pi@octopi.lan:/home/pi/oprint/lib/python3.9/site-packages/octoprint_psucontrol_meross/
scp src/octoprint_psucontrol_meross/meross_client.py pi@octopi.lan:/home/pi/oprint/lib/python3.9/site-packages/octoprint_psucontrol_meross/

Then logged into the pi...

ssh pi@octopi.lan

...deleted the python cache and restarted octoprint.

rm oprint/lib/python3.9/site-packages/octoprint_psucontrol_meross/__pycache__/*;
rm oprint/lib/python3.9/site-packages/octoprint_psucontrol_meross/;
systemctl stop octoprint.service;
systemctl start octoprint.service;

You may wish to enable debug logging for the meross and psu control plugins to figure out if anything is not working.

Screenshot 2024-06-08 at 11 54 04

Screenshot 2024-06-08 at 11 53 56

Then run the command below on the Pi to check for errors and see if the plugin is registered correctly and works as expected.

tail -f .octoprint/logs/octoprint.log | grep meross

I need to figure out how the tox test framework works (can't seem to get it to run on my local environment) to fix the CI failure.

It seems the test code asserts that the connection url passed into the login function will always return the login url passed as a parameter. This is no longer true as my fix prefixes https:// to the string which I believe is part of the reason why the plugin was not working in the first place.

tsfischer commented 2 weeks ago

Is this plugin dead? Is there not going to be a resolution for this issue?

It seems there's a fix above that was just needing a fixed UT. I added comments on this on the PR.

I'm not a python guy but I think it's a simple fix.

jeloneal commented 2 weeks ago

I will try to resolve the issue like you propose.

jeloneal commented 2 weeks ago

I got all test working and merged @milmber PR. Released everything as 0.13.4.

But when installed, it again throw that error

image

I have really no clue why it is still messing up the URLs. Any ideas?

Manually replacing the files seemed to work though, as @milmber advised.

tsfischer commented 1 week ago

Thanks for continuing to try this. I just tried the latest version and got that same error myself (before I saw you latest comment here).

What is the process for copying the files manually? I've never mucked with Octopi outside of the standard UI... (I'm fluent in pi/ssh/etc and a software developer though... just not in this domain)

Edit: Figured it out, but I'm still getting the error. More to come...

tsfischer commented 1 week ago

This is what I get in the octoprint.log. I think the fact that the URL is in [brackets] is significant, but I'm not sure where that's coming from.

2024-06-28 04:53:10,115 - octoprint.plugins.psucontrol_meross.meross_client.async_client - INFO - Performing full auth login for the user 'username@domain.com' against ['https://iotx-us.meross.com']. 2024-06-28 04:53:10,126 - meross_iot.http_api - WARNING - Missing HTTP/HTTPS schema from Base API url. Assuming it's HTTPS://...

tsfischer commented 1 week ago

I just confirmed that the value of api_base_url is indeed a list, not a string, as it comes into the login function. If I add the line:

api_base_url = api_base_url[0]

Then the entire plugin works.

I know this is just a band-aid and what we really want to do is find out why it's being passed in as a list. But it's midnight and I'm going to bed lol.

jeloneal commented 1 week ago

@tsfischer but if it is a list, will it not just pick the first item in the list? I would assume that it will not use the one you select in settings then.

And the tox test seems to have an issue with the list stuff. If you use it as a non list, the test passes but the plugin does not work 🤷 Maybe someone can help fixing that test?

tsfischer commented 1 week ago

No, it's picking the correct one from the list, but passing it into that function as a single-item list. That's why it's choking.

I haven't done any more looking into this since I was just happy to have it working for me again, but one of us or someone else eventually has to figure this out for real lol.

AmazeER commented 1 day ago

api_base_url = api_base_url[0]

where do i add this line in to fix this? ironically mine was working fine before you pushed this update

tsfischer commented 1 day ago

Whelp... it worked for a few days but now I'm getting this error (no code changes). Ironically when this happens, it makes my printer print like one command every 15-20 seconds until I disable the plugin.

Screenshot 2024-07-09 at 2 58 24 PM
AmazeER commented 1 day ago

@tsfischer I had to disable the plugin as well for the same reason, ive got the original error code from above where it displays two "https://" with the link itself being in the brackets