function Entertainment_SetRoomPower($PowerId, $Value, $PowerOnDevices=true) { if (GetValue($PowerId) <> $Value) { IPSLogger_Inf(__file__, 'Set Power for Room "'.IPS_GetName(IPS_GetParent($PowerId)).'" '.bool2OnOff($Value)); SetValue($PowerId, $Value); Entertainment_SetRoomVisible($PowerId, $Value); if ($PowerOnDevices) { Entertainment_SetDevicePowerByRoomId(IPS_GetParent($PowerId), $Value); } Entertainment_SyncRoomControls(IPS_GetParent($PowerId)); } }
function Entertainment_SetSource($SourceId, $Value, $MessageType=c_MessageType_Action) { if (GetValue($SourceId) <> $Value) { $RoomId = IPS_GetParent($SourceId); $SourceName = get_SourceName($RoomId, $Value); IPSLogger_Inf(__file__, 'Set Source "'.$SourceName.'" of Room '.IPS_GetName($RoomId)); SetValue($SourceId, $Value); if (!IsRoomPoweredOn($RoomId)) { Entertainment_SetRoomPowerByRoomId($RoomId, true, false); } Entertainment_SetDeviceControlByRoomId($RoomId, c_Control_Muting, false); Entertainment_SetDevicePowerByRoomId($RoomId, true); Entertainment_SendDataBySourceIdx($RoomId, $Value, $MessageType); Entertainment_SyncRoomControls($RoomId); Entertainment_PowerOffUnusedDevices(); } }