function Entertainment_SetRemoteControlType($Id, $Value, $ControlType) { $DeviceName = IPS_GetName(IPS_GetParent($Id)); IPSLogger_Inf(__file__, 'Set RemoteControlType "'.$Value.'" for Device "'.$DeviceName.'"'); if (GetValue($Id) <> $Value) { SetValue($Id, $Value); $DeviceConfig = get_DeviceConfiguration(); $Remote = c_RemoteControlHtmlPrefix.$DeviceConfig[$DeviceName][$ControlType][c_Property_Names][$Value].c_RemoteControlHtmlSuffix; Entertainment_SetRemoteControl(get_ControlIdByDeviceName($DeviceName, $ControlType), $Remote); } }
function get_ControlNameByDeviceName($DeviceName, $ControlType, $ErrorOnNotFound=true) { $DeviceData = get_DeviceConfiguration(); if (!array_key_exists($DeviceName, $DeviceData)) { IPSLogger_Wrn(__file__, 'Unknown DeviceName "'.$DeviceName.'"'); return false; } $Device = $DeviceData[$DeviceName]; if (array_key_exists($ControlType, $Device)) { return $DeviceData[$DeviceName][$ControlType][c_Property_Name]; } if ($ErrorOnNotFound) { IPSLogger_Err(__file__, "ControlName could NOT be found for Device='$DeviceName' and ControlType='$ControlType'"); exit; } return false; }
function Entertainment_SendDataByDeviceName($DeviceName, $ControlType, $CommTypeList, $MessageType) { if ($MessageType <> c_MessageType_Action) { return; } $DeviceData = get_DeviceConfiguration(); $Control = $DeviceData[$DeviceName][$ControlType]; foreach ($CommTypeList as $CommType) { if (array_key_exists($CommType, $Control)) { Entertainment_SendData($DeviceName, $ControlType, $Control[$CommType], $CommType); break; } } }