Skip to content

Instantly share code, notes, and snippets.

@blakadder
Last active October 27, 2019 21:16
Show Gist options
  • Save blakadder/581d7964d93cd3fe85c8f1ee393b9f8d to your computer and use it in GitHub Desktop.
Save blakadder/581d7964d93cd3fe85c8f1ee393b9f8d to your computer and use it in GitHub Desktop.
GD-30W configuration.yaml entry
fan:
- platform: mqtt
name: "Diffuser"
availability_topic: "tele/GD-30W/LWT"
payload_available: "Online"
payload_not_available: "Offline"
state_topic: "tele/GD-30W/STATE"
state_value_template: "{{ value_json.POWER1 }}"
command_topic: "cmnd/GD-30W/POWER1"
payload_on: "ON"
payload_off: "OFF"
speed_state_topic: "tele/GD-30W/STATE"
speed_value_template: "{{ value_json.POWER3 }}"
speed_command_topic: "cmnd/GD-30W/POWER3"
payload_low_speed: "OFF"
payload_high_speed: "ON"
oscillation_state_topic: "stat/GD-30W/EFFECT"
oscillation_command_topic: "cmnd/GD-30W/EVENT"
oscillation_value_template: "{{ value }}"
payload_oscillation_on: "rgb_cycle"
payload_oscillation_off: "color"
qos: 1
speeds:
- low
- high
light:
- platform: mqtt
name: "Diffuser Lamp"
command_topic: "cmnd/GD-30W/EVENT"
state_topic: "tele/GD-30W/STATE"
state_value_template: "{% if value_json.POWER2 == 'ON' %}{% if value_json.POWER5 == 'ON' %}ON{% else %}OFF{% endif %}{% else %}OFF{% endif %}"
payload_on: "ON"
payload_off: "OFF"
brightness_command_topic: "cmnd/GD-30W/Dimmer"
brightness_state_topic: "tele/GD-30W/RESULT"
brightness_scale: 100
# brightness_value_template: "{{ value_json.Dimmer }}"
brightness_value_template: "{% if value_json.TuyaReceived is defined and value_json['TuyaReceived'].DpId == 108 %}{{ value_json['TuyaReceived'].Type3Data[12:14]|int(base=16) }}{% endif %}"
availability_topic: "tele/GD-30W/LWT"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
retain: false
rgb_command_topic: "cmnd/GD-30W/tuyasend3"
rgb_command_template: "{% set brightness = state_attr('light.diffuser_lamp','brightness') | int %}{{ '108,%02x%02x%02x646464' | format(red, green, blue)}}{{ '%02x' | format(brightness) }}"
rgb_value_template: "{% if value_json.TuyaReceived is defined and value_json['TuyaReceived'].DpId == 108 %}{{ (value_json['TuyaReceived'].Type3Data[0:2]|int(base=16),value_json['TuyaReceived'].Type3Data[2:4]|int(base=16),value_json['TuyaReceived'].Type3Data[4:6]|int(base=16)) | join(',')}}{% endif %}"
rgb_state_topic: "tele/GD-30W/RESULT"
binary_sensor:
- platform: mqtt
name: "Aromatherapy Water"
state_topic: "stat/GD-30W/POWER4"
payload_on: "ON"
payload_off: "OFF"
availability_topic: "tele/GD-30W/LWT"
payload_available: "Online"
payload_not_available: "Offline"
qos: 1
device_class: problem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment