The method is undefined error

Hello,
I want to use

actions.sendWakeOnLanPacketViaIp()

how it is described here, but I keep getting an error

The method sendWakeOnLanPacketViaIp() is undefined for the type ThingActions

What am I doing wrong? OH is 3.2.0

You’ve not followed the full example there.

First you have to get the Action for the specific Thing you want to send the WoL through.

val actions = getActions("network", "network:pingdevice:devicename")

Note the Thing ID.

Only then can you call the method.

actions.sendWakeOnLanPacketViaIp()

However you will also notice that the example also tests to see if actions exists before trying to call it. It might be the case that the Thing is offline or doesn’t exist.

You also didn’t say which language you are using. I’m assuming Rules DSL.

Oh, sorry for my inaccuracy.
My full rule looks like this:

val actions = getActions("network", "network:pingdevice:pc_thing")
actions.sendWakeOnLanPacketViaIp()

I’m not checking if actions is not null but I know for sure it is not, because I can use

actions.sendWakeOnLanPacket()

and it does not throw any error.

So I guess, there is some problem with binding version that I use, because sendWakeOnLanPacketViaIp() is a new feature. However, I’m using last stable 3.2 version, so it should be available, that’s why I’m writing here.
And, yes, I use DSL.

For now. But if for some reason the Thing goes offline getActions will return null.

So you are pulling the Action and calling the function and there is no errors logged out in openhab.log but it’s not working? Then most likely it’s a configuration error in the binding and/or Thing. That’s not something I can help with and it’s not something that can be solved from rules.

I wonder, if your Thing existed and pre-dates the introduction of a new Action … does it get the new Action, or must you re-create the Thing?

There is no error when I am using old sendWakeOnLanPacket(), which is now deprecated, and I want to use new method sendWakeOnLanPacketViaIp(), which is unavailable for me for some reasons

No, I unlikely it is the problem, because I already tried to recreate the thing and reinstall the network binding and nothing has changed.

I have the same problem. My version is openHAB 3.3.0-SNAPSHOT - Build #2664

sendWakeOnLanPacket() works for the OP. What is your “same problem”?

actions.sendWakeOnLanPacketViaIp() is not working for me.

I’m also using actions.sendWakeOnLanPacket() to start my devices and i’m fine with this. I just want to tell, that Vasilii is not the only one who can’t use actions.sendWakeOnLanPacketViaIp()

1 Like