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

    Home Assistant Integration

    Scheduled Pinned Locked Moved
    Third-party software
    14
    47
    5.1k
    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.
    • 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
                  • nikschaundefined
                    nikscha @Lyr3x
                    last edited by

                    @Lyr3x Hmmmm πŸ€”
                    Not that I know of. Do you want me to test it?

                    Stay in school

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

                      @nikscha Yep do that, maybe there is something cached from previous iterations. I tried that for you on a fresh local installation. Labels are working as intended πŸ‘
                      There is also no delay here with M291 P"X" R"X" S3 or any other GCode. It's exactly the same as with DWC πŸ™‚

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

                        @Lyr3x That did the trick, the fields are now named.
                        The delay is still there tho.
                        Are you using a SBC?

                        Nvm I think I just communicated badly.
                        By "delay" I don't mean the time until the window pops up on DWC, but they time it takes HASS to aknowledge the service call. When calling

                        service: duet3d_printer.send_code
                        data:
                         gcode: M291 P"X" R"X" S3
                        

                        from the service tab in dev tools, it takes about 5-10 seconds for the 'call service' button to turn green. This isn't the case with other gcodes.

                        Stay in school

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

                          @nikscha said in Home Assistant Integration:

                          service: duet3d_printer.send_codedata: gcode: M291 P"X" R"X" S3

                          Ah gotcha. That is specific to the API call. It seems to be synchronous or it times out. If you press the OK button, the request is done. The integration does not validate the GCodes but just send them to the DSF API. If you make a similar call via curl you see the exact same behavior.

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

                            @Lyr3x Yeah that makes sense

                            Stay in school

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

                              Edit 4: With v0.1.1 standalone mode is fully supported and so are multiple tools. I also implemented proper setup to prevent duplicated integrations for the same board, so multiple integrations are support now as well.

                              Edit 3: We are on v0.0.5 now. Added experimental standalone mode. Can’t test it because I am only using SBC.

                              Edit 2: Released v0.0.2. All sensors are created properly and getting async status updates every 5 seconds. Ill follow up later to make the interval configurable and I also need to take another look at finishing up the setup when the printer becomes available later

                              Edit 1: Introduced a bug in the version so that the state is not always updated properly. Working on it πŸ™‚

                              Hey folks!
                              I refactored quite a lot and we now have a proper integration between the DSF and Home Assistant. When you create the integration via ConfigFlow you have some options you can choose from, including the option to add an LED controller, which is handy if you have LED's connected to your Duet.
                              The Device itself represents the physical Duet board and shows your correct model as well as the firmware version. All entities now have unique id's and should not conflict anymore. All sensors, binary sensors and the send_gcode service should work properly now πŸ™‚

                              Keep in mind that if you have the integration already installed, you need to remove the integration once more and install it again. That is necessary, because I have rewritten the way of how entities are registered in Home Assistant.

                              You'll find all infos here in the first release: https://github.com/Lyr3x/hass-Duet3D/releases/tag/v0.0.2
                              @dc42 it would be nice if we can upload the Duet3D logo here: https://github.com/home-assistant/brands/pulls - we can use the logo then with this integration.

                              I'll look for a better solution for the Position sensor soon.
                              If you find any issues are need additional sensors, please create a GitHub issue from now on:
                              https://github.com/Lyr3x/hass-Duet3D/issues

                              I am also more then happy to accept PRs

                              3a0ea8c3-07a4-4e96-bd4a-4e2ad40a1178-image.png

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

                                @Lyr3x Working well so far, many thanks for your efforts!! 😊 😊

                                Stay in school

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

                                  Thanks, @T3P3Tony, for the support with the Logos. The integration now appears with a proper icon and the logo!

                                  Unfortunately, I was forced to update the DOMAIN object one last time, which results in the situation where everyone needs to re-install the integration completely. Sorry for that! Will try to avoid future breaking changes πŸ™

                                  c4669ceb-2181-4557-8e55-eae11c05e026-image.png

                                  2916cd39-2ab1-4742-89c6-307609a7c92a-image.png

                                  deckingmanundefined 1 Reply Last reply Reply Quote 1
                                  • repier37undefined
                                    repier37
                                    last edited by

                                    Thanks @Lyr3x for your work.

                                    I have worked on porting the octoprint card to work with you integration.
                                    Anyone interested can check it out here : https://github.com/repier37/ha-duet-card/

                                    5d9798af-7207-4ffa-bb59-69428534e0dd-image.png

                                    It has not been tested much besides on my setup, so feel free to report any issues.
                                    btw, @Lyr3x to make your integration work on my setup I had to add authentication. check the pull request if you like to integrate it.

                                    1 Reply Last reply Reply Quote 2
                                    • deckingmanundefined
                                      deckingman @Lyr3x
                                      last edited by

                                      @Lyr3x Firstly, thanks for your work on this integration which I have now added to my HA instance. I've also just added an ESP32 based "node" to control things like LED lights as well as monitoring humidity and a few other things. I use ESP Home so it's nice that I can have these sensor as well as the sensors from your integration all showing up on the same card.

                                      Some LED strip lights that I have installed will illuminate the lower part of my printer (Z travel is circa 600 mm). So what I'd like to do is set up an automation that will turn these lights on when the Z position is greater than (say) 200mm. What I'm unsure of is how to "extract" the Z position from the sensor.duet3d_position_x_y_z. I note that the state of this entity is in the format [n,n,n]. I can use entity state as a trigger for the automation but how would deal with the fact that it's the third value that I'm interested and the first two values are to be ignored? I've never had an entity with multiple state values so don't know how to deal with it.

                                      Ian
                                      https://somei3deas.wordpress.com/
                                      https://www.youtube.com/@deckingman

                                      1 Reply Last reply Reply Quote 0
                                      • deckingmanundefined
                                        deckingman
                                        last edited by

                                        @Lyr3x Further to the above, I've found a "hack" that'll do for now but I'm sure there must be a more elegant solution. My hack is to create a template sensor to "extract" the Z position as follows.......

                                        - platform: template
                                          sensors:
                                            zpos:
                                              friendly_name: "Zpos"
                                              unit_of_measurement: "mm"
                                              value_template: "{{states('sensor.duet3d_position_x_y_z') .split(',')[2].strip(']') |int}}" 
                                        

                                        It isn't pretty but it works and will do the job for now. I can use this new "zpos" sensor in my automation to turn on certain lights when the bed is at 200mm or more below the nozzle (and turn them off again if it's above).

                                        Ian
                                        https://somei3deas.wordpress.com/
                                        https://www.youtube.com/@deckingman

                                        1 Reply Last reply Reply Quote 0
                                        • deckingmanundefined deckingman referenced this topic
                                        • First post
                                          Last post
                                        Unless otherwise noted, all forum content is licensed under CC-BY-SA