Random

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.

Configuration

The preferred way to configure random helpers is via the user interface at Settings > Devices & services > Helpers and select the add button; next, select the Random option.

To be able to add Helpers via the user interface, you should have default_config: in your configuration.yamlconfiguration.yaml 文件是 Home Assistant 的主要配置文件。它列出了要加载的集成及其特定配置。在某些情况下,需要直接在 configuration.yaml 文件中手动编辑配置。大多数集成可以在 UI 中配置。 [Learn more]. 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.yamlconfiguration.yaml 文件是 Home Assistant 的主要配置文件。它列出了要加载的集成及其特定配置。在某些情况下,需要直接在 configuration.yaml 文件中手动编辑配置。大多数集成可以在 UI 中配置。 [Learn more] first, then you can use the UI.

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.yamlconfiguration.yaml 文件是 Home Assistant 的主要配置文件。它列出了要加载的集成及其特定配置。在某些情况下,需要直接在 configuration.yaml 文件中手动编辑配置。大多数集成可以在 UI 中配置。 [Learn more] file:

# Example configuration.yaml entry
binary_sensor:
  - platform: random

Configuration Variables

name string (Optional, default: Random binary sensor)

Name to use in the frontend.

Sensor

The random sensor creates random sensor values (integers) out of a given range. Returned values form a 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.yamlconfiguration.yaml 文件是 Home Assistant 的主要配置文件。它列出了要加载的集成及其特定配置。在某些情况下,需要直接在 configuration.yaml 文件中手动编辑配置。大多数集成可以在 UI 中配置。 [Learn more] file:

# Example configuration.yaml entry
sensor:
  - platform: random

Configuration Variables

name string (Optional, default: Random sensor)

Name to use in the frontend.

minimum string (Optional, default: 0)

Lower limit for the values.

maximum integer (Optional, default: 20)

Upper limit for the values.

unit_of_measurement string (Optional)

Defines the units of measurement of the sensor, if any.