Ankermgmt / ankermake-m5-protocol

Ankermake M5 protocol specifications and libraries *NOT AFFILIATED WITH ANKER*
GNU General Public License v3.0
165 stars 38 forks source link

[BUG]? Web Interface: [WinError 10049] The requested address is not valid in its context #140

Open BenBlake79 opened 10 months ago

BenBlake79 commented 10 months ago

Your issue may already be reported! Please search on the issue tracker before creating one.

Done

Describe the bug Webserver starts an can be connected to via browser (but not completely) Interface in browser only shows temperatures and remaining time and progression when printing, but no video (Loading, please wait...) Jobs can not be sent via PrusaSlicer (hangs at RESOLVING HOST when using localhost, COMPLETE with 127.0.0.1, but nothing happens)

in Python Window:

To Reproduce ankerctl was installed according to documentation "./ankerctl.py webserver run" didn't work in cmd (in File Directory) nor python runtime (./ for current dir?) "ankerctl.py webserver run" worked in cmd

What I Tried deactivated all firewalls restarted System

Expected behavior Video is shown in web interface gcode can be sent to printer PPPPService connected

Screenshots can be provided if needed

Desktop (please complete the following information):

Additional context Maybe there is something to be done or a setting to be changed whats not documented?

Thank You very much in advance ;)

billyjbryant commented 10 months ago

Is any other service accessing the Printer? Such as the AnkerMake phone app or the AnkerMake slicer?

treitmayr commented 9 months ago

It looks like the IP address of your printer ist not set in ankerctl's configuration. You can confirm that by typing python ankerctl.py config show

~As we just discussed this same issue on discord, it might be good if ankerctl had a way of finding or at least requesting that address.~ You could turn on you printer and figure out its IP address using python ankerctl.py pppp lan-search. Then you enter it manually in the default.json file, which should be located somewhere under %USERPROFILE%\AppData (sorry, did not use ankterctl on Windows yet).

treitmayr commented 9 months ago

I just opened PR #150 which will add the possibility to set and update the printer's IP address via CLI and web interface. This should make it easy to fix such issues (at least if the printer is indeed connected to the same network as ankerctl).

BenBlake79 commented 9 months ago

Thank You for your advices. I make do with ankermake studio atm and will make new attempts over the next two or so weeks. The printer is not in the same network as the computer as I do not really trust this thing securitywise and put it into a guest-WLAN. But as far as I understood, this shouldn't be the issue as this protocol uses the ankermake-WAN-connection, or isn't it?

treitmayr commented 9 months ago

My understanding is that the gcode is sent directly to the printer, not via the AnkerMake cloud service. At least that is my experience with a missing printer IP address vs. correct IP address, and it is consistent with the debug messages from ankerctl:

$ ./ankerctl.py -vvvv pppp print-file InsertTest_M3_0.2mm_PLA_M5-CE.gcode 
[D] Using printer [0]
[*] Trying connect to printer AnkerMake M5C (EUPRAKM-[XXXXXX]-LNCZN) over pppp using ip 192.168.1.72
[D] TX  --> PktLanSearch()
[D] Started pppp thread
[D] RX <--  PktPunchPkt(duid=Duid(prefix='EUPRAKM', serial=13657, check='LNCZN'))
[D] TX  --> PktClose()
[D] TX  --> PktP2pRdy(duid=Duid(prefix='EUPRAKM', serial=13657, check='LNCZN'))
[D] RX <--  PktP2pRdy(duid=Duid(prefix='EUPRAKM', serial=13657, check='LNCZN'))
[D] TX  --> PktP2pRdyAck(duid=Duid(prefix='EUPRAKM', serial=13657, check='LNCZN'), host=Host(afam=2, port=23048, addr='192.168.1.72'))
[D] RX <--  PktP2pRdy(duid=Duid(prefix='EUPRAKM', serial=13657, check='LNCZN'))
[D] TX  --> PktP2pRdyAck(duid=Duid(prefix='EUPRAKM', serial=13657, check='LNCZN'), host=Host(afam=2, port=23048, addr='192.168.1.72'))
[*] Established pppp connection
[D] RX <--  PktP2pRdy(duid=Duid(prefix='EUPRAKM', serial=13657, check='LNCZN'))
[D] TX  --> PktP2pRdyAck(duid=Duid(prefix='EUPRAKM', serial=13657, check='LNCZN'), host=Host(afam=2, port=23048, addr='192.168.1.72'))
[*] Going to upload 3081792 bytes as 'InsertTest_M3_0.2mm_PLA_M5-CE.gcode'
[*] Requesting file transfer..
[D] RX <--  PktP2pRdy(duid=Duid(prefix='EUPRAKM', serial=13657, check='LNCZN'))
[D] TX  --> PktP2pRdyAck(duid=Duid(prefix='EUPRAKM', serial=13657, check='LNCZN'), host=Host(afam=2, port=23048, addr='192.168.1.72'))
[D] TX  --> PktDrw(chan=0, index=0, data=b'XZYH\x98:\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00ed953070-9888-4d')
[D] RX <--  PktDrwAck(chan=0, count=1, acks=[0])
[*] Sending file metadata..
[D] RX <--  PktDrw(chan=0, index=0, data=b'XZYH\x98:$\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0
[D] TX  --> PktDrwAck(chan=0, count=1, acks=[0])
[D] TX  --> PktDrw(chan=1, index=0, data=b'\xaa\xbb\x00\x00\x00\x00\x00\x00\\\x00\x00\x000,InsertTest_M3_0.2mm_PLA_M5-CE.gcode,3081792,33064
[...]
BenBlake79 commented 7 months ago

I reinstalled completely and put both the printer and my pc into the same network and I've got the same issue. I found #146 and #149 and I also have no IP for the printer in the Ankermake M5 config - where does the Server get the IP from?

BenBlake79 commented 7 months ago

I now used treitmayr's https://github.com/treitmayr/ankermake-m5-protocol/tree/store-printer-ipaddress build and that worked. But I had to connect the printer to the main wlan - the guest wlan for printer and PC didn't work. I blocked Internet-conectivity for the printer and then MQTT didn't work. So ankerctl seems to use a lan-connection (for streaming and transfering files) and an internet-connection for the rest...

I do not like that an IoT-Device has to run in my local lan with open Internet-Connection - this just feels unsafe. Is there anywhere documented which ports ankerctl and the printer is using to block everything else?

And wouldn't it be a better solution to save the settings in an ini-file that is loaded by the server?