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

    notifications upon start/pause/finish of print

    Scheduled Pinned Locked Moved
    Third-party software
    18
    65
    6.3k
    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.
    • Nxt-1undefined
      Nxt-1 @Torin
      last edited by

      @torin I don't know if you planned on maintaining this app, but it sure would be nice if it received an update.
      I did some testing and got a contineous stream of JSON parse errors. After checking the sources it seems the program uses the GET /rr_status way of talking to the Duet. However, according to this page on the Duet Github, it is deprecated now.

      Should you decide to maintain it, I could make time to help out testing.

      -Nxt

      Duet3D and delta printer enthousiast. Buildlog
      Looking for Duet3D configuration support, check out Nxt-3D

      madeinta1wanundefined 1 Reply Last reply Reply Quote 1
      • madeinta1wanundefined
        madeinta1wan @Nxt-1
        last edited by

        @nxt-1 getting the similar errors via windows

        "2022/06/21 14:23:53 Error while downloading rr_status: Too many errors, resetting counters and stoping track operation. Will hide consequent errors..."

        Any chance there's a fix for this @Torin ?

        Thanks,

        Nate

        Torinundefined chrishammundefined 2 Replies Last reply Reply Quote 0
        • Torinundefined
          Torin @madeinta1wan
          last edited by

          @madeinta1wan This is due to API changes introduces in RRv3. There's a chance but it requires few hours of work which I currently do not have, however I will try to squeeze that in somehow. The code is opensource so if someone would make an PR I will happily merge it.

          1 Reply Last reply Reply Quote 0
          • chrishammundefined
            chrishamm administrators @madeinta1wan
            last edited by

            @madeinta1wan @madeinta1wan rr_status is still supported in standalone mode AFAIK. We will add a support layer for rr_ requests to SBC mode in v3.5 but I'm afraid it won't support rr_status. If possible, I'd strongly recommend upgrading to rr_model which returns portions of the object model.

            Duet software engineer

            Torinundefined 1 Reply Last reply Reply Quote 0
            • Torinundefined
              Torin @chrishamm
              last edited by

              So I finally found some time and resurfaced my duet enabled printer so I have started updating the app.... So hopefully soon there will be something to show 😉

              @chrishamm How do I currently identify finished print? Previously it was in rr_status marked as 'I'(capital I), now I can see see only in rr_model?key=state status: idle, pause, printing.

              chrishammundefined 1 Reply Last reply Reply Quote 1
              • chrishammundefined
                chrishamm administrators @Torin
                last edited by chrishamm

                @torin Those letters are abbreviations for the different machine states (see here), so idle is equal to I.

                Duet software engineer

                Torinundefined 1 Reply Last reply Reply Quote 0
                • Torinundefined
                  Torin @chrishamm
                  last edited by Torin

                  @chrishamm Many thanks for that, it definitely extends what I've seen.
                  However I am missing a 'final status' if that makes sense e.g. there's the status for cancelling yet there's no cancelled status or processing and no processed which makes it hard to understand and put the proper function in place to determine final status without hammering the API and making a request every let say 100ms which could still lead to some false positives.

                  stuartofmtundefined 1 Reply Last reply Reply Quote 0
                  • stuartofmtundefined
                    stuartofmt @Torin
                    last edited by stuartofmt

                    @torin

                    This may help. Its some of the logic in DuetLapse3. It ends up being a bit convoluted .... and of course I have a bunch of defensive coding in here (for other reasons).
                    The main logic starts at line 16.

                    Any yes - it can do with a bit of tidying up 😞

                    def captureLoop():  # Run as a thread
                    
                        global printState, duetStatus, captureLoopState
                        
                        if connectionState is False:
                            return
                        
                        captureLoopState = 1
                        printState = 'Not Capturing'
                    
                        lastDuetStatus = 'idle' # logical state on start of each thread instance
                    
                        logger.debug('Starting Capture Loop')
                    
                        while captureLoopState == 1:  # Set to 0 to stop. e.g  By http listener or SIGINT or CTL+C
                            if duetStatus != lastDuetStatus:  # What to do next?
                                logger.info('****** Duet status changed to: ' + str(duetStatus) + ' *****')
                                # logical states for printer are printing, completed
                                if duetStatus == 'idle' and printState in ['Capturing', 'Busy'] and terminateState != 1:  # Capturing is finished without being commanded
                                    printState = 'Completed'
                                    logger.debug('****** Print State changed to ' + printState + ' *****')
                                elif duetStatus in ['processing', 'idle'] or (duetStatus == 'paused' and detect == 'pause'):
                                    printState = 'Capturing'
                                    logger.debug('****** Print State changed to: ' + printState + ' *****')
                                elif duetStatus == 'busy':
                                    printState = 'Busy'
                                    logger.debug('****** Print State changed to: ' + printState + ' *****')
                                else:
                                    printState = 'Waiting'
                                logger.info('****** Print State changed to: ' + printState + ' *****')
                    
                            if printState == 'Capturing':
                                oneInterval('Camera1', camera1, weburl1, camparam1)
                                if camera2 != '':
                                    oneInterval('Camera2', camera2, weburl2, camparam2)
                                unPause()  # Nothing should be paused at this point
                            elif printState == 'Completed':
                                logger.info('Print Job Completed')
                                printState = 'Not Capturing'
                                # use a thread here as it will allow this thread to close.
                                startnextAction('completed')
                                break # Do not want to wait to end
                    
                            if captureLoopState == 1 and terminateState != 1 and connectionState:  # If still running then sleep
                                lastDuetStatus = duetStatus
                                time.sleep(poll)
                    
                        printState = 'Not Capturing'
                        captureLoopState = -1
                        return  # End of captureLoop
                    
                    
                    
                    Torinundefined 1 Reply Last reply Reply Quote 0
                    • Torinundefined
                      Torin @stuartofmt
                      last edited by Torin

                      Hey folks,
                      I want to share a download link with the version that should now work with v2 and v3 API.
                      If you could test it and let me know if it's all good that we'd be great and I will release it officially.

                      Only change you need to make is additional entry in your configuration file adding api_version in the connection section(v2 or v3) e.g.:

                      connection:
                        host: 192.168.0.11
                        polling_time: 30
                        error_count: 5
                        api_version: v3
                      

                      Without further ado:
                      https://1drv.ms/u/s!Aq3gq6mIQqpsisE-e3Adz3wsP6dAJw

                      Link is going to expire in 2 weeks, after that I will just merge it 🙂

                      stuartofmtundefined Nxt-1undefined 2 Replies Last reply Reply Quote 0
                      • stuartofmtundefined
                        stuartofmt @Torin
                        last edited by stuartofmt

                        @torin

                        Don't know if this is interesting for you but may avoid having the user input the version /model info. Its Python, but the logic will be the same.

                        def getDuetVersion(model):
                            # Used to get the API and version information from Duet
                        
                            if model == '' or model == 'rr_model':
                                    URL = ('http://' + duet + '/rr_model?key=boards')
                                    r = urlCall(URL, 3, False)
                                    if r.ok:   #The API type is rr_model
                                        try:
                                            j = json.loads(r.text)
                                            version = j['result'][0]['firmwareVersion']
                                            return 'rr_model', version
                                        except:
                                            pass
                        
                            if model == '' or model == 'SBC': 
                                    #  model = '/machine/status'
                                    URL = ('http://' + duet + '/machine/status')
                                    r = urlCall(URL, 3, False) 
                                    if r.ok:
                                        try:
                                            j = json.loads(r.text)
                                            version = j['boards'][0]['firmwareVersion']
                                            return 'SBC', version
                                        except:
                                            pass
                            
                        
                        Torinundefined 1 Reply Last reply Reply Quote 0
                        • Torinundefined
                          Torin @stuartofmt
                          last edited by

                          @stuartofmt Cool. I'll have a look tomorrow (that is if I will survive tomorrow heatwave...). Cheers buddy.

                          stuartofmtundefined 1 Reply Last reply Reply Quote 0
                          • stuartofmtundefined
                            stuartofmt @Torin
                            last edited by

                            @torin

                            Ha! - good day to be indoors and futzing with play code 🙂
                            Good Luck. BTW what programming language are you using?
                            Part of the reason I ask is that I also have some code for using gmail.

                            I don't actually use your program as I use DuetMonitor (which only supports gmail) - but it you wanted to extend your connection capabilities - I can sling it in your direction.
                            I

                            Torinundefined 1 Reply Last reply Reply Quote 0
                            • Torinundefined
                              Torin @stuartofmt
                              last edited by

                              @stuartofmt Ah that's quite cool. I've already put that in, however I stripped in my case and just checked for the appropriate content-type header on each URL, in both cases it should be app/json, otherwise it's just wrong.
                              I'm doing it all in golang, since it's quite nice for such nice things and portability and lack of dependencies.
                              I have notifications for any email service assuming it can do smtp so should in theory work everywhere. Can you point me to this duetmonitor? First time I'm hearing about this and haven't seen it.

                              If you want to poke around code and see what's there, that's the current that will go to master soon.
                              https://gitlab.com/Toriniasty/reprap_notify/-/tree/feature/apiV3/

                              stuartofmtundefined 1 Reply Last reply Reply Quote 0
                              • Nxt-1undefined
                                Nxt-1 @Torin
                                last edited by

                                @torin I tried the new version but could not get past identifying v2 of v3 firmware.

                                Printer is a Duet3 6HC in SBC mode, attached to a Jetson Nano (arm64). That name Nano also runs your project.

                                Top of rrnotity.yaml looks like this (dwc is running on port 8080)

                                connection:
                                  host: localhost:8080
                                  polling_time: 5
                                  error_count: 50
                                  api_version: v3
                                

                                Running the rr_notify results is this output:

                                2022/07/19 00:40:18 Detecting API version... 
                                2022/07/19 00:40:18 Couldn't identify v2 or v3 firmware
                                panic: Couldn't identify v2 or v3 firmware
                                
                                goroutine 1 [running]:
                                log.Panicf({0x463b71?, 0x454fd0?}, {0x0?, 0x1?, 0x400022a030?})
                                	/usr/local/go/src/log/log.go:392 +0x6c
                                main.main()
                                	/builds/Toriniasty/reprap_notify/cmd/rr_notify/main.go:71 +0x46c
                                

                                I am not sure how to proceed from here or how to debug. ¯_(ツ)_/¯

                                Duet3D and delta printer enthousiast. Buildlog
                                Looking for Duet3D configuration support, check out Nxt-3D

                                Torinundefined 1 Reply Last reply Reply Quote 0
                                • stuartofmtundefined
                                  stuartofmt @Torin
                                  last edited by

                                  @torin said in notifications upon start/pause/finish of print:
                                  Can you point me to this duetmonitor? First time I'm hearing about this and haven't seen it.

                                  Here is DuetMonitor
                                  https://forum.duet3d.com/topic/23282/duetmonitor

                                  1 Reply Last reply Reply Quote 0
                                  • Torinundefined
                                    Torin @Nxt-1
                                    last edited by

                                    @nxt-1 hiya, would you be able to provide me output from these two commands(run from the nano itself):

                                    curl -v http://localhost:8080/machine/system
                                    curl -v http://localhost:8080/rr_model?key=boards
                                    

                                    ?

                                    Nxt-1undefined 1 Reply Last reply Reply Quote 0
                                    • Nxt-1undefined
                                      Nxt-1 @Torin
                                      last edited by

                                      @torin They result in a 404 for both, though I would not be able to guess why since the base address does seem to be reachable, though understandably complaining about the lack of JS.

                                      curl -v http://localhost:8080/rr_model?key=boards
                                      *   Trying 127.0.0.1...
                                      * TCP_NODELAY set
                                      * Connected to localhost (127.0.0.1) port 8080 (#0)
                                      > GET /rr_model?key=boards HTTP/1.1
                                      > Host: localhost:8080
                                      > User-Agent: curl/7.58.0
                                      > Accept: */*
                                      > 
                                      < HTTP/1.1 404 Not Found
                                      < Content-Length: 0
                                      < Date: Tue, 19 Jul 2022 14:44:56 GMT
                                      < Server: Kestrel
                                      < 
                                      * Connection #0 to host localhost left intact
                                      
                                      curl -v http://localhost:8080
                                      * Rebuilt URL to: http://localhost:8080/
                                      *   Trying 127.0.0.1...
                                      * TCP_NODELAY set
                                      * Connected to localhost (127.0.0.1) port 8080 (#0)
                                      > GET / HTTP/1.1
                                      > Host: localhost:8080
                                      > User-Agent: curl/7.58.0
                                      > Accept: */*
                                      > 
                                      < HTTP/1.1 200 OK
                                      < Content-Length: 1441
                                      < Content-Type: text/html
                                      < Date: Tue, 19 Jul 2022 14:47:27 GMT
                                      < Server: Kestrel
                                      < Accept-Ranges: bytes
                                      < ETag: "1d8772d0a7368a1"
                                      < Last-Modified: Fri, 03 Jun 2022 09:33:54 GMT
                                      < 
                                      <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0"><!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]--><title>Duet Web Control</title><link href="/css/app.62f87138.css" rel="preload" as="style"><link href="/js/app.d9dc885b.js" rel="preload" as="script"><link href="/css/app.62f87138.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#2196f3"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><meta name="apple-mobile-web-app-title" content="Duet Web Control"><link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="/img/icons/safari-* Connection #0 to host localhost left intact
                                      pinned-tab.svg" color="#2196f3"><meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but Duet Web Control does not work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/app.d9dc885b.js"></script```

                                      Duet3D and delta printer enthousiast. Buildlog
                                      Looking for Duet3D configuration support, check out Nxt-3D

                                      Torinundefined 1 Reply Last reply Reply Quote 0
                                      • Torinundefined
                                        Torin @Nxt-1
                                        last edited by

                                        @nxt-1 Right, so the second paste is wrong and missing URI 🙂 and I had a thought as well, since there's '?' in URI bash might be screwing around with it try again with:

                                        curl -v http://localhost:8080/machine/system
                                        curl -v "http://localhost:8080/rr_model?key=boards"
                                        
                                        Nxt-1undefined 1 Reply Last reply Reply Quote 0
                                        • Nxt-1undefined
                                          Nxt-1 @Torin
                                          last edited by

                                          @torin said in notifications upon start/pause/finish of print:

                                          @nxt-1 Right, so the second paste is wrong and missing URI 🙂

                                          I did in fact ment to post it without URI, just to show that can I fact make a connection.

                                          Here's the two requests, as requested 🙂

                                          curl -v http://localhost:8080/machine/system
                                          *   Trying 127.0.0.1...
                                          * TCP_NODELAY set
                                          * Connected to localhost (127.0.0.1) port 8080 (#0)
                                          > GET /machine/system HTTP/1.1
                                          > Host: localhost:8080
                                          > User-Agent: curl/7.58.0
                                          > Accept: */*
                                          > 
                                          < HTTP/1.1 404 Not Found
                                          < Content-Length: 0
                                          < Date: Tue, 19 Jul 2022 15:39:09 GMT
                                          < Server: Kestrel
                                          < 
                                          * Connection #0 to host localhost left intact
                                          
                                          curl -v "http://localhost:8080/rr_model?key=boards"
                                          *   Trying 127.0.0.1...
                                          * TCP_NODELAY set
                                          * Connected to localhost (127.0.0.1) port 8080 (#0)
                                          > GET /rr_model?key=boards HTTP/1.1
                                          > Host: localhost:8080
                                          > User-Agent: curl/7.58.0
                                          > Accept: */*
                                          > 
                                          < HTTP/1.1 404 Not Found
                                          < Content-Length: 0
                                          < Date: Tue, 19 Jul 2022 15:39:18 GMT
                                          < Server: Kestrel
                                          < 
                                          * Connection #0 to host localhost left intact
                                          

                                          Duet3D and delta printer enthousiast. Buildlog
                                          Looking for Duet3D configuration support, check out Nxt-3D

                                          Torinundefined 1 Reply Last reply Reply Quote 0
                                          • Torinundefined
                                            Torin @Nxt-1
                                            last edited by

                                            @nxt-1 That's bit odd according to the previous post it should be either one of those two URLs.

                                            @stuartofmt / @chrishamm any idea why either doesn't work?

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