Author Topic: finding out if a command worked  (Read 279 times)

mchampio

  • Newbie
  • *
  • Posts: 3
    • View Profile
finding out if a command worked
« on: July 15, 2016, 05:45:58 am »
Is there a way to determine the status of a command?. Any return status I can check?
Eg I am trying to use the Lplan to write a message to IFTTT
The test within IFTTT works successfully, so the key is ok, I run the code is mcthings and it runs, but does not update IFTTT
I have included the code, plus the devices page

[ Guests cannot view attachments ]

Share on Facebook Share on Twitter


kristofferis

  • Sr. Member
  • ****
  • Posts: 287
  • Location: Sweden
    • View Profile
Re: finding out if a command worked
« Reply #1 on: July 15, 2016, 08:46:23 am »
Hello.
I don't know any way to get the result if it was published or not.
I just published to your IFTTT from one of my modules now, did you get that?

mchampio

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: finding out if a command worked
« Reply #2 on: July 16, 2016, 12:14:22 am »
Hi,
    thanks for the IFTTT test. Your mcthings did publish to my recipe.
 I have gone through and checked that the latest versions of all code is on the devices, reloaded the Lplan code and tried again. It just sits there doing nothing.
I included a blinking led, and the led goes on and off, but no entries are sent to IFTTT
Do I have to connect back to the gateway for the mcmodule to send to IFTTT
Is there any diagnostics, error codes, return codes, displays,  to indicate what the Lplan command is doing

rvdvoort

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: finding out if a command worked
« Reply #3 on: July 16, 2016, 03:58:32 am »
You could try power cycling the MC gateway. I had a similar problem with publishing to a broker via MQTT (not publishing).
After a powercycle of the MC gateway it suddenly started working.




mchampio

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: finding out if a command worked
« Reply #4 on: July 16, 2016, 11:43:27 pm »
I unpowered the gateway and mcmodule and powered them back up. The gateway has a solid led for COMM and a flashing led for STATUS.
The mcmodule blinks on and off, showing it is cycling through the code, but still no entries are registered at IFTTT
Very frustrating, as I still haven't seen any sign from mcthings that there is a way to determine if an Lplan command is successful, and if not, why not.
I also get irregular short blinks from the red led, even thought there is no code for this. Is this a symptom?

mc-Abe

  • Full Member
  • ***
  • Posts: 167
    • View Profile
    • mc-Things
Re: finding out if a command worked
« Reply #5 on: July 16, 2016, 11:59:45 pm »
mchampio,

Sorry for the delayed response but there is no way at the moment to know if an lplan function is successful. The lplan functions generally run asynchronous of your code execution. When you call Lplan.IFTTT that function is queued until the device makes a successful connection with the gateway. This could be a minute later. In order to notify of its success, we would have to have asynchronous callbacks which would make things even more complicated.

The fact that you are seeing irregular red LED blinking, means your module is resetting periodically. The red LED flashes when the bootloader runs. How often are you publishing to IFTTT? Could you share your publish snippet? Have you tried using a fresh battery?