From 18d6fe3db1704126329bad9095de67b006119d77 Mon Sep 17 00:00:00 2001 From: Monster Date: Sun, 15 Jan 2017 02:34:59 +0300 Subject: [PATCH] Update README.md --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 82e6aac..bfe52ff 100644 --- a/README.md +++ b/README.md @@ -35,3 +35,29 @@ aqara: General discussions: - https://community.home-assistant.io/t/beta-xiaomi-gateway-integration/8213/288 + +## Home assistant examples: +- Gateway rgb light as home assistant bulb template +``` +- platform: mqtt_template + name: "Main Gateway" + state_topic: "home/gateway/main/rgb" + command_topic: "home/gateway/main/rgb/set" + command_on_template: "{%- if red is defined and green is defined and blue is defined -%}{{ red }},{{ green }},{{ blue }}{%- else -%}255,179,0{%- endif -%},{%- if brightness is defined -%}{{ (float(brightness) / 255 * 100) | round(0) }}{%- else -%}100{%- endif -%}" + command_off_template: "0,0,0,0" + state_template: "{%- if value.split(',')[3]| float > 0 -%}on{%- else -%}off{%- endif -%}" # must return `on` or `off` + brightness_template: "{{ (float(value.split(',')[3])/100*255) | round(0) }}" + red_template: "{{ value.split(',')[0] | int }}" + green_template: "{{ value.split(',')[1] | int }}" + blue_template: "{{ value.split(',')[2] | int }}" +``` + +- Switch automation example: +``` +trigger: + platform: mqtt + topic: home/switch/hall/status + payload: 'click' +action: + service: script.hall_force_light_on +```