Skip to content

Commit

Permalink
docs(custom-controllers): change documentation for call service
Browse files Browse the repository at this point in the history
  • Loading branch information
xaviml committed Nov 27, 2020
1 parent f70fa91 commit 70a5b32
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions docs/others/custom-controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,27 +189,16 @@ Class: `Controller` or any type of Controller

This custom controller is the different one from the previous ones. This one allows you to freely call Home Assistant services when events are triggered. We can use `mapping` attribute like others and the use of the key value is the same, it defines the trigger event. However, the value changes since there are not predefined actions, you will need to specify the service (or services) and its data. We will see it better with an example.

Imagine I have a Hue dimmer switch and a normal light that only have on/off states (no brightness, no colors). Then I will be having two buttons that will be doing nothing. However, this controller will be used by my grandfather and he sometimes needs helps. Here is custom controller comes, so we can call two HA script (that do something useful for my grandfather) with the brightness up button and send a notification to Telegram with brightness down one.
Imagine I have a Hue dimmer switch and a normal light that only have on/off states (no brightness, no colors). Then I will be having two buttons that will be doing nothing. However, this controller will be used by my grandfather and he sometimes needs helps. Here is where custom controller comes, so we can call two HA script (that do something useful for my grandpa) with the brightness up button and send a notification to Telegram with brightness down one.

```yaml
# We first define a HueDimmerController to control the light
# and just giving permission to the "on" and "off" buttons
hue_dimmer_example:
module: controllerx
class: HueDimmerController
controller: sensor.office_controller_action
integration: z2m
light: light.office
actions:
- on-press
- off-press

custom_hue_dimmer_example:
module: controllerx
class: HueDimmerController
controller: sensor.office_controller_action
integration: z2m
mapping:
merge_mapping:
up-press:
- service: script.my_script
- service: script.my_script2
Expand Down

0 comments on commit 70a5b32

Please sign in to comment.