Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Home Assistant Integration

    Scheduled Pinned Locked Moved
    Third-party software
    14
    47
    5.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Reineundefined
      Reine @Reine
      last edited by Reine

      02581343-2f00-4986-ad1b-0e73c218f094-image.png

      Seams like rr_status has been deprecated in v3.4.5, http://10.0.0.68/machine/Status works though so for this to work with the current version of RRF some work needs to be done on this integration. unfortunately I'm not a Python dev.

      Btw, is there a websocket or webhooks that can be used or can we only rely on polling updates?

      Lyr3xundefined 1 Reply Last reply Reply Quote 0
      • Lyr3xundefined
        Lyr3x @Reine
        last edited by Lyr3x

        Hey folks,
        i picked this topic up yesterday and refactored the integration to make it work again with the new /machine/status endpoint.
        https://github.com/Lyr3x/hass-Duet3D

        Not happy yet with the position entity and the fact that there is no proper config flow and entities are not attached to a device. I will work on that in the next days. Might take some time as I need to dig into that to understand how custom components are built and what the spaghetti code in the integration is doing πŸ˜„
        I removed the job percentage yesterday temporarily to get this out of my way, because there is not such attribute, but I already spotted that it can be easily calculated with the file size. Contributions are welcomed!

        I also removed the password property, as this is not needed for the endpoint. Furthermore, I might need to set up a proper session when the integration has maybe a service to send G/M codes as well. We'll see.

        Hope that it is of some help for you as well πŸ™‚

        nikschaundefined 1 Reply Last reply Reply Quote 2
        • izemanundefined
          izeman @pkos
          last edited by

          @pkos said in Home Assistant Integration:

          While waiting, you can easily use this:
          https://github.com/iz3man/duet3d/blob/main/duet3d.yaml

          Just add the lines to your configuration.yaml, modify for your printer and restart HA.

          LOL. Looking for a way to get MQTT running on Duet-Wifi board, find this thread, and then a link to MY github πŸ˜‰

          Btw: This is still using perfectly fine with the latest betafirmware

          f1141c7f-8cff-4f36-a8dd-d4c1d8f7f48b-image.png

          And I found this github for MQTT integration which gives basically the same info - but haven't tested yet, as I'm waiting for native MQTT support before I start ripping everything apart again.

          https://github.com/keyz182/DuetMQTT

          Marshalldogundefined Lyr3xundefined 2 Replies Last reply Reply Quote 2
          • nikschaundefined
            nikscha @Lyr3x
            last edited by

            @Lyr3x good work, wow! I'll check it out in the next few days!

            Stay in school

            1 Reply Last reply Reply Quote 0
            • Marshalldogundefined
              Marshalldog @izeman
              last edited by

              @izeman Looks Awesome
              how did you get the controls for PLA and that switch into HASS?

              1 Reply Last reply Reply Quote 0
              • Lyr3xundefined
                Lyr3x @izeman
                last edited by Lyr3x

                @izeman this is only working if you are not using SBC mode if I am not mistaken.

                I worked on updating the integration to work asynchronous without blocking requests, which is working fine now (still need to merge).
                There is quite some rework necessary to get config and options flow running, but I finally understood how the flows should be implemented. Can’t give a timeline yet though.

                Configuration via configuration.yaml is working fine including time elapsed and remaining. I also added the progress sensor back and calculating the progress via total layers and printed layers.

                nikschaundefined 1 Reply Last reply Reply Quote 0
                • nikschaundefined
                  nikscha @Lyr3x
                  last edited by

                  @Lyr3x I'm gettting an error when setting up the integration, could you help me out?
                  40394090-72d2-45c2-97a6-710b8684861c-image.png

                  I have two printers, one running Duet Wifi 2 without SBC (RRF 3.4.5), and one running a Duet 3 Mini5+ WITH SBC (RRF 3.5.0beta3).
                  However both gave the same error as above. Navigating to 'printerip'/maschine/status also returns the json, so I doubt the issue is related to the printers? What else can I try? It might be noteworty that I run HASS on Docker?

                  Stay in school

                  nikschaundefined 1 Reply Last reply Reply Quote 0
                  • nikschaundefined
                    nikscha @nikscha
                    last edited by

                    @nikscha
                    Here's the HASS log:

                    Logger: aiohttp.server
                    Source: data_entry_flow.py:387
                    First occurred: 15:43:51 (17 occurrences)
                    Last logged: 16:20:39
                    
                    Error handling request
                    Traceback (most recent call last):
                      File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
                        resp = await request_handler(request)
                      File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
                        resp = await handler(request)
                      File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
                        return await handler(request)
                      File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
                        return await handler(request)
                      File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
                        return await handler(request)
                      File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
                        return await handler(request)
                      File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 81, in ban_middleware
                        return await handler(request)
                      File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
                        return await handler(request)
                      File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
                        result = await result
                      File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 180, in post
                        return await super().post(request, flow_id)
                      File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 73, in wrapper
                        result = await method(view, request, data, *args, **kwargs)
                      File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
                        result = await self._flow_mgr.async_configure(flow_id, data)
                      File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 286, in async_configure
                        result = await self._async_handle_step(
                      File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 387, in _async_handle_step
                        if not isinstance(result["type"], FlowResultType):
                    TypeError: 'NoneType' object is not subscriptable
                    

                    Stay in school

                    Lyr3xundefined 1 Reply Last reply Reply Quote 0
                    • Lyr3xundefined
                      Lyr3x @nikscha
                      last edited by

                      @nikscha as Said before the config flow is not working. You need to configure it via the configuration.yaml at the moment

                      nikschaundefined 1 Reply Last reply Reply Quote 0
                      • nikschaundefined
                        nikscha @Lyr3x
                        last edited by

                        @Lyr3x Ohh I see. Fair enough. I'm still having problems though:
                        I added the follwoing to my config:

                        # Duet Integration
                        duet3d_printer:
                          host: !secret duet3d-host
                          name: !secret duet3d-name
                          number_of_tools: 1
                          bed: true
                          sensors:
                            monitored_conditions:
                              - 'Current State'
                              - 'Temperatures'
                              - 'Job Percentage'
                              - 'Time Elapsed'
                              - 'Time Remaining'
                              - 'Position'
                        

                        I also added the entries for host and name to the secrets.yaml.

                        However HASS wont restart:

                        dd77b111-7120-4fc0-88b5-67ac853b7039-image.png

                        Stay in school

                        Lyr3xundefined 1 Reply Last reply Reply Quote 0
                        • Lyr3xundefined
                          Lyr3x @nikscha
                          last edited by Lyr3x

                          @nikscha oh the readme is still wrong. It is not Job percentage but Progress

                          nikschaundefined 1 Reply Last reply Reply Quote 1
                          • nikschaundefined
                            nikscha @Lyr3x
                            last edited by

                            @Lyr3x that did the trick, thanks!
                            The integration is working well, can I do anything to test it for you?

                            Stay in school

                            Lyr3xundefined 2 Replies Last reply Reply Quote 0
                            • Lyr3xundefined
                              Lyr3x @nikscha
                              last edited by Lyr3x

                              @nikscha thanks πŸ™‚ will let you know! Of course if something is not working as intended don’t keep it to yourself.

                              1 Reply Last reply Reply Quote 0
                              • Lyr3xundefined
                                Lyr3x @nikscha
                                last edited by

                                Configflow is still giving me a headache. I need to refactor the code more to get this working properly.
                                But I added a home assistant service to send gcodes:

                                service: duet3d_printer.hevors_send_gcode
                                data:
                                  gcode: G28
                                

                                Feedback appreciated!

                                nikschaundefined 1 Reply Last reply Reply Quote 1
                                • nikschaundefined
                                  nikscha @Lyr3x
                                  last edited by

                                  @Lyr3x Hmm now it doesn't work anymore^^
                                  I updated the integration though HACS, and after a restart the integration was gone from the integration panel. Didn't make any other changes. How can I debug this? Logs are empty too πŸ˜•

                                  Stay in school

                                  Lyr3xundefined 1 Reply Last reply Reply Quote 0
                                  • Lyr3xundefined
                                    Lyr3x @nikscha
                                    last edited by Lyr3x

                                    Edit: Alright, I just released a new version of the integration. ConfigFlow is now working as well as the service. The binary sensor is still dead. You need to remove the configuration from your configuration.yaml and just setup the integration via UI. I unfortunately need to ask you to reconfigure the Integration later again, because I want to attach the entities to a device. But its in a working mode now! Please do not hesitate with feedback.

                                    @nikscha Yep realized that as well, sorry. I decided to stop trying to patch the stuff I want to remove anyway and fix the config flow setup and remove the configuration.yaml code completely. I already have a working unpolished state. Bear with me a little more. Ill update you all here later!

                                    nikschaundefined 1 Reply Last reply Reply Quote 1
                                    • nikschaundefined
                                      nikscha @Lyr3x
                                      last edited by

                                      @Lyr3x No worries! It's working now, config flow as well. I suggest naming the fields in the config flow. I tried doing this myself and creating a pull request but honestly I am just not that good at Python ^^
                                      I also tried making a textfield card to send typed Gcodes, but I also gave up and instead asked for help here

                                      I also tested some gcodes, most of them seem to work just fine but I noticed a strange delay when sending a M291 P"X" R"X" S3. This doesn't happen with S2, S1 or S0. Maybe this is intentional behaviour? Sending the same command from within DWC returns instantly though.

                                      Stay in school

                                      Lyr3xundefined 1 Reply Last reply Reply Quote 0
                                      • Lyr3xundefined
                                        Lyr3x @nikscha
                                        last edited by

                                        @nikscha what do you mean with naming the fields? They all have labels

                                        I’ll test the gcode tomorrow and see if I can find out what causes the delay!

                                        nikschaundefined 1 Reply Last reply Reply Quote 0
                                        • nikschaundefined
                                          nikscha @Lyr3x
                                          last edited by

                                          @Lyr3x The fields are prefilled, but it doesn't say what should be in there. This is what it looks like with the prefilled values removed: 4b9af3c0-5a02-49dc-b3d5-bad0a1dc0d38-image.png
                                          What does the checkbox do for example?
                                          Looking at the code I can figure out its the field "has_bed", and I think that should be mentioned in the config flow as well

                                          Stay in school

                                          Lyr3xundefined 1 Reply Last reply Reply Quote 0
                                          • Lyr3xundefined
                                            Lyr3x @nikscha
                                            last edited by Lyr3x

                                            @nikscha Interesting. That is not what I see here
                                            20f59511-1629-40a4-9ebc-e0bf90ab2cde-image.png
                                            Did you remove the integration completely once?
                                            Yeah, the checkbox is the check if you have a hotbed or not

                                            nikschaundefined 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA