Home/Support/Support Forum/Machine.WDT - trouble instantiating object w non-default response

Machine.WDT - trouble instantiating object w non-default response

+1 vote

I am playing with the WDT that was implement in *15 on an XBee3 Cat-m/NBIot unit. I am having trouble passing in the response parameter. I understand it should be instantiated like this:

wdt = machine.WDT(ID, timer duration, response)


ID = 0. Must be zero
timer duration = integer that defines the timer length. 2 mintues -> 120000
response = one of three options: SOFT_RESET, HARD_RESET, CLEAN_SHUTDOWN

I have my code set up like this:

wdt = machine.WDT(0, 120000, CLEAN_SHUTDOWN)

However PyCharm is not recognizing the CLEAN_SHUTDOWN parameter and throwing an error. I looked into the umachine file and found the definitions, but they appear to be pulled from somewhere else or are not defined. I did try a "0", "1", and "2" thinking they might be indexed from 0, but no luck. The compiler didn't throw an error and it built, but the code puked.

I might be doing something really dumb here...so I would appreciate any help. This is going to be a big help to have the watchdog. For now I am simply leaving the response parameter out and it's using the default which is a soft reset. This should work great for me, but I would like to do some testing with the others.

On a side thought, I could go into the library and re-default it to something else, but the programming gods will likely smite me for doing that.


EDIT: So it turns out I was doing something silly. I had to use the full class.variable format. So use the following:


If you are coding in PyCharm, it should start to autofill - then you know the variable is defined.
asked Apr 3, 2020 in XBee3 Cellular by Larry_Sellers New to the Community (10 points)

Please log in or register to answer this question.

2 Answers

+1 vote
Best answer

Glad to see you figured it out.

Digi Support
answered Apr 3, 2020 by mvut Veteran of the Digi Community (15,108 points)
selected Apr 3, 2020 by Larry_Sellers
0 votes

Thank you for adding the resolution to your post. I was struggling with the same issue and your "SOLVED" helped tremendously and got it working for me.

answered Jan 13, 2021 by backpacker87 Community Contributor (51 points)