Duet3D Logo

    Duet3D

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Documentation
    • Order
    1. Home
    2. hauschka
    • Profile
    • Following 0
    • Followers 0
    • Topics 10
    • Posts 38
    • Best 3
    • Controversial 0
    • Groups 0

    hauschka

    @hauschka

    3
    Reputation
    8
    Profile views
    38
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    hauschka Unfollow Follow

    Best posts made by hauschka

    • Integrate web app features in Cura

      Hi,

      I am interested in integrating the Duet's status in Cura's monitor tab.
      I'm looking at exposing most of the functions from the DWC to Cura.

      What I got so far is that DWC sends HTTP GET and POST requests to ReprapFirmware and diplays it through a web interface.

      Efficiency-wise it probably wouldn't make much sense to scrape the values from the interface and display them in Cura, but rather query them the same way the web interface does it.

      So far, DWC's list of HTTP requests lists the requests currently used by the web interface, so I wanted to know whether there is a list of ALL requests that the RRfirmware supports? I found this list, but is this all?

      Also, do I need to constantly re-load/"re-poll" frequently changing values, such as eg the extruder tempt? Or is there an easier way of keeping the displayed values up-to-date?

      Thanks for all the input,
      -h

      posted in Duet Web Control wishlist
      hauschka
      hauschka
    • Log sensor data in "real-time".

      Hi community,

      I'm looking to log data from a sensor that is connected to a duet board into a file and time-stamp it.
      Upon processing that data, the program should adjust printing parameters mid-print.

      My aim is to get everything done via dsf-python.

      I found this example for how to subscribe to the objetc model: https://github.com/Duet3D/dsf-python/blob/main/examples/subscribe_object_model.py

      • Is there a way to subscribe only to a single sensor value?
      • Is there a way to actively poll every eg 250 ms, or do I have to wait to be updated?
      • Is there a way to always run this script in the background when a print is executed, or do I always need to manually start it (or start the script via a custom M code?)
      • Are there more examples online of custom py-dsf scripts?

      Pointers into any direction are greatly appreciated.
      Thank you!

      posted in DSF Development
      hauschka
      hauschka
    • RE: Log sensor data in "real-time".

      Thanks @chrishamm, appreciate your reply. Super useful, as always!

      @Falcounet thanks, looking forward to hearing from you.

      I'll give this a go in the next week and will reply back!

      posted in DSF Development
      hauschka
      hauschka

    Latest posts made by hauschka

    • RE: CORS policy: No 'Access-Control-Allow-Origin'

      @dainon
      Thanks for the write-up, that's an interesting solution.
      Can you tell me how exactly a reverse proxy circumvents the CORS issue?
      How exactly does the relaying part work?

      At the moment, our website is hosted on a domain, in our case with an ingress tunnel from cloudflare.

      The thing is.... I'm not even sure what is causing the CORS, as I AM connecting to the device from the same location (ie origin) after reset.
      I'm trying to understand where the error stems from and how your implementation is different? 🤔

      @chrishamm is there a way to completely disable CORS on the RPi, without gcode? Is it possible to change in the server code?
      There used to be a way to hard-code it by editing UseCors in /opt/dsf/conf/http.json from false to true.
      I also tried that to no avail.
      Is there a different way to change the server headers?

      On a related basis, where do I find the logs of these CORS events server-side?
      Perhaps this can help debugging the issue further?

      Thank you everyone for the feedback!
      Best,
      -h

      posted in Duet Web Control
      hauschka
      hauschka
    • RE: CORS policy: No 'Access-Control-Allow-Origin'

      @chrishamm
      thanks chris for linking the docs, I must have missed them.

      I can now disconnect and connect to previous sessions by storing the sessionkey.

      However, as soon as I reset the printer (M112, M999) and I try to reconnect to the websocket again, I get a CORS error

      The config.g, as well as the dsf-config.g both have M586 C"*" as the first line.

      Funnily enough, if I'm fast enough, right after hitting reset, I disconnect and re-connect directly, then I can re-initiate the websocket, but not send any commands, as all GET requests result in a CORS error!

      45d625a9-e124-4a57-802e-557646840e8b-grafik.png

      Is there a different way of disabling the CORS headers?
      Or a different way of dealing with this kind of behaviour?
      I spent the past 10 hours trying to circumvent this problem to no avail.

      posted in Duet Web Control
      hauschka
      hauschka
    • RE: CORS policy: No 'Access-Control-Allow-Origin'

      @DDD

      Hi,

      I'm running into the same error with a custom web-based app to control my printer.
      I initiate the connection through the websocket and it works.
      Whenever I send reset (M112 + M999), the webapp cannot initiate the connection anymore, giving me a network error.

      Is there a description somewhere on how the traffic to the websocket must be structured?

      I checked the implementation on the Duet side: https://github.com/Duet3D/DuetWebControl/blob/e9c241a72a68c425d0983b4b819e480817f4871e/src/store/machine/connector/RestConnector.js

      Do you need to store a sessionkey? when does it refresh? do you need to send it in the header?
      could that be the reason you are getting a CORS message?

      @chrishamm could you please shine some line on the required communication logic for the Duet websocket to reconnect after reset? How is this solved on the DWC?
      (or does it not trigger CORS because it's the same host?)
      I already set UseCorse to false in the config file and set M586 C"*" .

      What am I missing?
      Any help is appreciated.

      posted in Duet Web Control
      hauschka
      hauschka
    • RE: Log sensor data in "real-time".

      Thanks @Falcounet
      I somehow missed your message.

      For now, I worked around it by querying a specific variable using the M409 command, which is not the most elegant way of doing it. I'll give your new solution a go right away.
      Thanks for updating it!

      posted in DSF Development
      hauschka
      hauschka
    • RE: Log sensor data in "real-time".

      Hi,

      That's great to hear!
      Thank you so much for maintaining this library and finding fixes so fast! 😊
      I'm running them as root, as I was running into this error previously:

      Traceback (most recent call last):
            File "/home/pi/subscribe_object_model.py", line 11, in <module>
              from dsf.connections import CommandConnection
            File "/home/pi/.local/lib/python3.7/site-packages/dsf/__init__.py", line 2, in <module>
              import random_UA
          ModuleNotFoundError: No module named 'random_UA'
      

      I realized this issue was a privilege error that would disappear when using sudo.
      However, I think I'm introducing the error myself, as I'm coding the script via Remote VS code and the SSH FS extension to access the file system, which introduces certain quirks with privileges.

      Looking forward to receiving your fix 🙂
      Thanks again!

      posted in DSF Development
      hauschka
      hauschka
    • RE: Log sensor data in "real-time".

      I gave it a go, and got the send_simple_code.py to run.

      However, upon trying to execute subscribe_object_model.py, I'm getting the following error:

      Traceback (most recent call last):
        File "/home/pi/subscribe_object_model.py", line 31, in <module>
          subscribe()
        File "/home/pi/subscribe_object_model.py", line 18, in subscribe
          object_model = subscribe_connection.get_object_model()
        File "/usr/local/lib/python3.7/dist-packages/dsf/connections/subscribe_connection.py", line 35, in get_object_model
          object_model = self.receive(ObjectModel)
        File "/usr/local/lib/python3.7/dist-packages/dsf/connections/base_connection.py", line 78, in receive
          return cls.from_json(json.loads(json_string))
        File "/usr/local/lib/python3.7/dist-packages/dsf/object_model/model_object.py", line 65, in from_json
          return cls()._update_from_json(**preserve_builtin(data))
        File "/usr/local/lib/python3.7/dist-packages/dsf/object_model/object_model.py", line 164, in _update_from_json
          self._move = Move.from_json(kwargs.get('move'))
        File "/usr/local/lib/python3.7/dist-packages/dsf/object_model/model_object.py", line 65, in from_json
          return cls()._update_from_json(**preserve_builtin(data))
        File "/usr/local/lib/python3.7/dist-packages/dsf/object_model/move/move.py", line 186, in _update_from_json
          self._extruders = [Extruder.from_json(e) for e in kwargs.get('extruders', [])]
        File "/usr/local/lib/python3.7/dist-packages/dsf/object_model/move/move.py", line 186, in <listcomp>
          self._extruders = [Extruder.from_json(e) for e in kwargs.get('extruders', [])]
        File "/usr/local/lib/python3.7/dist-packages/dsf/object_model/model_object.py", line 65, in from_json
          return cls()._update_from_json(**preserve_builtin(data))
        File "/usr/local/lib/python3.7/dist-packages/dsf/object_model/move/extruder.py", line 174, in _update_from_json
          self._driver = DriverId(**preserve_builtin(driver)) if driver is not None else None
        File "/usr/local/lib/python3.7/dist-packages/dsf/utils.py", line 48, in preserve_builtin
          return {f"{k}_" if k in reserved_keys else k: v for k, v in data.items()}
      AttributeError: 'str' object has no attribute 'items'
      

      was that the error you referred to, @Falcounet , or is this a dfferent error, @Falcounet ?

      Steps to reproduce:

      • Install dsf-python: pip3 install dsf-python
      • Create py file
      • Execute py file: sudo /usr/bin/python3.7 /home/pi/subscribe_object_model.py
      posted in DSF Development
      hauschka
      hauschka
    • RE: Log sensor data in "real-time".

      Thanks @chrishamm, appreciate your reply. Super useful, as always!

      @Falcounet thanks, looking forward to hearing from you.

      I'll give this a go in the next week and will reply back!

      posted in DSF Development
      hauschka
      hauschka
    • Log sensor data in "real-time".

      Hi community,

      I'm looking to log data from a sensor that is connected to a duet board into a file and time-stamp it.
      Upon processing that data, the program should adjust printing parameters mid-print.

      My aim is to get everything done via dsf-python.

      I found this example for how to subscribe to the objetc model: https://github.com/Duet3D/dsf-python/blob/main/examples/subscribe_object_model.py

      • Is there a way to subscribe only to a single sensor value?
      • Is there a way to actively poll every eg 250 ms, or do I have to wait to be updated?
      • Is there a way to always run this script in the background when a print is executed, or do I always need to manually start it (or start the script via a custom M code?)
      • Are there more examples online of custom py-dsf scripts?

      Pointers into any direction are greatly appreciated.
      Thank you!

      posted in DSF Development
      hauschka
      hauschka
    • RE: Time/ Date setting

      This is the current firmware that's on the device:

      Board: Duet 3 MB6HC (MB6HC)
      DSF Version: 3.1.1
      Firmware: RepRapFirmware for Duet 3 MB6HC 3.1.1 (2020-05-19b2)

      I understand there are updates available, however we're aiming to keep this device at that firmware for compatibility with a deployed device

      Any ideas?

      posted in General Discussion
      hauschka
      hauschka
    • Time/ Date setting

      Hi,
      I'm using the Duet3 in an SBC config.

      I'm trying to set the time/date, via the M905 command.
      when querying the printer about the time/date straight afterwards, it still thinks it's in 2020.

      Any ideas on how to solve this?

      d2cb1eb7-7b52-4f56-8cc7-a8d68733cb8c-grafik.png

      posted in General Discussion
      hauschka
      hauschka