Skip to content

Watching Entities

Go Automate can watch a Home Assistant entity and print its state every time it changes. This powers shell scripts and status-bar modules that react to your home in real time.

  • Through the bridge (recommended)ha bridge watch entity connects to the shared bridge, so many watchers reuse one connection to Home Assistant. This is the best choice for status bars and long-running watchers.
  • Direct (troubleshooting only)ha watch entity opens its own WebSocket connection. It uses the bridge by default and only falls back to a direct connection if the bridge is unavailable. Force a direct connection with --direct when debugging.
Terminal window
go-automate ha bridge watch entity input_boolean.guest_mode

The watcher prints the current state immediately, then prints again on every change. Pass --socket to use a non-default bridge socket path:

Terminal window
go-automate ha bridge watch entity input_boolean.guest_mode --socket /tmp/go-automate-ha.sock

ha watch entity uses the bridge when it can and falls back to a direct connection otherwise:

Terminal window
go-automate ha watch entity sensor.living_room_temperature

Force a direct connection for troubleshooting with --direct:

Terminal window
go-automate ha watch entity sensor.living_room_temperature --direct

Add --bar-json to emit machine-readable JSON lines instead of plain text. Each line is an object with text, tooltip and class that any status bar, shell or script can consume, including Waybar and Quickshell. See Bar JSON for the full output contract and every flag.

Terminal window
go-automate ha bridge watch entity input_boolean.guest_mode \
--bar-json \
--text-on "Guest" \
--tooltip-on "Guest mode is on" \
--tooltip-off "Guest mode is off" \
--class-on "active" \
--hide-off

For the full output contract, every --bar-json flag and a complete Waybar module, see Bar JSON.

Connection flags differ by command:

FlagCommandEffect
--socketha bridge watch entityPath to the bridge socket.
--directha watch entityBypass the bridge and connect directly.
--bridge-socketha watch entityPath to the bridge socket to try before falling back.
  • See Bar JSON to wire a watcher into a status bar.
  • Make sure the bridge is running for the lowest network usage.
  • See the Bridge Protocol for how watchers talk to the bridge.