Presence Sensor Custom Action Issue Arrived() Departed() in rule execution

I am using IFTTT to set a virtual switch when some people's phones connect to my Network. In turn, that triggers a Rule which attempts to set a presence sensor which I can display on my dashboards (among other uses). The rule uses the Run Custom Action to call the Arrived() or Departed() commands of the presence sensor. I have tested this with the HE standard Mobile App Device driver, and a user defined driver that I ported from ST called Forcible Mobile Presence Sensor. Both Drivers support the arrived() and departed() actions. Both Drivers give me the same error. The commands call for no parameters to be passed but the error suggests that Null cannot be handled properly. I have tested the rule action with String type, and Number type leaving the parameter field blank, as well as with no type selected. The rule reads like it should...arrived(), but the device still gives an error.

The error in the Log for the driver is:

The error for the HE Standard Mobile App Device driver is the same error except it references that driver instead of the user defined one reflected above.

The result of the error is that the presence sensor never gets set.

The rule is:

The user defined driver is:

I don't know if the problem is in the drivers, standard and user defined, or if it is in how Rule Machine calls Custom Actions. Any assistance would be be welcome in correcting both the User Defined Driver and the HE Standard driver. Perhaps I am just entering the rule wrong. Perhaps it is the code. I am not expert enough yet to know.

thanks in advance,

LJ

Why not use the "Virtual Presence Sensor" driver?

No one can update these but Hubitat. Their code is not publicly available.

1 Like

I believe i tried that driver too and that one didn't support the Custom Actions. I will go back and check.

I know they must fix their standard drivers if that is where the problem lies and I am filing a support request to them but i thought someone here might be able to look at my code and see if it is in the code. It may also be in how Rule machine calls the Action. that would be HE too.

EDIT: I was wrong. The Virtual Presence Driver does support arrived and departed Custom Actions. Same Error. This is leading me to believe that it is likely how I am using the Rule Machine to call the Custom Action. When I call Run Custom Action it asks for a parameter. The choices are no selection, string, number, decimal. I have tired all of these and not populated the parameter field with anything. all gave the same error. Am I doing this wrong?

LJ

You should not use any parameter...you just have to choose the command from the drop-down list. From the screenshot of the error, it appears to me that you are calling the method "arrived" with the parameter "arrived". That is incorrect.

What i was doing was selecting the command from the selector and then I thought I had to choose String or number for parameter type, but then I left the parameter value field blank. Therule screen looked exactly the same after saving the action either way. It showed arrived() as shown in my original post so I thought it was passing null as there was nothing contained in the parenthesis. I was not filling in the word arrived as you interpreted the log.

HOWEVER, your comment to not select ANY parameter type, leave it as No Selection, got me thinking. I thought i tested that option previously. But I went back and tried that again just now and that worked!

Thanks for helping me think this through. It was how I was using Rule Machine. I am still pretty new to this HE platform but I am learning...

LJ

1 Like

It takes time....you'll get it. You figured out where your problem was coming from.