Hi all, I feel a bit stupid, because basically everything is working and I think I just miss something on type conversion site.
Basic syntax should be,
pressForward -> next favourite channel
pressBack->previous favourite channel
I just want to cycle though my favourite channels with the press of a button.
Item is defined as:
String EGPlayer_PlayFavorite "EG Play Favorite [%s]" (EGPlayerControl) {channel="squeezebox:squeezeboxplayer:XXXXXXXXX:XXXXXXXXX:playFavorite" }
From rules I can set my channel with
sendCommand(EGPlayer_PlayFavorite,2)
If I do
logInfo("IR", "channel ID: " + (EGPlayer_PlayFavorite.state))
I get the correct number
When I try
EGPlayer_PlayFavorite.sendCommand((EGPlayer_PlayFavorite.state as Number) - 1)
i get
[ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Received ON': Could not cast 2 to java.lang.Number;
My rule is:
if(EGPlayer_PlayFavorite.state!=0){
EGPlayer_PlayFavorite.sendCommand((EGPlayer_PlayFavorite.state as Number) - 1)
}
it would also be great to get suggetion on how to cycle though instead of stopping at a fixed max channel id or 0.
Having something like cycling though the channels would be quite helpfull rule, to change channels if no gui is near and just a wallmount switch or ir remote is available