Skip to content

Instantly share code, notes, and snippets.

@tribut
Created August 6, 2019 14:26
Show Gist options
  • Save tribut/ddde2ef1e2fa3919c50c4ab9c03e7056 to your computer and use it in GitHub Desktop.
Save tribut/ddde2ef1e2fa3919c50c4ab9c03e7056 to your computer and use it in GitHub Desktop.
Esphome config for DS102 (3 Gang)
substitutions:
device_name: your_device_name
friendly_name: "Your Device Name"
api_password: !secret api_password
ota_password: !secret ota_password
esphome:
name: ${device_name}
platform: ESP8266
board: esp01_1m
wifi:
ssid: !secret wifi_name
password: !secret wifi_pass
fast_connect: True
# Enable logging
logger:
# Enable Home Assistant API
api:
password: ${api_password}
ota:
password: ${ota_password}
# Status LED
status_led:
pin:
number: GPIO0
inverted: True
binary_sensor:
- platform: gpio
pin:
number: GPIO12
mode: INPUT_PULLUP
inverted: True
name: "${friendly_name} Button Left"
on_press:
- switch.toggle: relay_1
- platform: gpio
pin:
number: GPIO3
mode: INPUT_PULLUP
inverted: True
name: "${friendly_name} Button Middle"
on_press:
- switch.toggle: relay_2
- platform: gpio
pin:
number: GPIO5
mode: INPUT_PULLUP
inverted: True
name: "${friendly_name} Button Right"
on_press:
- switch.toggle: relay_3
switch:
- platform: gpio
name: "${friendly_name} Relay Left"
pin: GPIO13
id: relay_1
on_turn_on:
- light.turn_on: left_led_light
on_turn_off:
- light.turn_off: left_led_light
- platform: gpio
name: "${friendly_name} Relay Middle"
pin: GPIO4
id: relay_2
on_turn_on:
- light.turn_on: middle_led_light
on_turn_off:
- light.turn_off: middle_led_light
- platform: gpio
name: "${friendly_name} Relay Right"
pin: GPIO15
id: relay_3
on_turn_on:
- light.turn_on: right_led_light
on_turn_off:
- light.turn_off: right_led_light
output:
- platform: esp8266_pwm
id: left_led
pin: GPIO16
inverted: True
- platform: esp8266_pwm
id: middle_led
pin: GPIO14
inverted: True
- platform: esp8266_pwm
id: right_led
pin: GPIO1
inverted: True
light:
- platform: monochromatic
name: "${friendly_name} LED Left"
output: left_led
internal: true
id: left_led_light
- platform: monochromatic
name: "${friendly_name} LED Middle"
output: middle_led
internal: true
id: middle_led_light
- platform: monochromatic
name: "${friendly_name} LED Right"
output: right_led
internal: true
id: right_led_light
@faxemaxee
Copy link

hey,

I found your template while desperately trying to find a working config for the 2-gang version using Tasmota. I was able to find a GPIO mapping in the Tasmota docs but it always turns on the left LED only. Do you also have a working config for the 2 gang version I might apply to the Tasmota template?

Best regards,

Max

@faxemaxee
Copy link

hey,

I found your template while desperately trying to find a working config for the 2-gang version using Tasmota. I was able to find a GPIO mapping in the Tasmota docs but it always turns on the left LED only. Do you also have a working config for the 2 gang version I might apply to the Tasmota template?

Best regards,

Max

I found a solution in an open issue, for everyone coming here to find the answer: here

or the actual template:

{"NAME":"DS-102 2 Gang","GPIO":[158,57,0,17,22,18,0,0,0,21,56,255,0],"FLAG":0,"BASE":18}

@tribut
Copy link
Author

tribut commented Oct 3, 2019

Hey @faxemaxee,

great to hear you were successful. I only own the 1- and 3-gang variants, so I would not have been of much help anyway. Not surprised that the 2-gang template is erroneous though, there were problems with the other templates as well.

Cheers
felix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment