Add scan_interval option to Command line (#27580)

This commit is contained in:
G Johansson 2023-06-06 08:33:50 +02:00 committed by Franck Nijhof
parent 718a2e49f9
commit 9f95073041
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3

View File

@ -18,7 +18,7 @@ ha_platforms:
- switch - switch
ha_integration_type: integration ha_integration_type: integration
ha_codeowners: ha_codeowners:
- '@gjohansson-ST' - "@gjohansson-ST"
--- ---
The `command_line` offers functionality that issues specific commands to get data or to control a device. The `command_line` offers functionality that issues specific commands to get data or to control a device.
@ -31,183 +31,203 @@ It's highly recommended to enclose the command in single quotes `'` as it ensure
{% configuration %} {% configuration %}
command_line: command_line:
description: The platforms to use for you command_line integration. description: The platforms to use for you command_line integration.
required: true required: true
type: list type: list
keys: keys:
binary_sensor: binary_sensor:
description: Binary sensor platform. description: Binary sensor platform.
required: false required: false
type: map type: map
keys: keys:
command: command:
description: The action to take to get the value. description: The action to take to get the value.
required: true required: true
type: string type: string
command_timeout: command_timeout:
description: Defines number of seconds for command timeout. description: Defines number of seconds for command timeout.
required: false required: false
type: integer type: integer
default: 15 default: 15
device_class: device_class:
description: Sets the [class of the device](/integrations/binary_sensor/), changing the device state and icon that is displayed on the frontend. description: Sets the [class of the device](/integrations/binary_sensor/), changing the device state and icon that is displayed on the frontend.
required: false required: false
type: string type: string
name: name:
description: Let you overwrite the name of the device. description: Let you overwrite the name of the device.
required: false required: false
type: string type: string
default: "*name* from the device" default: "_name_ from the device"
payload_on: payload_on:
description: The payload that represents enabled state. description: The payload that represents enabled state.
required: false required: false
type: string type: string
default: 'ON' default: 'ON'
unique_id: unique_id:
description: An ID that uniquely identifies this binary sensor. Set this to a unique value to allow customization through the UI. description: An ID that uniquely identifies this binary sensor. Set this to a unique value to allow customization through the UI.
required: false required: false
type: string type: string
payload_off: payload_off:
description: The payload that represents disabled state. description: The payload that represents disabled state.
required: false required: false
type: string type: string
default: 'OFF' default: 'OFF'
value_template: value_template:
description: Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract a value from the payload. description: Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract a value from the payload.
required: false required: false
type: string type: string
cover: scan_interval:
description: Cover platform. description: Define time in seconds between each update.
required: false required: false
type: map type: integer
keys: default: 60
command_close: cover:
description: The action to close the cover. description: Cover platform.
required: true required: false
default: true type: map
type: string keys:
command_open: command_close:
description: The command to open the cover. description: The action to close the cover.
required: true required: true
default: true default: true
type: string type: string
command_state: command_open:
description: If given, this will act as a sensor that runs in the background and updates the state of the cover. If the command returns a `0` the indicates the cover is fully closed, whereas a 100 indicates the cover is fully open. description: The command to open the cover.
required: false required: true
type: string default: true
command_stop: type: string
description: The action to stop the cover. command_state:
required: true description: If given, this will act as a sensor that runs in the background and updates the state of the cover. If the command returns a `0` the indicates the cover is fully closed, whereas a 100 indicates the cover is fully open.
default: true required: false
type: string type: string
command_timeout: command_stop:
description: Defines number of seconds for command timeout. description: The action to stop the cover.
required: false required: true
type: integer default: true
default: 15 type: string
name: command_timeout:
description: The name used to display the cover in the frontend. description: Defines number of seconds for command timeout.
required: true required: false
type: string type: integer
unique_id: default: 15
description: An ID that uniquely identifies this cover. Set this to a unique value to allow customization through the UI. name:
required: false description: The name used to display the cover in the frontend.
type: string required: true
value_template: type: string
description: if specified, `command_state` will ignore the result code of the command but the template evaluating will indicate the position of the cover. For example, if your `command_state` returns a string "open", using `value_template` as in the example configuration above will allow you to translate that into the valid state `100`. unique_id:
required: false description: An ID that uniquely identifies this cover. Set this to a unique value to allow customization through the UI.
type: template required: false
notify: type: string
description: Notify platform. value_template:
required: false description: if specified, `command_state` will ignore the result code of the command but the template evaluating will indicate the position of the cover. For example, if your `command_state` returns a string "open", using `value_template` as in the example configuration above will allow you to translate that into the valid state `100`.
type: map required: false
keys: type: template
name: scan_interval:
description: Setting the optional parameter `name` allows multiple notifiers to be created. The notifier will bind to the service `notify.NOTIFIER_NAME`. description: Define time in seconds between each update.
required: false required: false
default: notify type: integer
type: string default: 15
command: notify:
description: The action to take. description: Notify platform.
required: true required: false
type: string type: map
command_timeout: keys:
description: Defines number of seconds for command timeout. name:
required: false description: Setting the optional parameter `name` allows multiple notifiers to be created. The notifier will bind to the service `notify.NOTIFIER_NAME`.
type: integer required: false
default: 15 default: notify
sensor: type: string
description: Sensor platform. command:
required: false description: The action to take.
type: map required: true
keys: type: string
command: command_timeout:
description: The action to take to get the value. description: Defines number of seconds for command timeout.
required: true required: false
type: string type: integer
command_timeout: default: 15
description: Defines number of seconds for command timeout sensor:
required: false description: Sensor platform.
type: integer required: false
default: 15 type: map
json_attributes: keys:
description: Defines a list of keys to extract values from a JSON dictionary result and then set as sensor attributes. command:
required: false description: The action to take to get the value.
type: [string, list] required: true
name: type: string
description: Name of the command sensor. command_timeout:
required: false description: Defines number of seconds for command timeout
type: string required: false
unique_id: type: integer
description: An ID that uniquely identifies this sensor. Set this to a unique value to allow customization through the UI. default: 15
required: false json_attributes:
type: string description: Defines a list of keys to extract values from a JSON dictionary result and then set as sensor attributes.
unit_of_measurement: required: false
description: Defines the unit of measurement of the sensor, if any. type: [string, list]
required: false name:
type: string description: Name of the command sensor.
value_template: required: false
description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract a value from the payload." type: string
required: false unique_id:
type: string description: An ID that uniquely identifies this sensor. Set this to a unique value to allow customization through the UI.
switch: required: false
description: Switch platform. type: string
required: false unit_of_measurement:
type: map description: Defines the unit of measurement of the sensor, if any.
keys: required: false
command_on: type: string
description: The action to take for on. value_template:
required: true description: "Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract a value from the payload."
type: string required: false
command_off: type: string
description: The action to take for off. scan_interval:
required: true description: Define time in seconds between each update.
type: string required: false
command_state: type: integer
description: "If given, this command will be run. Returning a result code `0` will indicate that the switch is on." default: 60
required: false switch:
type: string description: Switch platform.
command_timeout: required: false
description: Defines number of seconds for command timeout. type: map
required: false keys:
type: integer command_on:
default: 15 description: The action to take for on.
name: required: true
description: The name used to display the switch in the frontend. type: string
required: true command_off:
type: string description: The action to take for off.
icon_template: required: true
description: Defines a template for the icon of the entity. type: string
required: false command_state:
type: template description: "If given, this command will be run. Returning a result code `0` will indicate that the switch is on."
unique_id: required: false
description: An ID that uniquely identifies this switch. Set this to a unique value to allow customization through the UI. type: string
required: false command_timeout:
type: string description: Defines number of seconds for command timeout.
value_template: required: false
description: "If specified, `command_state` will ignore the result code of the command but the template evaluating to `true` will indicate the switch is on." type: integer
required: false default: 15
type: string name:
description: The name used to display the switch in the frontend.
required: true
type: string
icon_template:
description: Defines a template for the icon of the entity.
required: false
type: template
unique_id:
description: An ID that uniquely identifies this switch. Set this to a unique value to allow customization through the UI.
required: false
type: string
value_template:
description: "If specified, `command_state` will ignore the result code of the command but the template evaluating to `true` will indicate the switch is on."
required: false
type: string
scan_interval:
description: Define time in seconds between each update.
required: false
type: integer
default: 30
{% endconfiguration %} {% endconfiguration %}
## Binary sensor ## Binary sensor
@ -215,12 +235,14 @@ command_line:
To use your Command binary sensor in your installation, add the following to your `configuration.yaml` file: To use your Command binary sensor in your installation, add the following to your `configuration.yaml` file:
{% raw %} {% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
command_line: command_line:
- binary_sensor: - binary_sensor:
command: "cat /proc/sys/net/ipv4/ip_forward" command: "cat /proc/sys/net/ipv4/ip_forward"
``` ```
{% endraw%} {% endraw%}
## Cover ## Cover
@ -230,6 +252,7 @@ A `command_line`cover platform that issues specific commands when it is moved up
To enable a command line cover in your installation, add the following to your `configuration.yaml` file: To enable a command line cover in your installation, add the following to your `configuration.yaml` file:
{% raw %} {% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
command_line: command_line:
@ -239,6 +262,7 @@ command_line:
command_stop: move_command stop garage command_stop: move_command stop garage
name: Garage name: Garage
``` ```
{% endraw%} {% endraw%}
## Notify ## Notify
@ -248,12 +272,14 @@ The `command_line` platform allows you to use external tools for notifications f
To enable those notifications in your installation, add the following to your `configuration.yaml` file: To enable those notifications in your installation, add the following to your `configuration.yaml` file:
{% raw %} {% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
command_line: command_line:
- notify: - notify:
command: "espeak -vmb/mb-us1" command: "espeak -vmb/mb-us1"
``` ```
{% endraw%} {% endraw%}
To use notifications, please see the [getting started with automation page](/getting-started/automation/). To use notifications, please see the [getting started with automation page](/getting-started/automation/).
@ -263,12 +289,14 @@ To use notifications, please see the [getting started with automation page](/get
To enable it, add the following lines to your `configuration.yaml`: To enable it, add the following lines to your `configuration.yaml`:
{% raw %} {% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
command_line: command_line:
- sensor: - sensor:
command: SENSOR_COMMAND command: SENSOR_COMMAND
``` ```
{% endraw%} {% endraw%}
## Switch ## Switch
@ -281,6 +309,7 @@ controlled from the command line, including calling other scripts!
To enable it, add the following lines to your `configuration.yaml`: To enable it, add the following lines to your `configuration.yaml`:
{% raw %} {% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
command_line: command_line:
@ -289,6 +318,7 @@ command_line:
command_on: switch_command on kitchen command_on: switch_command on kitchen
command_off: switch_command off kitchen command_off: switch_command off kitchen
``` ```
{% endraw%} {% endraw%}
<div class='note'> <div class='note'>
@ -322,6 +352,7 @@ In this section you find some real-life examples of how to use the command_line
Check the state of an [SickRage](https://github.com/sickragetv/sickrage) instance. Check the state of an [SickRage](https://github.com/sickragetv/sickrage) instance.
{% raw %} {% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
command_line: command_line:
@ -332,6 +363,7 @@ command_line:
payload_on: "Running" payload_on: "Running"
payload_off: "Not running" payload_off: "Not running"
``` ```
{% endraw%} {% endraw%}
### Check RasPlex ### Check RasPlex
@ -339,6 +371,7 @@ command_line:
Check if [RasPlex](https://github.com/RasPlex/RasPlex) is `online`. Check if [RasPlex](https://github.com/RasPlex/RasPlex) is `online`.
{% raw %} {% raw %}
```yaml ```yaml
command_line: command_line:
- binary_sensor: - binary_sensor:
@ -348,20 +381,23 @@ command_line:
payload_on: 1 payload_on: 1
payload_off: 0 payload_off: 0
``` ```
{% endraw%} {% endraw%}
An alternative solution could look like this: An alternative solution could look like this:
{% raw %} {% raw %}
```yaml ```yaml
command_line: command_line:
- binary_sensor: - binary_sensor:
name: Printer name: Printer
command: 'ping -W 1 -c 1 192.168.1.10 > /dev/null 2>&1 && echo success || echo fail' command: "ping -W 1 -c 1 192.168.1.10 > /dev/null 2>&1 && echo success || echo fail"
device_class: connectivity device_class: connectivity
payload_on: "success" payload_on: "success"
payload_off: "fail" payload_off: "fail"
``` ```
{% endraw%} {% endraw%}
Consider to use the [ping sensor](/integrations/ping#binary-sensor) as an alternative to the samples above. Consider to use the [ping sensor](/integrations/ping#binary-sensor) as an alternative to the samples above.
@ -371,6 +407,7 @@ Consider to use the [ping sensor](/integrations/ping#binary-sensor) as an altern
The services running is listed in `/etc/systemd/system` and can be checked with the `systemctl` command: The services running is listed in `/etc/systemd/system` and can be checked with the `systemctl` command:
{% raw %} {% raw %}
```bash ```bash
$ systemctl is-active home-assistant@rock64.service $ systemctl is-active home-assistant@rock64.service
active active
@ -378,23 +415,27 @@ $ sudo service home-assistant@rock64.service stop
$ systemctl is-active home-assistant@rock64.service $ systemctl is-active home-assistant@rock64.service
inactive inactive
``` ```
{% endraw%} {% endraw%}
A binary command line sensor can check this: A binary command line sensor can check this:
{% raw %} {% raw %}
```yaml ```yaml
command_line: command_line:
- binary_sensor: - binary_sensor:
command: '/bin/systemctl is-active home-assistant@rock64.service' command: "/bin/systemctl is-active home-assistant@rock64.service"
payload_on: "active" payload_on: "active"
payload_off: "inactive" payload_off: "inactive"
``` ```
{% endraw%} {% endraw%}
## Example cover platform ## Example cover platform
{% raw %} {% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
command_line: command_line:
@ -411,6 +452,7 @@ command_line:
0 0
{% endif %} {% endif %}
``` ```
{% endraw%} {% endraw%}
## Examples sensor platform ## Examples sensor platform
@ -422,6 +464,7 @@ In this section you find some real-life examples of how to use this sensor.
Thanks to the [`proc`](https://en.wikipedia.org/wiki/Procfs) file system, various details about a system can be retrieved. Here the CPU temperature is of interest. Add something similar to your `configuration.yaml` file: Thanks to the [`proc`](https://en.wikipedia.org/wiki/Procfs) file system, various details about a system can be retrieved. Here the CPU temperature is of interest. Add something similar to your `configuration.yaml` file:
{% raw %} {% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
command_line: command_line:
@ -432,6 +475,7 @@ command_line:
unit_of_measurement: "°C" unit_of_measurement: "°C"
value_template: "{{ value | multiply(0.001) | round(1) }}" value_template: "{{ value | multiply(0.001) | round(1) }}"
``` ```
{% endraw%} {% endraw%}
### Monitoring failed login attempts on Home Assistant ### Monitoring failed login attempts on Home Assistant
@ -439,6 +483,7 @@ command_line:
If you'd like to know how many failed login attempts are made to Home Assistant, add the following to your `configuration.yaml` file: If you'd like to know how many failed login attempts are made to Home Assistant, add the following to your `configuration.yaml` file:
{% raw %} {% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
command_line: command_line:
@ -446,11 +491,13 @@ command_line:
name: Badlogin name: Badlogin
command: "grep -c 'Login attempt' /home/hass/.homeassistant/home-assistant.log" command: "grep -c 'Login attempt' /home/hass/.homeassistant/home-assistant.log"
``` ```
{% endraw%} {% endraw%}
Make sure to configure the [Logger integration](/integrations/logger) to monitor the [HTTP integration](/integrations/http/) at least the `warning` level. Make sure to configure the [Logger integration](/integrations/logger) to monitor the [HTTP integration](/integrations/http/) at least the `warning` level.
{% raw %} {% raw %}
```yaml ```yaml
# Example working logger settings that works # Example working logger settings that works
logger: logger:
@ -458,6 +505,7 @@ logger:
logs: logs:
homeassistant.components.http: warning homeassistant.components.http: warning
``` ```
{% endraw%} {% endraw%}
### Details about the upstream Home Assistant release ### Details about the upstream Home Assistant release
@ -465,12 +513,14 @@ logger:
You can see directly in the frontend (**Developer tools** -> **About**) what release of Home Assistant you are running. The Home Assistant releases are available on the [Python Package Index](https://pypi.python.org/pypi). This makes it possible to get the current release. You can see directly in the frontend (**Developer tools** -> **About**) what release of Home Assistant you are running. The Home Assistant releases are available on the [Python Package Index](https://pypi.python.org/pypi). This makes it possible to get the current release.
{% raw %} {% raw %}
```yaml ```yaml
command_line: command_line:
- sensor: - sensor:
command: python3 -c "import requests; print(requests.get('https://pypi.python.org/pypi/homeassistant/json').json()['info']['version'])" command: python3 -c "import requests; print(requests.get('https://pypi.python.org/pypi/homeassistant/json').json()['info']['version'])"
name: HA release name: HA release
``` ```
{% endraw%} {% endraw%}
### Read value out of a remote text file ### Read value out of a remote text file
@ -478,12 +528,14 @@ command_line:
If you own devices which are storing values in text files which are accessible over HTTP then you can use the same approach as shown in the previous section. Instead of looking at the JSON response we directly grab the sensor's value. If you own devices which are storing values in text files which are accessible over HTTP then you can use the same approach as shown in the previous section. Instead of looking at the JSON response we directly grab the sensor's value.
{% raw %} {% raw %}
```yaml ```yaml
command_line: command_line:
- sensor: - sensor:
command: python3 -c "import requests; print(requests.get('http://remote-host/sensor_data.txt').text)" command: python3 -c "import requests; print(requests.get('http://remote-host/sensor_data.txt').text)"
name: File value name: File value
``` ```
{% endraw%} {% endraw%}
### Use an external script ### Use an external script
@ -493,14 +545,17 @@ The example is doing the same as the [aREST sensor](/integrations/arest#sensor)
The one-line script to retrieve a value is shown below. Of course it would be possible to use this directly in the `configuration.yaml` file but need extra care about the quotation marks. The one-line script to retrieve a value is shown below. Of course it would be possible to use this directly in the `configuration.yaml` file but need extra care about the quotation marks.
{% raw %} {% raw %}
```bash ```bash
python3 -c "import requests; print(requests.get('http://10.0.0.48/analog/2').json()['return_value'])" python3 -c "import requests; print(requests.get('http://10.0.0.48/analog/2').json()['return_value'])"
``` ```
{% endraw%} {% endraw%}
The script (saved as `arest-value.py`) that is used looks like the example below. The script (saved as `arest-value.py`) that is used looks like the example below.
{% raw %} {% raw %}
```python ```python
#!/usr/bin/python3 #!/usr/bin/python3
from requests import get from requests import get
@ -508,11 +563,13 @@ from requests import get
response = get("http://10.0.0.48/analog/2") response = get("http://10.0.0.48/analog/2")
print(response.json()["return_value"]) print(response.json()["return_value"])
``` ```
{% endraw%} {% endraw%}
To use the script you need to add something like the following to your `configuration.yaml` file. To use the script you need to add something like the following to your `configuration.yaml` file.
{% raw %} {% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
command_line: command_line:
@ -520,6 +577,7 @@ command_line:
name: Brightness name: Brightness
command: "python3 /path/to/script/arest-value.py" command: "python3 /path/to/script/arest-value.py"
``` ```
{% endraw%} {% endraw%}
### Usage of templating in `command:` ### Usage of templating in `command:`
@ -527,6 +585,7 @@ command_line:
[Templates](/docs/configuration/templating/) are supported in the `command` configuration variable. This could be used if you want to include the state of a specific sensor as an argument to your external script. [Templates](/docs/configuration/templating/) are supported in the `command` configuration variable. This could be used if you want to include the state of a specific sensor as an argument to your external script.
{% raw %} {% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
command_line: command_line:
@ -535,6 +594,7 @@ command_line:
command: "sh /home/pi/.homeassistant/scripts/wind_direction.sh {{ states('sensor.wind_direction') }}" command: "sh /home/pi/.homeassistant/scripts/wind_direction.sh {{ states('sensor.wind_direction') }}"
unit_of_measurement: "Direction" unit_of_measurement: "Direction"
``` ```
{% endraw%} {% endraw%}
### Usage of JSON attributes in command output ### Usage of JSON attributes in command output
@ -542,6 +602,7 @@ command_line:
The example shows how you can retrieve multiple values with one sensor (where the additional values are attributes) by using `value_json` and `json_attributes`. The example shows how you can retrieve multiple values with one sensor (where the additional values are attributes) by using `value_json` and `json_attributes`.
{% raw %} {% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
command_line: command_line:
@ -553,6 +614,7 @@ command_line:
command: "python3 /home/pi/.homeassistant/scripts/datetime.py" command: "python3 /home/pi/.homeassistant/scripts/datetime.py"
value_template: "{{ value_json.time }}" value_template: "{{ value_json.time }}"
``` ```
{% endraw%} {% endraw%}
## Example switch platform ## Example switch platform
@ -562,6 +624,7 @@ command_line:
This example demonstrates how to use template to change the icon as its state changes. This icon is referencing its own state. This example demonstrates how to use template to change the icon as its state changes. This icon is referencing its own state.
{% raw %} {% raw %}
```yaml ```yaml
command_line: command_line:
- switch: - switch:
@ -578,6 +641,7 @@ command_line:
{% else %} mdi:toggle-switch-off {% else %} mdi:toggle-switch-off
{% endif %} {% endif %}
``` ```
{% endraw%} {% endraw%}
### aREST device ### aREST device
@ -588,6 +652,7 @@ The command line tool [`curl`](https://curl.haxx.se/) is used to toggle a pin
which is controllable through REST. which is controllable through REST.
{% raw %} {% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
command_line: command_line:
@ -598,6 +663,7 @@ command_line:
value_template: '{{ value == "1" }}' value_template: '{{ value == "1" }}'
name: Kitchen Lightswitch name: Kitchen Lightswitch
``` ```
{% endraw%} {% endraw%}
Given this example, in the UI one would see the `friendly_name` of Given this example, in the UI one would see the `friendly_name` of
@ -614,6 +680,7 @@ This switch will shutdown your host immediately, there will be no confirmation.
</div> </div>
{% raw %} {% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
command_line: command_line:
@ -621,6 +688,7 @@ command_line:
name: Home Assistant System Shutdown name: Home Assistant System Shutdown
command_off: "/usr/sbin/poweroff" command_off: "/usr/sbin/poweroff"
``` ```
{% endraw%} {% endraw%}
### Control your VLC player ### Control your VLC player
@ -629,6 +697,7 @@ This switch will control a local VLC media player
([Source](https://community.home-assistant.io/t/vlc-player/106)). ([Source](https://community.home-assistant.io/t/vlc-player/106)).
{% raw %} {% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
command_line: command_line:
@ -637,6 +706,7 @@ command_line:
command_on: "cvlc 1.mp3 vlc://quit &" command_on: "cvlc 1.mp3 vlc://quit &"
command_off: "pkill vlc" command_off: "pkill vlc"
``` ```
{% endraw%} {% endraw%}
### Control Foscam Motion Sensor ### Control Foscam Motion Sensor
@ -647,6 +717,7 @@ This switch supports statecmd,
which checks the current state of motion detection. which checks the current state of motion detection.
{% raw %} {% raw %}
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
command_line: command_line:
@ -657,6 +728,7 @@ command_line:
command_state: 'curl -k --silent "https://ipaddress:443/cgi-bin/CGIProxy.fcgi?cmd=getMotionDetectConfig&usr=admin&pwd=password" | grep -oP "(?<=isEnable>).*?(?=</isEnable>)"' command_state: 'curl -k --silent "https://ipaddress:443/cgi-bin/CGIProxy.fcgi?cmd=getMotionDetectConfig&usr=admin&pwd=password" | grep -oP "(?<=isEnable>).*?(?=</isEnable>)"'
value_template: '{{ value == "1" }}' value_template: '{{ value == "1" }}'
``` ```
{% endraw%} {% endraw%}
- Replace admin and password with an "Admin" privileged Foscam user - Replace admin and password with an "Admin" privileged Foscam user