Random
The Random (Helper) integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] creates random values or a random state. This is useful when 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 create a random helper is through the user interface.
- Go to Settings > Devices & services > Helpers, and select Create helper.
- Select Random.
- Select Random binary sensor to create random states or Random sensor to create random values.
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.yamlThe configuration.yaml file is the main configuration file for Home Assistant. It lists the integrations to be loaded and their specific configurations. In some cases, the configuration needs to be edited manually directly in the configuration.yaml file. Most integrations can be configured in the UI. [Learn more] file:
# Example configuration.yaml entry
binary_sensor:
- platform: random
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.yamlThe configuration.yaml file is the main configuration file for Home Assistant. It lists the integrations to be loaded and their specific configurations. In some cases, the configuration needs to be edited manually directly in the configuration.yaml file. Most integrations can be configured in the UI. [Learn more] file:
# Example configuration.yaml entry
sensor:
- platform: random
Troubleshooting
The Random helper option is missing from the user interface
Symptom
When you go to Settings > Devices & services > Helpers to add a helper, the Random option is not listed.
Description
Random helpers are provided through default_config:, which is part of your configuration.yamlThe configuration.yaml file is the main configuration file for Home Assistant. It lists the integrations to be loaded and their specific configurations. In some cases, the configuration needs to be edited manually directly in the configuration.yaml file. Most integrations can be configured in the UI. [Learn more] by default. If you removed default_config:, the option is no longer available.
Resolution
- Add
random:to yourconfiguration.yamlThe configuration.yaml file is the main configuration file for Home Assistant. It lists the integrations to be loaded and their specific configurations. In some cases, the configuration needs to be edited manually directly in the configuration.yaml file. Most integrations can be configured in the UI. [Learn more]. - Restart Home Assistant.
- After the restart, create your random helpers from the user interface.