mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 01:06:52 +00:00
Add config flow to Random (#29528)
This commit is contained in:
parent
4e05e0067d
commit
bf14f24692
@ -5,6 +5,7 @@ ha_category:
|
|||||||
- Binary Sensor
|
- Binary Sensor
|
||||||
- Sensor
|
- Sensor
|
||||||
- Utility
|
- Utility
|
||||||
|
- Helper
|
||||||
ha_iot_class: Local Polling
|
ha_iot_class: Local Polling
|
||||||
ha_release: 0.32
|
ha_release: 0.32
|
||||||
ha_quality_scale: internal
|
ha_quality_scale: internal
|
||||||
@ -19,13 +20,17 @@ ha_integration_type: integration
|
|||||||
|
|
||||||
The `random` integration simply creates random values or state. This can be useful if you want to test automation rules or run an interactive demo. It generates a new state every time it is polled.
|
The `random` integration simply creates random values or state. This can be useful if you want to test automation rules or run an interactive demo. It generates a new state every time it is polled.
|
||||||
|
|
||||||
## Binary Sensor
|
|
||||||
|
|
||||||
The `random` binary sensor platform is creating random states (`true`, 1, `on` or `false`, 0, `off`).
|
## Configuration
|
||||||
|
The preferred way to configure random helpers is via the user interface at **{% my helpers title="Settings > Devices & Services > Helpers" %}** and select the add button; next, select the {% my config_flow_start domain=page.ha_domain title=page.title %} option.
|
||||||
|
|
||||||
### Configuration
|
To be able to add Helpers via the user interface, you should have `default_config:` in your `configuration.yaml`. It should already be there by default unless you removed it. If you removed `default_config:` from your configuration, you must add `random:` to your `configuration.yaml` first, then you can use the UI.
|
||||||
|
|
||||||
To enable the random binary sensor, add the following lines to your `configuration.yaml` file:
|
## Binary sensor
|
||||||
|
The random binary sensor creates random states (`true`, 1, `on` or `false`, 0, `off`).
|
||||||
|
|
||||||
|
### YAML configuration
|
||||||
|
To create the random binary sensor, add the following lines to your `configuration.yaml` file:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Example configuration.yaml entry
|
# Example configuration.yaml entry
|
||||||
@ -38,16 +43,14 @@ name:
|
|||||||
description: Name to use in the frontend.
|
description: Name to use in the frontend.
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: Random Binary Sensor
|
default: Random binary sensor
|
||||||
{% endconfiguration %}
|
{% endconfiguration %}
|
||||||
|
|
||||||
## Sensor
|
## Sensor
|
||||||
|
The random sensor creates random sensor values (integers) out of a given range. Returned values form a [discrete uniform distribution](https://en.wikipedia.org/wiki/Discrete_uniform_distribution), meaning that each integer value in the range configured is equally likely to be drawn.
|
||||||
|
|
||||||
The `random` sensor platform is creating random sensor values (integers) out of a given range. Returned values form a [discrete uniform distribution](https://en.wikipedia.org/wiki/Discrete_uniform_distribution), meaning that each integer value in the range configured is equally likely to be drawn.
|
### YAML configuration
|
||||||
|
To create the random sensor, add the following lines to your `configuration.yaml` file:
|
||||||
### Configuration
|
|
||||||
|
|
||||||
To enable the random sensor, add the following lines to your `configuration.yaml` file:
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Example configuration.yaml entry
|
# Example configuration.yaml entry
|
||||||
@ -60,7 +63,7 @@ name:
|
|||||||
description: Name to use in the frontend.
|
description: Name to use in the frontend.
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: Random Sensor
|
default: Random sensor
|
||||||
minimum:
|
minimum:
|
||||||
description: Lower limit for the values.
|
description: Lower limit for the values.
|
||||||
required: false
|
required: false
|
||||||
@ -76,18 +79,3 @@ unit_of_measurement:
|
|||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
{% endconfiguration %}
|
{% endconfiguration %}
|
||||||
|
|
||||||
### Examples
|
|
||||||
|
|
||||||
In this section you find am example of how this sensor can be used.
|
|
||||||
|
|
||||||
Create a random sensor called "My random sensor" which will return a number between 10 (minimum) and 500 (maximum).
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# Example configuration.yaml entry
|
|
||||||
sensor:
|
|
||||||
- platform: random
|
|
||||||
name: "My random sensor"
|
|
||||||
minimum: 10
|
|
||||||
maximum: 500
|
|
||||||
```
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user