About

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.

Requirements

  • A DPMS enabled monitor
  • OpenHAB2 installed (this tutorial does not cover installation of OpenHAB2)
    • exec binding (2.X)

Preparations

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.

OpenHAB2 Setup

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     
                                                                               

Updating the Sitemap

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.

Index


iot/openhab2/control_dpms_monitor.txt ยท Last modified: 2022/04/19 08:28 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.