im looking for a solution for an Alexa controlled shutdown/wol. EXEC and WoL are installed but when im trying to set up my button for Alexa to find it isnt shown on “my devices”
Missing quote after MAC. And wrong quotes hopefully a copy paste problem.
Thin about using VS Code with openhab Exstension it helps a lot with syntax problems.
Seems like openhab 1 syntax to me. Either install the legacy bindings for openhab containing exec1 or have a closer look to the documentation for exec 2.
thanks for the Quick response! God, the missing quote was my mistake, thanks, now after i did it the way you described it somehow the switch only works with the “alexa turn on PC” for both ways (WoL and Shutdown), the OFF switch is out of order. Seems like there is an issue with the switch and 2 commands for on and off (or maybe only with exec for the 2nd command)
@Nin it wont work like, sorry my mistake. If you switch on you triger both on. You will need to use a rule to and mutliple items to get what you want to achive.
rule "PC OnOff"
when
Item PC_P received command
then
switch receivedCommand {
case ON : WolSwitch.sendCommand(ON)
case OFF : ExecSwitch.sendCommand(ON)
}
end
Only the PC_P switch will be place into your sitemap. (besides what es needed else to make it a sitemap.) .sitemap
Switch item=PC_P
I did not test this but it should work like that, besides typos.
@Josar
indeed theres a loooooooooot to watch took me til 10min ago to figure out how to control the switch with 2 different commands “on/off”, didnt had the time to update a the post. Sorry! But now that i have 2 rules set (1 for my TV too) only one is useable in the rules file. If i outcomment my TV the PC is working but if i uncomment my TV nothings working anymore… this is more complicated than i anticipated Is there a Way to use both of those rules in the same file for different items, or should openhab2 use both of those rules alltogether?
//Rules
rule "TV_OF"
when Item TV_OF received command
then switch (receivedComman)
{
case ON: { TV_O.sendCommand(ON) }
case OFF: { TV_F.sendCommand(ON)}
}
end
rule "PC_OF"
when Item PC_OF received command
then switch (receivedCommand)
{
case ON: { PC_O.sendCommand(ON) }
case OFF: { PC_F.sendCommand(ON) }
}
end
//Items
Switch TV_O "TV1" { wol="IP#MAC" }
Switch TV_F "TV2" { channel="PowerOFF_CMD" }
Switch TV_OF "TV" [ "Switchable" ] // <---- WEBOS TV from LG
\o/ that cleared out the problem. God 6h of coding and trying really blinds it out now the PC Rule is ready to work! I put your coding from up above as solution! Thanks a lot for your help here, now im going to fix the WebOS Problem (OFF/ON) not working.