-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEntertainment_RemoteControl.ips.php
More file actions
44 lines (38 loc) · 1.95 KB
/
Entertainment_RemoteControl.ips.php
File metadata and controls
44 lines (38 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?
include_once "IPSLogger.ips.php";
include_once "Entertainment_Constants.ips.php";
include_once "Entertainment_Configuration.ips.php";
include_once "Entertainment_Control.ips.php";
include_once "Entertainment_Source.ips.php";
include_once "Entertainment_Power.ips.php";
include_once "Entertainment_Room.ips.php";
include_once "Entertainment_Device.ips.php";
// ---------------------------------------------------------------------------------------------------------------------------
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 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_RefreshRemoteControlByDeviceName($DeviceName, $ControlType=c_Control_RemoteSource) {
$RemoteControlId = get_ControlIdByDeviceName($DeviceName, $ControlType, false);
if ($RemoteControlId !== false) {
Entertainment_SetRemoteControl($RemoteControlId, GetValue($RemoteControlId));
}
}
?>