Shell
OS Support:
Enable the platform:
shell: type: powershellBase Properties
Section titled “Base Properties”| Property | Description |
|---|---|
| update_interval | How often to run the command. Default is 60s. |
In the future an update interval of
0will allow you to stream the output of long running commands (e.g. a json log line by line).
Sensors
Section titled “Sensors”sensor: - platform: shell name: 'RAM Usage' update_interval: 30s command: |- free | grep Mem | awk '{print $3/$2 * 100.0}'Binary Sensor
Section titled “Binary Sensor”binary_sensor: - platform: shell name: 'Door Open' update_interval: 30s command: |- if [ -f /tmp/door_open ]; then echo true; else echo false; fiThe command output must be true or false (case-insensitive).
Switch
Section titled “Switch”switch: - platform: shell name: 'Screen' id: screen command_on: 'wlr-randr --output HDMI-A-1 --on' command_off: 'wlr-randr --output HDMI-A-1 --off' command_state: |- wlr-randr --output HDMI-A-1 | grep -q "Enabled: yes"; then echo true else echo false fiNumber
Section titled “Number”number: - platform: shell name: 'Display Brightness' id: display_brightness unit_of_measurement: '%' min_value: 0.0 max_value: 100.0 step: 1.0 update_interval: 5s command_state: 'cat /tmp/display_brightness' command_set: 'echo {{ value }} > /tmp/display_brightness'Text Sensor
Section titled “Text Sensor”text_sensor: - platform: shell name: 'Host Name' id: host_name update_interval: 30s command: 'hostname'Button
Section titled “Button”button: - platform: shell name: 'Open Chrome' command: 'xdg-open https://example.com'