Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Home assistant integration #130

Open
cunninr2 opened this issue Sep 14, 2023 · 17 comments
Open

Home assistant integration #130

cunninr2 opened this issue Sep 14, 2023 · 17 comments
Labels
enhancement New feature or request

Comments

@cunninr2
Copy link

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

Describe the solution you'd like
Excellent work. I'm really interested in getting status monitoring of the Ankermake M5 into home assistant so I can monitor from afar and auto shutdown. Probably only needs a few status parameters such as printing, job completed, bed/nozzle temps. start/stop printing. The icing on the cake would be a camera feed for sure. keep up the good work.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@cunninr2 cunninr2 added the enhancement New feature or request label Sep 14, 2023
@BowlesCR
Copy link

Despite the title, #92 seems to be working in this same direction -- you may want to see about coordinating efforts.

@Phoenix-DH
Copy link

I would also be ninteressted in a HA integration.
Thanks ✌🏻

@JayRHa
Copy link

JayRHa commented Jun 23, 2024

Please work on this#

@sondregronas
Copy link

Hi - I've been working on a Home Assistant integration that seems to have now reached a usable stage, which is available here: https://github.com/sondregronas/ankermake-hass-component and can be installed via hacs.

Note: I've only tested with ankerctl in the v1.1 branch, and I'm not sure how stable it is yet as finding errors or debugging takes a lot of time

I'm also open to moving said integration over to the Ankermgmt organization if it's of any interest. (Ankermgmt/ankermgmt-hassio-addons#5)

@Phoenix-DH
Copy link

Phoenix-DH commented Jul 7, 2024

Hey,
this sounds great! Thanks.
Does that mean that in addition to your hacs also an ankerctl instance must be running? Anything else needrd on HA? MQTT Broker?

But where to find ankerctl for HA? Am I blind?

Thanks

Addon found 👍🏻

@sondregronas
Copy link

You just need an instance of ankerctl running, yes. Once you've installed via HACS / imported to custom_components you should find it under "Add Integration" in the Devices & Services dashboard. There's no need for an MQTT broker or any other dependencies as it uses ankerctl's own provided webserver (/ws/mqtt endpoint)

image

@Phoenix-DH
Copy link

Thanks!
Just added your repo to HACS and the Addon to HA.
Will try next time when I use the printer.

Thanks.

@Phoenix-DH
Copy link

Is the current way to install home assistant addon.
Afterwards install ankerctl on your pc to generste login.json.
Import login.json on the home assistant ankerctl webpage?

@sondregronas
Copy link

sondregronas commented Jul 10, 2024

You need ankerctl running, I use this fork in docker for the time being: https://github.com/sondregronas/ankermake-m5-protocol/tree/patch-exiles-1.1-auto-restart-on-failure, but I presume the home assistant version should work.

The integration only needs the URL of an ankerctl instance, it doesn't matter if its running via home assistant or not.

EDIT: This docker-compose.yml file should work with my changes, though there's not much deviation from this default branch for the integration if you don't use go2rtc for the camera

services:
    ankerctl:
        container_name: ankerctl
        restart: unless-stopped
        build: 
          context: https://github.com/sondregronas/ankermake-m5-protocol.git#patch-exiles-1.1-auto-restart-on-failure
        privileged: true
        # host-mode networking is required for pppp communication with the
        # printer, since it is an asymmetrical udp protocol.
        network_mode: host
        environment:
            - FLASK_HOST=0.0.0.0
            - FLASK_PORT=4470
        volumes:
            - ankerctl_vol:/root/.config/ankerctl
            - ./ankermake-m5-protocol/web/:/app/web

    # This container will restart the ankerctl container every 2 hours
    # as a temporary workaround for some socket issues.
    ankerctl_restarter:
      image: docker
      volumes: ["/var/run/docker.sock:/var/run/docker.sock"]
      # 2 hours = 7200 seconds
      command: ["/bin/sh", "-c", "while true; do sleep 7200; docker restart ankerctl; done"]
      restart: unless-stopped
volumes:
    ankerctl_vol:

@Phoenix-DH
Copy link

Sure, but i do not want to run something in parallel.
I think I found in one orher thread maybe a solution:
#161

@sondregronas
Copy link

@Phoenix-DH

https://github.com/sondregronas/ankermgmt-hassio-addons - try replacing the main addon with this (remove the old repo from AddOn repos & replace with the new one - works for me 😄 (<hass-ip>:4470, ingress does not work on mine either)

This is the same Dockerfile as in my fork - which has the same changes as the fork/pr you linked, though it is not a long term solution. Once merged I'll most likely remove it.. (or just update it to the main repo's latest release)

I'd recommend creating an automation to restart the AddOn every 2 hours, if you want a reliable videostream.

@Phoenix-DH
Copy link

Phoenix-DH commented Jul 10, 2024

Thanks!
Will try next days. I have only a M5C without video.

Edit:
Replaced quickly the add-on, but it won‘t start:
W] No printers found in config. Please upload configuration using the webserver or 'ankerctl.py config import' [!] Printer number 0 out of range, max printer number is -1 [*] ServiceManager: Shutdown complete [W] No printers found in config. Please upload configuration using the webserver or 'ankerctl.py config import' [!] Printer number 0 out of range, max printer number is -1 [*] ServiceManager: Shutdown complete [W] No printers found in config. Please upload configuration using the webserver or 'ankerctl.py config import' [!] Printer number 0 out of range, max printer number is -1 [*] ServiceManager: Shutdown complete

Do I miss somerhing in addition?

@sondregronas
Copy link

I'll have a fix out in a couple minutes - good catch, this must've been an oversight in one of the other PRs :)

Go to AddOns and hit Check for Updates then rebuild the container in ~30 minutes

@Phoenix-DH
Copy link

Hey, will try it tomorrow! Thanks!

@sondregronas
Copy link

sondregronas commented Jul 10, 2024

Should be working now in a couple minutes (requires a rebuild of the addon) - I'm not 100% certain the M5C is supported, from what I can tell it should?

EDIT: I've tried to log off and log back in again via the addon - everything seems to be working fine on the M5 at least 😄

If there's any issues with the component please move the convo over here: https://github.com/sondregronas/ankermake-hass-component/issues - I won't be able to work on this again until a couple weeks from now, but as far as I can tell we're stable-ish.

@Phoenix-DH
Copy link

Thanks!
I installed the latest and there is a login windows.
Will do the rest of testing today.

@Phoenix-DH
Copy link

Login worked, will install the plugin.
Also the upgrade to v1.0.2. of the addon was working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants