Home Assistant Integration
-
@Lyr3x I'm gettting an error when setting up the integration, could you help me out?
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? -
@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 -
@nikscha as Said before the config flow is not working. You need to configure it via the configuration.yaml at the moment
-
@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:
-
@nikscha oh the readme is still wrong. It is not
Job percentage
butProgress
-
@Lyr3x that did the trick, thanks!
The integration is working well, can I do anything to test it for you? -
@nikscha thanks will let you know! Of course if something is not working as intended donβt keep it to yourself.
-
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!
-
@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 -
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!
-
@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 hereI 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.
-
@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!
-
@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:
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 -
@nikscha Interesting. That is not what I see here
Did you remove the integration completely once?
Yeah, the checkbox is the check if you have a hotbed or not -
@Lyr3x Hmmmm
Not that I know of. Do you want me to test it? -
@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 -
@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 callingservice: 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.
-
@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. -
@Lyr3x Yeah that makes sense
-
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 nowKeep 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/issuesI am also more then happy to accept PRs