Rule Syntax Help

Having trouble getting a rule to run properly. The first rule runs fine, but the second is giving me an error on the syntax of the if statement. Can someone help me see what I’m doing wrong?

rule "Living TV Offline Remotely"
when
    Thing "chromecast:chromecast:bdeb6cbb59ed85fd6f0cfb8e9c405608" changed from ONLINE to OFFLINE 
then
    if((Living_TV_Power_SW.state == ON)) { 
        logInfo("harmony.rules", "TV changed to offline remotely, update the Living_TV_Power_SW")
        Living_TV_Power_SW.postUpdate(OFF) //update will update the state of the switch, but not re-issue the command
    } 
    else { 
        //logInfo("harmony.rules", "Living_TV_Power_SW is up to date, no update required")   
    }  
end

rule "Living TV Offline Locally"
when
    Item Living_TV_Power_SW received command OFF
then
    if(("chromecast:chromecast:bdeb6cbb59ed85fd6f0cfb8e9c405608.state" == ONLINE)) { 
        logInfo("harmony.rules", "TV changed to offline locally, update the Living_TV_Power_SW")
        Living_Broadlink_Command.sendCommand("TOSHIBA_TV_ON") 
    } 
    else { 
        //logInfo("harmony.rules", "Living_TV_Power_SW is up to date, no update required")   
    }  
end

has to be

if (getThingStatusInfo("chromecast:chromecast:bdeb6cbb59ed85fd6f0cfb8e9c405608").getStatus().toString() == "ONLINE") {

see here

1 Like

Thanks so much, for the fix and the link!