function Entertainment_SetRemoteControl($Id, $Value) { $DeviceName = IPS_GetName(IPS_GetParent($Id)); if (!isDevicePoweredOnByDeviceName($DeviceName)) { return; } IPSLogger_Dbg(__file__, 'Set RemoteControl for Device "'.$DeviceName.'": '.$Value); SetValue($Id, $Value); Entertainment_SetRoomControlByDeviceControlId($Id, $Value); }
function Entertainment_PowerOffUnusedRoomes() { IPSLogger_Dbg(__file__, 'PowerOff unused Roomes ...'); $RoomIds = get_ActiveRoomIds(); foreach ($RoomIds as $RoomId) { $RoomActice = false; $DeviceNames = get_DeviceNamesByRoomId($RoomId); foreach ($DeviceNames as $DeviceName) { $RoomActive = isDevicePoweredOnByDeviceName($DeviceName) or $RoomActice; } if (!$RoomActive) { Entertainment_SetRoomPowerByRoomId($RoomId, false); } } }
function Entertainment_SetMuting($Id, $Value, $MessageType=c_MessageType_Action) { $DeviceName = IPS_GetName(IPS_GetParent($Id)); if (!isDevicePoweredOnByDeviceName($DeviceName)) { return; } if (!is_bool($Value)) { /*Toggle Power Value*/ $Value = !GetValue($Id); } if (GetValue($Id) <> $Value) { IPSLogger_Inf(__file__, 'Set Muting "'.bool2OnOff($Value).'" for Device "'.$DeviceName.'"'); SetValue($Id, $Value); if ($Value) { Entertainment_SendDataByDeviceName($DeviceName, c_Control_Muting, array(c_Property_CommMuteOn, c_Property_CommMute), $MessageType); } else { Entertainment_SendDataByDeviceName($DeviceName, c_Control_Muting, array(c_Property_CommMuteOff, c_Property_CommMute), $MessageType); } Entertainment_SetRoomControlByDeviceControlId($Id, $Value); } }