Skip to content

Controls

What Home Assistant can do to the computer. With the MQTT engine, and with the HADA integration, these show up as ordinary button, switch, number and notify entities of the device, usable from a dashboard or an automation. What works through which connection has the whole picture.

Entity Type Provided by Notes
lock_screen button Service Locks the interactive session
sleep, hibernate, shutdown, restart button Service Off until you switch them on on the Entities page. Nothing is forced: apps with unsaved work can still object, as when shutting down from the Start menu
sign_out button Tray New in 1.15.0. Off until you switch it on, like the power buttons. Signs out whoever is at the computer, as the Start menu does: an app with unsaved work can still hold it up
turn_off_display, wake_display button Tray Turns the screen off, or back on as moving the mouse would
media_play_pause, media_next, media_previous, media_stop button Tray Press the multimedia keys; whichever app handles them reacts
screen_brightness number (0–100 %) Service New in 1.5.0. Shows and sets the brightness of the built-in screen. Only on computers with a screen Windows can dim, a laptop's as a rule; external monitors are not covered
volume_level number (0–100 %) Tray Sets the volume of the default playback device
audio_mute switch Tray Mutes the default playback device
keep_awake switch Service New in 1.15.0. While on, the computer does not go to sleep by itself, e.g. through a long download; sleeping on purpose still works, and the screen may still turn off. Windows lists it under powercfg /requests. Off whenever HADA starts
dark_mode switch Tray New in 1.15.0. Switches Windows and its apps between the dark and the light look, as Choose your mode in the settings does, and shows which is on
microphone_mute switch Tray Mutes the default microphone in Windows
silence_notifications switch Tray New in 1.13.0. Turns Do not disturb on and off, as the switch in Windows' notification settings does. The do_not_disturb sensor shows the state. Windows reads and changes it through a state that is not documented, and Windows Server does not get the switch; see Known limitations
media_player media player Tray New in 1.5.0. What is playing, play, pause, next, previous, stop, volume and mute in one entity. Through the HADA integration only; see below
notification notify Tray A message sent to it is shown as a Windows notification. See Notifications

The power buttons are off by default

sleep, hibernate, shutdown, restart and (new in 1.15.0) sign_out do not exist in Home Assistant until you switch them on: open the HADA window, choose Entities, Unlock editing, turn on the ones you want and Save. Whoever can press a button in Home Assistant can then switch this computer off, so turn on only what you use.

Nothing is forced. Shutting down and restarting go through Windows the same way the Start menu does: an app with unsaved work can still object and hold it up.

The media player

New in 1.5.0. Needs version 0.4.0 of the HADA integration.

Home Assistant shows a speaker or a television as one media player: a card with what is playing, the buttons under it and a volume slider. media_player makes the computer one of those. It says what Windows' own media controls show, the title, artist, album and app, and how loud the default playback device is; and it takes play, pause, next, previous, stop, the volume and mute.

  • Through the HADA integration only. Home Assistant has no media player over MQTT, and none for a computer connected without the integration. There the separate entities do the same work: the four media buttons, volume_level, audio_mute, and the sensor media_playback.
  • The separate entities stay, whichever way you connect. If the media player is all you want in Home Assistant, switch them off on the Entities page; if you do not want the media player, switch that off.
  • Play and pause go to the app Windows shows in its media controls, so play never pauses and pause never starts anything, unlike the play/pause key.
  • The Entities page says so when the media player is switched on and none of your connections can show it.
actions:
  - action: media_player.volume_set
    target:
      entity_id: media_player.laptop_media_player
    data:
      volume_level: 0.3
  - action: media_player.media_pause
    target:
      entity_id: media_player.laptop_media_player

Using them

actions:
  - action: number.set_value
    target:
      entity_id: number.laptop_volume_level
    data:
      value: 30
  - action: switch.turn_on
    target:
      entity_id: switch.laptop_mute_microphone
  - action: button.press
    target:
      entity_id: button.laptop_media_play_pause

Entity IDs start with the device name you set on the Connections page; look them up on the device's page in Home Assistant.

Controls of the tray app act on the desktop of whoever is at the computer. They are unavailable while the tray app is not running. See Several users on one computer.

Your own buttons, which run a PowerShell command or start a program, are described under Custom sensors and buttons. With the WebSocket engine there are no entities to press; see WebSocket engine.