@RickCarlino
-
bot.client.connected
is working. My problem was that I checked for those properties before I used bot.connect()
. I’m handling those cases now, doing .connect()
only when not already connected.
- When the token expires, how should I proceed? Should I create a new
Farmbot
object with the new token or is there a way to feed the new token to the existing instance?
- I’ve been able to move my physical FarmBot using Telegram!
I think the most useful feature of this idea is that FarmBot can inform you via IM rather than controlling it via IM.
So it’d be great if you have some detailed documentation regarding Farmbot
events.
I’m mostly interested in events about:
- Starting or stopping a sequence or regimen.
- Motor stalls.
- Disconnects.
I think I just need more verbosity in the logging. Perhaps you could make some logging levels that increase in verbosity, which others can use in their programming as required?
[details=Click to see my wall of text] (1) Starting sequence “Water The Carrots”.
(1) Executing sequence “Attach Watering Tool”. <-- called by parent sequence “Water The Carrots”
(1) Starting sequence “Attach Watering Tool”. <-- stepping into child sequence “Attach Watering Tool”
(2) Moving to 2532,1230,0.
(3) Homing Z-Axis.
(3) Relative move to 0,0,-230.
(3) Homed Z-Axis.
(2) Moving to 60,225,0.
(3) Absolute move to 60,225,0.
(2) Moving to 60,225,493.
(3) Relative move to 0,0,493.
(2) Moving to 85,225,493.
(3) Relative move to 25,0,0.
(2) Moving to 85,225,0.
(3) Homing Z-Axis.
(3) Relative move to 0,0,-493.
(3) Homed Z-Axis.
(1) Finished sequence “Attach Watering Tool”. <-- last event from child sequence
(1) Executed sequence “Attach Watering Tool”. <-- we’re back in parent sequence “Water The Carrots”
(1) Executing sequence “Water Carrot Row One”. <-- called by parent sequence “Water The Carrots”
(1) Starting sequence “Water Carrot Row One”. <-- stepping into child sequence “Water Carrot Row One”
(2) Moving to 200,200,0.
(3) Absolute move to 200,200,0.
(1) Executing sequence “Medium Water”. <-- called by parent sequence “Water Carrot Row One”
(1) Starting sequence “Medium Water”.
(2) Activating Peripheral “Solenoid Valve”.
(3) Writing Pin 9. Value is now 1.
(2) Waiting.
(3) Wait 2300 milliseconds.
(2) Deactivating Peripheral “Solenoid Valve”.
(3) Writing Pin 9. Value is now 0.
(1) Finished sequence “Medium Water”.
(1) Executed sequence “Medium Water”. <-- we’re back in parent sequence “Water Carrot Row One”
(2) Moving to 200,300,0.
(3) Absolute move to 200,300,0.
(1) Executing sequence “Medium Water”. <-- called by parent sequence “Water Carrot Row One”
(1) Starting sequence “Medium Water”.
(2) Activating Peripheral “Solenoid Valve”.
(3) Writing Pin 9. Value is now 1.
(2) Waiting.
(3) Wait 2300 milliseconds.
(2) Deactivating Peripheral “Solenoid Valve”.
(3) Writing Pin 9. Value is now 0.
(1) Finished sequence “Medium Water”.
(1) Executed sequence “Medium Water”. <-- we’re back in parent sequence “Water Carrot Row One”
(2) Moving to 200,400,0.
(3) Absolute move to 200,400,0.
(1) Executing sequence “Medium Water”. <-- called by parent sequence “Water Carrot Row One”
(1) Starting sequence “Medium Water”.
(2) Activating Peripheral “Solenoid Valve”.
(3) Writing Pin 9. Value is now 1.
(2) Waiting.
(3) Wait 2300 milliseconds.
(2) Deactivating Peripheral “Solenoid Valve”.
(3) Writing Pin 9. Value is now 0.
(1) Finished sequence “Medium Water”.
(1) Executed sequence “Medium Water”. <-- we’re back in parent sequence “Water Carrot Row One”
(1) Finished sequence “Water Carrot Row One”.
(1) Executed sequence “Water Carrot Row One”. <-- we’re back in parent sequence “Water The Carrots”
(1) Executing sequence “Water Carrot Row Two”.
[… same as above …]
(1) Executed sequence “Water Carrot Row Two”.
(1) Executing sequence “Detach Watering Tool”.
[… kind of like the “Attach Watering Tool” sequence …]
(1) Executed sequence “Detach Watering Tool”.
(1) Finished sequence “Water The Carrots”.[/details]
I’ve posted this on GitHub for FarmBotJS.
Also, I noticed that toggling pins always give two identical status
events. (Pin set to 1 (twice) and pin set to 0 (twice)).