mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-15 13:26:54 +00:00
Rename sensor_class to device_class
This commit is contained in:
parent
4b6358c12b
commit
b83f3855ee
@ -29,7 +29,7 @@ Configuration variables:
|
||||
|
||||
- **command** (*Required*): The action to take to get the value.
|
||||
- **name** (*Optional*): Let you overwrite the the name of the device. By default *name* from the device is used.
|
||||
- **sensor_class** (*Optional*): The [type/class](/components/binary_sensor/) of the sensor to set the icon in the frontend.
|
||||
- **device_class** (*Optional*): The [type/class](/components/binary_sensor/) of the sensor to set the icon in the frontend.
|
||||
- **payload_on** (*Optional*): The payload that represents enabled state. Default is "ON".
|
||||
- **payload_off** (*Optional*): The payload that represents disabled state. Default is "OFF".
|
||||
- **value_template** (*Optional*): Defines a [template](/topics/templating/) to extract a value from the payload.
|
||||
@ -48,7 +48,7 @@ binary_sensor:
|
||||
- platform: command_line
|
||||
command: netstat -na | find "33322" | find /c "LISTENING" > nul && (echo "Running") || (echo "Not running")
|
||||
name: 'sickragerunning'
|
||||
sensor_class: moving
|
||||
device_class: moving
|
||||
payload_on: "Running"
|
||||
payload_off: "Not running"
|
||||
```
|
||||
@ -62,7 +62,7 @@ binary_sensor:
|
||||
- platform: command_line
|
||||
command: 'ping -c 1 rasplex.local | grep "1 received" | wc -l'
|
||||
name: 'is_rasplex_online'
|
||||
sensor_class: connectivity
|
||||
device_class: connectivity
|
||||
payload_on: 1
|
||||
payload_off: 0
|
||||
```
|
||||
@ -74,7 +74,7 @@ binary_sensor:
|
||||
platform: command_line
|
||||
name: Printer
|
||||
command: ping -W 1 -c 1 192.168.1.10 > /dev/null 2>&1 && echo success || echo fail
|
||||
sensor_class: connectivity
|
||||
device_class: connectivity
|
||||
payload_on: "success"
|
||||
payload_off: "fail"
|
||||
```
|
||||
|
@ -28,4 +28,4 @@ Configuration variables:
|
||||
|
||||
- **id** (*Required*): The ID of the device. This is the 4 bytes long number written on the dimmer.
|
||||
- **name** (*Optional*): An identifier for the switch in the frontend.
|
||||
- **sensor_class** (*Optional*): The [type/class](/components/binary_sensor/) of the sensor to set the icon in the frontend.
|
||||
- **device_class** (*Optional*): The [type/class](/components/binary_sensor/) of the sensor to set the icon in the frontend.
|
||||
|
@ -13,7 +13,7 @@ Binary sensors are gathering information about state of switches, contacts, pins
|
||||
|
||||
Knowing that there are only two states allows Home Assistant to represent the sensor better in the frontend.
|
||||
|
||||
Most binary sensors support the `sensor_class:` which let you specify the type of your sensor. The following types are supported:
|
||||
Most binary sensors support the `device_class:` which let you specify the type of your sensor. The following types are supported:
|
||||
|
||||
- **None**: Generic on/off
|
||||
- **cold**: On means cold (or too cold)
|
||||
|
@ -32,7 +32,7 @@ Configuration variables:
|
||||
- **qos** (*Optional*): The maximum QoS level of the state topic. Default is 0.
|
||||
- **payload_on** (*Optional*): The payload that represents on state. Default is "ON".
|
||||
- **payload_off** (*Optional*): The payload that represents state. Default is "OFF".
|
||||
- **sensor_class** (*Optional*): The [type/class](/components/binary_sensor/) of the sensor to set the icon in the frontend.
|
||||
- **device_class** (*Optional*): The [type/class](/components/binary_sensor/) of the sensor to set the icon in the frontend.
|
||||
- **value_template** (*Optional*): Defines a [template](/topics/templating/) to extract a value from the payload.
|
||||
|
||||
For a quick check you can use the commandline tools shipped with `mosquitto` to send MQTT messages. Set the state of a sensor manually:
|
||||
@ -52,7 +52,7 @@ binary_sensor:
|
||||
qos: 0
|
||||
payload_on: "1"
|
||||
payload_off: "0"
|
||||
sensor_class: opening
|
||||
device_class: opening
|
||||
value_template: '{% raw %}{{ value.x }}{% endraw %}'
|
||||
```
|
||||
|
||||
|
@ -52,7 +52,7 @@ Configuration variables:
|
||||
- **resource** (*Required*): The resource or endpoint that contains the value.
|
||||
- **method** (*Optional*): The method of the request. Default is GET.
|
||||
- **name** (*Optional*): Name of the REST binary sensor.
|
||||
- **sensor_class** (*Optional*): The [type/class](/components/binary_sensor/) of the sensor to set the icon in the frontend.
|
||||
- **device_class** (*Optional*): The [type/class](/components/binary_sensor/) of the sensor to set the icon in the frontend.
|
||||
- **value_template** (*Optional*): Defines a [template](/topics/templating/) to extract the value.
|
||||
- **payload** (*Optional*): The payload to send with a POST request. Usually formed as a dictionary.
|
||||
- **verify_ssl** (*Optional*): Verify the certification of the endpoint. Default to True.
|
||||
@ -80,7 +80,7 @@ binary_sensor:
|
||||
resource: http://192.168.0.5/digital/9
|
||||
method: GET
|
||||
name: Light
|
||||
sensor_class: light
|
||||
device_class: light
|
||||
value_template: {% raw %}'{{ value_json.return_value }}'{% endraw %}
|
||||
```
|
||||
|
||||
|
@ -29,7 +29,7 @@ Configuration variables:
|
||||
|
||||
- **sensors** array (*Required*): List of your sensors.
|
||||
- **friendly_name** (*Optional*): Name to use in the Frontend.
|
||||
- **sensor_class** (*Optional*): The [type/class](/components/binary_sensor/) of the sensor to set the icon in the frontend.
|
||||
- **device_class** (*Optional*): The [type/class](/components/binary_sensor/) of the sensor to set the icon in the frontend.
|
||||
- **value_template** (*Optional*): Defines a [template](/topics/templating/) to extract a value from the payload.
|
||||
- **entity_id** (*Optional*): Add a list of entity IDs so the sensor only reacts to state changes of these entities. This will reduce the number of times the sensor will try to update it's state.
|
||||
|
||||
@ -48,7 +48,7 @@ sensor:
|
||||
furnace_on:
|
||||
value_template: {% raw %}{{ states.sensor.furnace.state > 2.5 }}{% endraw %}
|
||||
friendly_name: 'Furnace Running
|
||||
sensor_class: heat
|
||||
device_class: heat
|
||||
```
|
||||
|
||||
### {% linkable_title Switch as sensor %}
|
||||
@ -61,10 +61,10 @@ binary_sensor:
|
||||
sensors:
|
||||
movement:
|
||||
value_template: {% raw %}"{{ states.switch.movement.state == 'on' }}"{% endraw %}
|
||||
sensor_class: motion
|
||||
device_class: motion
|
||||
door:
|
||||
value_template: {% raw %}"{{ states.switch.door.state == 'on' }}"{% endraw %}
|
||||
sensor_class: opening
|
||||
device_class: opening
|
||||
```
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ binary_sensor:
|
||||
sensors:
|
||||
co:
|
||||
friendly_name: 'CO'
|
||||
sensor_class: 'gas'
|
||||
device_class: 'gas'
|
||||
value_template: {% raw %}>-
|
||||
{%- if is_state("sensor.bedroom_co_status", "Ok")
|
||||
and is_state("sensor.kitchen_co_status", "Ok")
|
||||
|
@ -30,7 +30,7 @@ Configuration variables:
|
||||
|
||||
- **sensors** array (*Required*): List of your sensors.
|
||||
- **friendly_name** (*Optional*): Name to use in the Frontend.
|
||||
- **sensor_class** (*Optional*): The [type/class](/components/binary_sensor/) of the sensor to set the icon in the frontend.
|
||||
- **device_class** (*Optional*): The [type/class](/components/binary_sensor/) of the sensor to set the icon in the frontend.
|
||||
- **entity_id** (*Required*): The entity that this sensor tracks.
|
||||
- **attribute** (*Optional*): The attribute of the entity that this sensor tracks. If no attribute is specified then the sensor will track the state.
|
||||
- **invert** (*Optional*): Invert the result (so `true` means descending rather than ascending)
|
||||
@ -50,7 +50,7 @@ binary_sensor:
|
||||
temperature_up:
|
||||
friendly_name: 'Temp increasing'
|
||||
entity_id: sensor.skylight_temperature
|
||||
sensor_class: heat
|
||||
device_class: heat
|
||||
```
|
||||
|
||||
And this one indicates `true` if the temperature is falling:
|
||||
@ -62,6 +62,6 @@ binary_sensor:
|
||||
temperature_down:
|
||||
friendly_name: 'Temp decreasing'
|
||||
entity_id: sensor.skylight_temperature
|
||||
sensor_class: cold
|
||||
device_class: cold
|
||||
invert: Yes
|
||||
```
|
||||
|
@ -217,7 +217,7 @@ mqtt:
|
||||
discovery_prefix: homeassistant
|
||||
```
|
||||
|
||||
A motion detection device for your garden would sent its configuration as JSON payload `{"name": "garden", "sensor_class": "motion"}` to the topic `homeassistant/binary_sensor/garden/config`. After the first message to `config`, then the MQTT messages sent to `state`, eg. `homeassistant/binary_sensor/garden/state`, will update the state in Home Assistant.
|
||||
A motion detection device for your garden would sent its configuration as JSON payload `{"name": "garden", "device_class": "motion"}` to the topic `homeassistant/binary_sensor/garden/config`. After the first message to `config`, then the MQTT messages sent to `state`, eg. `homeassistant/binary_sensor/garden/state`, will update the state in Home Assistant.
|
||||
|
||||
## {% linkable_title Logging %}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user