DELL製ディスプレイの輝度をWindwosの電源プランに応じて自動的に変更する

Summary

1. Dell Display Managerアプリケーションを導入する
2. イベント ビューアーで電源プランを変更したときのイベントログを確認する
3. タスク スケジューラに輝度を設定するタスクを作る

Dell Display Managerアプリケーションを導入する

Dell Display Managerアプリケーションを公式サイトからダウンロードしてインストールします。

インストールしたディレクトリにある `readme.txt` の Command language セクションに SetBrightnessLevel と SetContrastLevel があることを確認します。以下は 1.4.0.1942 からの引用です。

Command language
-----------------------------------------------
A rich and flexible command language is supported via the
command-line, and command-line arguments can be combined.
Where appropriate, a specific display can be targeted by
prefacing the command with the monitor serial number or
enumerated display number, e.g., "2:AutoSetup"; if a
display serial or enumerated number is not specified the
command will be applied to the current selected display
or to all displays, as appropriate. Commands include:

SetActiveInput [DVI2/HDMI/DP2,etc] - switches active input
RestoreFactoryDefaults - restores factory defaults*
AutoSetup - executes an autosetup (analog only)*
RestoreLevelDefaults - restores level defaults*
RestoreColorDefaults - restores color defaults*
SetBrightnessLevel X - sets brightness to X% (0-100)*
SetContrastLevel X - sets contrast to X% (0-100)*
SetNamedPreset [Movie/CAL1,etc] - changes the Preset mode*
SetPowerMode [on/off] - sets the display power mode*
SetOptimalResolution - switches to optimal resolution
SaveProfile [Name] - save settings to named profile*
RestoreProfile [Name] - restore settings from named profile*
DeleteProfile [Name] - delete named profile
SetGridType [X] - changes Easy Arrange grid type to X
Rescan - rescans display hardware
ForceReset - reconnects and rescans display hardware
SetControl X Y - sets hex control X to hex value Y
IncControl X Y - increases the value of control X by Y
DecControl X Y - decreases the value of control X by Y
Zoom - switches between PxP and fullscreen mode
Wait X - pause X milliseconds
Exit - terminates the program

Some of these commands require familiarity with the MCCS
standard. For example, on monitors that support it the
command to switch the OSD language to Spanish would be
"SetControl CC 0A"; to unlock an OSD that has been
inadvertently locked "SetControl CA 02".

Instructions can be combined on the command-line, and
assigned to standard Windows shortcuts with optional hotkeys
or coupled with the native Windows Task Scheduler to execute at
certain times.

For example:

"ddm.exe /RestoreLevelDefaults /2:SetContrastLevel 70"

would first restore level defaults on all monitors, and then
set the contrast level on monitor #2 to 70%.

NB: If not targeted to a specific monitor, commands listed
above that are tagged with an asterisk (*) apply to all
monitors to facilitate simple and uniform control over all
members of a multimonitor matrix. For instance, if executed
on a matrix of 16 similar monitors, the command-line:

"ddm.exe /SetNamedPreset Warm /SetBrightnessLevel 75"

would set all 16 monitors to Warm preset mode, with a
brightness level of 75%.

イベント ビューアーで電源プランを変更したときのイベントログを確認する

コントロールパネルの電源オプションで、電源プランをバランスなどから省電力に変更します。

電源オプションで電源プランを省電力に変更する

電源オプションで電源プランを省電力に変更する

その後、イベント ビューアーを起動して、左側のペインから「Windows ログ」の「システム」をクリックすると、中央のペインに電源プランを変更したときのログが表示されます。以下は AMD Ryzen Balanced から 省電力モードに切り替えたときのログです。

電源プランを省電力モードに変更したときのイベント ビューアーのログ表示

電源プランを省電力モードに変更したときのイベント ビューアーのログ表示

何へ(to)変更されたかを確認します。ここでは以下の値になります。

to {a1841308-3541-4fab-bc81-f71556f20b4a}

タスク スケジューラに輝度を設定するタスクを作る

暗くするとき用のタスクと、明るくするとき用のタスクを作ります。{a1841308-3541-4fab-bc81-f71556f20b4a} の部分はご自分の環境に合わせて変更してください。

暗くするときのトリガー用イベントフィルタ

<QueryList>
<Query Id="0" Path="System">
<Select Path="System">
*[System[Provider[@Name='Microsoft-Windows-UserModePowerService'] and (Level=4 or Level=0) and (Task=10) and (EventID=12)]]
and
*[EventData[Data[@Name='NewSchemeGuid'] ='{a1841308-3541-4fab-bc81-f71556f20b4a}']]
</Select>
</Query>
</QueryList>

暗くするときの dmm.exe の引数

/SetBrightnessLevel 0 /SetContrastLevel 0

明るくするときのトリガー用イベントフィルタ

<QueryList>
<Query Id="0" Path="System">
<Select Path="System">
*[System[Provider[@Name='Microsoft-Windows-UserModePowerService'] and (Level=4 or Level=0) and (Task=10) and (EventID=12)]]
and
*[EventData[Data[@Name='OldSchemeGuid'] ='{a1841308-3541-4fab-bc81-f71556f20b4a}']]
</Select>
</Query>
</QueryList>

明るくするときの dmm.exe の引数

/SetBrightnessLevel 50 /SetContrastLevel 55

 

Create Task - General

Create task - Triggers - On an event - Custom - Edit Event Filter... - XML

Create Task - Actions - Edit Action

両方のタスクを作成した後、電源プランを変更するとディスプレイの輝度が自動的に変化します。


参考にしたWebページ

www.petri.com