Adjust documentation for change of event (#13956)

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
Joakim Plate 2020-07-13 18:46:12 +02:00 committed by GitHub
parent 741b47e14f
commit b31d543f0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 80 additions and 95 deletions

View File

@ -60,11 +60,6 @@ devices:
description: Sets the [class of the device](/integrations/binary_sensor/), changing the device state and icon that is displayed on the frontend.
required: false
type: device_class
fire_event:
description: Fires an event even if the state is the same as before. Can be used for automations.
required: false
type: boolean
default: false
off_delay:
description: For sensors that only sends 'On' state updates, this variable sets a delay after which the sensor state will be updated back to 'Off'.
required: false

View File

@ -66,11 +66,6 @@ devices:
description: Override the name to use in the frontend.
required: true
type: string
fire_event:
description: Fires an event even if the state is the same as before. Can be used for automations.
required: false
default: false
type: boolean
automatic_add:
description: To enable the automatic addition of new covers (Siemens/LightwaveRF only).
required: false

View File

@ -59,11 +59,6 @@ devices:
description: Override the name to use in the frontend.
required: true
type: string
fire_event:
description: Fires an event even if the state is the same as before. Can be used for automations.
required: false
default: false
type: boolean
automatic_add:
description: To enable the automatic addition of new lights.
required: false

View File

@ -64,3 +64,83 @@ You can host your device on another computer by setting up ser2net and example c
```text
50000:raw:0:/dev/ttyUSB0:38400 8DATABITS NONE 1STOPBIT
```
## Events
The rftrx integration will signal an event on reception of messages from the RFXtrx device on the following form.
*Signal from a byron doorbell button:*
```yaml
packet_type: 22
sub_type: 0
type_string: "Byron SX"
id_string: "00:90"
data: "0716000100900970"
values:
Sound: 9
Battery numeric: 0
Rssi numeric: 7
```
*Event data from a Nexa wall socket switch:*
```yaml
packet_type: 16
sub_type: 1
type_string: 'ARC'
id_string': 'C3'
data: '0710010143030170'
values':
Command: 'On'
Rssi numeric': 7
```
You can setup automations to react to these events. When you do don't include more fields than needed. Always include the device identifying fields, `packet_type`, `sub_type` and `id_string`.
So for example to trigger a action when somebody presses the doorbell, you would set up a automation with the following trigger:
*Automation trigger:*
```yaml
- platform: event
event_type: rfxtrx_event
event_data:
packet_type: 22
sub_type: 0
id_string: "00:90"
values:
Sound: 9
```
*A more complete example with scene activation:*
```yaml
light:
platform: demo
scene:
name: WelcomeScene
entities:
light.bed_light: on
light.ceiling_lights: off
automation:
- alias: Use doorbell button to trigger scene
trigger:
- platform: event
event_type: rfxtrx_event
event_data:
packet_type: 22
sub_type: 0
id_string: "00:90"
values:
Sound: 9
action:
service: scene.turn_on
entity_id: scene.welcomescene
```
### Discovering events for your devices
To figure out what your devices send, you can listen on the `rfxtrx_event` in the development tool/event page.

View File

@ -85,9 +85,6 @@ sensor:
platform: rfxtrx
automatic_add: true
devices:
0a52080705020095220269:
name: Lving
fire_event: true
0a520802060100ff0e0269:
name: Bath
data_type:
@ -105,11 +102,6 @@ devices:
description: Override the name to use in the frontend.
required: false
type: string
fire_event:
description: Fires an event even if the state is the same as before. Can be used for automations.
required: false
default: false
type: boolean
data_type:
description: Which data type the sensor should show.
required: false

View File

@ -50,11 +50,6 @@ devices:
description: Override the name to use in the frontend.
required: true
type: string
fire_event:
description: Fires an event even if the state is the same as before, for example, a doorbell switch. Can also be used for automations.
required: false
default: false
type: boolean
automatic_add:
description: To enable the automatic addition of new switches.
required: false
@ -110,71 +105,4 @@ switch:
name: Movement2
0b1111e003af16aa10000060:
name: Door
fire_event: true
```
Light hallway if doorbell is pressed (when is sun down):
```yaml
# Example configuration.yaml entry
switch:
platform: rfxtrx
automatic_add: false
devices:
0710014c440f0160:
name: Hall
"0710010244080780":
name: Door
fire_event: true
automation:
- alias: Switch the light on when doorbell rings if the sun is below the horizon and the light was off
trigger:
platform: event
event_type: button_pressed
event_data: {"entity_id": "switch.door"}
condition:
condition: and
conditions:
- condition: state
entity_id: sun.sun
state: "below_horizon"
- condition: state
entity_id: switch.hall
state: 'off'
action:
- service: switch.turn_on
entity_id: switch.hall
```
Use remote to enable scene (using event_data):
```yaml
# Example configuration.yaml entry
switch:
platform: rfxtrx
automatic_add: false
devices:
0b1100ce3213c7f210010f70:
name: Light1
0b11000a02ef2gf210010f50:
name: Light2
0b1111e003af16aa10000060:
name: Keychain remote
fire_event: true
scene:
name: Livingroom
entities:
switch.light1: on
switch.light2: on
automation:
- alias: Use remote to enable scene
trigger:
platform: event
event_type: button_pressed
event_data: {"state": "on", "entity_id": "switch.keychain_remote"}
action:
service: scene.turn_on
entity_id: scene.livingroom
```