OpenHAB2 can be used to toggle a display monitor using DPMS. Furthermore, if an Alexa device is present, the DPMS enabled monitor can be turned on and off using voice commands.
exec
binding (2.X)
The exec
binding can be installed via the OpenHAB2 paper UI by navigating to bindings. The exec
binding will be used to execute a shell script in order to toggle the monitor on or off using an OpenHAB2 switch.
The setup defines commands in things.items
using the shell scripts get_dpms.sh
and set_dpms.sh
that are then referenced by display.items
where the switch definitions are placed. display.rules
will update the status of the DPMS monitor as well as send commands via get_dpms.sh
and set_dpms.sh
.
Assuming that all OpenHAB2 items are placed under /etc/openhab2
, the following illustration shows the filesystem layout where the files from the index section should be placed:
/etc/openhab2/ + | +----+--- items | + | | | +--- display.items | +--- things | + | | | +--- display.things | +--- rules | + | | | +--- display.rules | +--- shell_scripts + | +--- set_dpms.sh | +--- get_dpms.sh
To add the switch to your sitemap, edit your sitemap under /etc/openhab2/sitemaps/
and append:
Frame label="Servers" { Default item=Monitor_Display //Default item=Monitor_Display_State }
Note that the second line references a string value that is updated asynchronously whenever the DPMS status changes. This value is used by display.rules
to update the actual switch, so it is not needed, However, for debugging purposes, the line can be enabled.