-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Create binary_sensor.xiaomi_gw.markdown #3029
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Initial commit for binary_sensors sub-component of xiaomi_gw
message: Fire/Smoke detected! | ||
- service: xiaomi.play_ringtone | ||
data: | ||
gw_sid: xxxxxxxxxxxx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should now be gw_mac
action: | ||
service: xiaomi.play_ringtone | ||
data: | ||
gw_sid: xxxxxxxxxxxx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should now be gw_mac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! fixed 👍
Do you like to add the following example automation for the cube?
# Trigger for a few cube events
- alias: Cube event flip90
trigger:
platform: event
event_type: cube_action
event_data:
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
action_type: flip90
action:
- service: light.turn_on
entity_id: light.gateway_light_28xxxxxxxxxx
data:
color_name: "springgreen"
- alias: Cube event flip180
trigger:
platform: event
event_type: cube_action
event_data:
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
action_type: flip180
action:
- service: light.turn_on
entity_id: light.gateway_light_28xxxxxxxxxx
data:
color_name: "darkviolet"
- alias: Cube event move
trigger:
platform: event
event_type: cube_action
event_data:
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
action_type: move
action:
- service: light.turn_on
entity_id: light.gateway_light_28xxxxxxxxxx
data:
color_name: "gold"
- alias: Cube event tap_twice
trigger:
platform: event
event_type: cube_action
event_data:
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
action_type: tap_twice
action:
- service: light.turn_on
entity_id: light.gateway_light_28xxxxxxxxxx
data:
color_name: "deepskyblue"
- alias: Cube event shake_air
trigger:
platform: event
event_type: cube_action
event_data:
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
action_type: shake_air
action:
- service: light.turn_on
entity_id: light.gateway_light_28xxxxxxxxxx
data:
color_name: "blue" |
ringtone_id: 2 | ||
ringtone_vol: 100 | ||
``` | ||
- Smoke |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move the headline "Smoke" above the "Send notification on fire alarm" automation. :-)
ringtone_vol: 100 | ||
``` | ||
- Smoke | ||
- Gas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Gas
# Trigger for natgas detected
- alias: Send notification on gas alarm
trigger:
platform: state
entity_id: binary_sensor.natgas_sensor_158dxxxxxxxxxx
from: 'off'
to: 'on'
action:
- service: notify.html5
data_template:
title: Gas alarm!
message: 'Gas with a density of {{ states.binary_sensor.natgas_sensor_158dxxxxxxxxxx.attributes.density }} detected.'
- Smoke | ||
- Gas | ||
- Xiaomi Wireless Button (available events are `single`, `double`, `hold`, `long_click_press` and `long_click_release`). | ||
```yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new/square version of the Xiaomi Wireless Button just supports single
and double
click. Furthermore the space between two clicks to generate a double click must be quite large now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! everything fixed!
Updated automation examples Some other fixes
The wireless wall switch (86sw1, 86sw2) is the last missing binary_sensor. I will provide a few lines tomorrow. |
The Aqara Wireless Switch is available as single-key and double-key version. Each key behaves like the Wireless Button limited to the click event - alias: Decrease brightness of the gateway light
trigger:
platform: event
event_type: click
event_data:
entity_id: binary_sensor.wall_switch_left_158xxxxxxxxx12
click_type: single
action:
service: light.turn_on
entity_id: light.gateway_light_34xxxxxxxx13
data_template:
brightness: >-
{% if states.light.gateway_light_34xxxxxxxx13.attributes.brightness %}
{% if states.light.gateway_light_34xxxxxxxx13.attributes.brightness - 60 >= 10 %}
{{states.light.gateway_light_34xxxxxxxx13.attributes.brightness - 60}}
{% else %}
{{states.light.gateway_light_34xxxxxxxx13.attributes.brightness}}
{% endif %}
{% else %}
10
{% endif %}
- alias: Increase brightness of the gateway light
trigger:
platform: event
event_type: click
event_data:
entity_id: binary_sensor.wall_switch_right_158xxxxxxxxx12
click_type: single
action:
service: light.turn_on
entity_id: light.gateway_light_34xxxxxxxx13
data_template:
brightness: >-
{% if states.light.gateway_light_34xxxxxxxx13.attributes.brightness %}
{% if states.light.gateway_light_34xxxxxxxx13.attributes.brightness + 60 <= 255 %}
{{states.light.gateway_light_34xxxxxxxx13.attributes.brightness + 60}}
{% else %}
{{states.light.gateway_light_34xxxxxxxx13.attributes.brightness}}
{% endif %}
{% else %}
10
{% endif %}
- alias: Turn off the gateway light
trigger:
platform: event
event_type: click
event_data:
entity_id: binary_sensor.wall_switch_both_158xxxxxxxxx12
click_type: both
action:
service: light.turn_off
entity_id: light.gateway_light_34xxxxxxxx13 |
Oh nice, do you think it will be possible to also support the award wall switch with its buttons set to wireless mode? (as if shows on the Mi home app preferences for the switch) |
@jcastro Unfortunately, no. The device doesn't fire events in decoupled mode at the moment. I will implement the feature as soon a new gateway firmware introduces a new behaviour. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will merge it and address the issues with #3045.
Initial commit for binary_sensors sub-component of xiaomi_gw
Description:
Pull request in home-assistant (if applicable): home-assistant/home-assistant#