Params value of the attribute "ip"

My master controller has a slave controller which is displayed as a “device”.
When I go into this slave controller device and go to advanced, one of the params is called “ip”
I want to access this “ip”, to know if it’s changed, and if so, to force it back to a specific “ip”
I create a reactor group but I don’t see this option in device-state, I also tried using Expression but I can’t figure it out.
Any help would be greatly appreciated.
Thank you.

Well, just changing the ip attribute on a device may not be sufficient to get it to reconnect correctly, but that’s a Vera and device plugin limitation. I’ll show you how to do what you’re asking, but I have no expectation that it will actually give you the result you want. On the other hand, it might work, so why not try?

First, you use the expression getattribute() function to get the IP address into an expression/variable. You’ll need to know the device number:

Then, you create a condition to test the variable value. Because device attributes do not send events when they change in Luup, you have to couple this with an Interval condition to make it periodically re-evaluate the conditions. This example shows an hourly check.

Finally, you can use a Run Lua action in the is TRUE activity to reset the IP address:

Now, as I said in the preamble, just resetting the IP address alone probably isn’t sufficient to get the device to restart/reconnect. It may even take a Luup restart. So as I said, it’s doable, but it may not do what you really want.

Thanks, I see my error now… I had tried luup.attr_get(‘ip’, 9999) as an expression but now with your ‘getattribute’ instead, it is working just fine. I see no reason for it to NOT work because that is what I used to do manually before, and all seemed good after my manual fixes… (of course, the real question is Why does my master vera keeps losing the IP address of the slave… but that is another troubleshooting question in another forum topic). Thanks again for your help… I love your REACTOR

1 Like