Help configuring Ewelink Automation

Has anyone successfully set up an automation using the ewelink add-on? I’ve followed the directions on set-up here:https://sonoff.tech/product-review/tutorial/how-to-add-your-sonoff-devices-on-home-assistant/. It states “To use eWeLink Support devices in Automation, you need to first create a Scene that contains your devices, and then select Activate Scenario in Action > Action Type of Automation.” The switch works fine when I switch it to On in the Lovelace UI, yet does not work when run the Scene. What am I missing?

Here is what I've set up in scenes.yaml:
- id: '1627504044505'
  name: Garage Door Open
  entities:
    switch.100097d1d3:
      restored: false
      supported_features: 0
      friendly_name: Garage Door
      state: 'on'

And here is my configuration.yaml:


# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

binary_sensor:
#Car Remote-Porch Light
  - platform: mqtt
    name: "Car Remote-Porch Light"
    state_topic: "tele/sonoff-bridge/RESULT"
    value_template: '{{value_json.RfReceived.Data}}'
    payload_on: "44D746"
    payload_off: "44D746_off"
    off_delay: 2
    device_class: light
    qos: 1
#Car Remote-Garage Open
  - platform: mqtt
    name: "Car Remote-Garage Open"
    state_topic: "tele/sonoff-bridge/RESULT"
    value_template: '{{value_json.RfReceived.Data}}'
    payload_on: "24E746"
    payload_off: "24E746_off"
    off_delay: 2
    device_class: garage_door
    qos: 1
#Car Remote-Disarm Note* Would like to toggle from arm to disarm
  - platform: mqtt
    name: "Car Remote-Disarm Alarm"
    state_topic: "tele/sonoff-bridge/RESULT"
    value_template: '{{value_json.RfReceived.Data}}'
    payload_on: "11F406"
    payload_off: "11F406_off"
    off_delay: 2
    device_class: problem
    qos: 1



switch:
  - platform: template
    switches:
      ewelink_virtual_switch:
        turn_on:
          service: switch.turn_on
        turn_off:
          service: switch.turn_off

Looking at the logs in the EweLink Add-on, the scene trigger seems to be working fine, this is what comes out:

HA emit call_service event {
  domain: 'scene',
  service: 'turn_on',
  service_data: { entity_id: 'scene.garage_door_open' }
}

After pressing the switch in the Lovelace UI (the switch opens the garage door just fine):

receive CK-WS msg:   type--> message
receive CK-WS msg:
 {"action":"update","deviceid":"100097d1d3","apikey":"<Truncated>","userAgent":"device","sequence":"1627509186690","params":{"switch":"on"},"from":"device","seq":"128"}
Jia ~ file: eventBus.ts ~ line 11 ~ eventBus.on ~ data {
  action: 'update',
  deviceid: '100097d1d3',
  apikey: '<Truncated>',
  userAgent: 'device',
  sequence: '1627509186690',
  params: { switch: 'on' },
  from: 'device',
  seq: '128'
}
Found Lan Switch
getDataSync: disabled.json -> 100097d1d3 no data
Found Lan Switch
getDataSync: disabled.json -> 100097d1d3 no data
Found Lan Switch
getDataSync: disabled.json -> 100097d1d3 no data
Found Lan Switch
getDataSync: disabled.json -> 100097d1d3 no data
receive CK-WS msg:   type--> message
receive CK-WS msg:
 {"action":"update","deviceid":"100097d1d3","apikey":"<Truncated>","userAgent":"device","params":{"switch":"off"},"from":"device","seq":"129"}
Jia ~ file: eventBus.ts ~ line 11 ~ eventBus.on ~ data {
  action: 'update',
  deviceid: '100097d1d3',
  apikey: '<Truncated>',
  userAgent: 'device',
  params: { switch: 'off' },
  from: 'device',
  seq: '129'
}
Found Lan Switch
getDataSync: disabled.json -> 100097d1d3 no data
Found Lan Switch
getDataSync: disabled.json -> 100097d1d3 no data

SOLVED! I went back to the basics and realized I needed to understand the difference between a Scene vs. Automation. I updated the original Automation so the ‘action’ section makes a switch.turn_on service call to the correct entity, all done through the GUI.

- id: '1627502653830'
  alias: Car Remote-Garage Open
  description: ''
  trigger:
  - platform: mqtt
    topic: tele/sonoff-bridge/RESULT
    id: Car Remote-Garage Open
    value_template: '{{value_json.RfReceived.Data}}'
    payload: 24E746
  condition: []
  action:
  - service: switch.turn_on
    target:
      entity_id: switch.100097d1d3
  mode: single

2 Likes

Hi, can you please elaborate on that?

I have the same situation, however, as I am a nooooob, I cannot understand how are you using mqtt and tha payload as a trigger.

My automation is already set up correctly, I only need to set up a trigger somehow from the state change of the Sonoff switch.

I can create a scene with that switch on. How can I use that scene as a trigger?

Thanks

2 Likes