Sonoff Switch

Hi all

I’ve purchased the sonoff button, paired it with the sonoff gateway and added it in HA with Sonoff Lan Hacs integration. Till here all fine. Since this isn’t a proper entity, I’ve been around on internet and on this community and I found out how to listen to the events and I got this feedback:

{
    "event_type": "state_changed",
    "data": {
        "entity_id": "sensor.sonoff_a48000919d",
        "old_state": {
            "entity_id": "sensor.sonoff_a48000919d",
            "state": "single",
            "attributes": {
                "friendly_name": "Switch1"
            },
            "last_changed": "2021-11-08T17:50:25.240460+00:00",
            "last_updated": "2021-11-08T17:50:25.240460+00:00",
            "context": {
                "id": "6fc782a8cd881b842a0045719c6207d3",
                "parent_id": null,
                "user_id": null
            }
        },
        "new_state": {
            "entity_id": "sensor.sonoff_a48000919d",
            "state": "",
            "attributes": {
                "friendly_name": "Switch1"
            },
            "last_changed": "2021-11-08T17:50:25.753798+00:00",
            "last_updated": "2021-11-08T17:50:25.753798+00:00",
            "context": {
                "id": "9814ffa0172a4452dbc6eab87e3721c7",
                "parent_id": null,
                "user_id": null
            }
        }
    },
    "origin": "LOCAL",
    "time_fired": "2021-11-08T17:50:25.753798+00:00",
    "context": {
        "id": "9814ffa0172a4452dbc6eab87e3721c7",
        "parent_id": null,
        "user_id": null
    }
}

The only answer I haven’t found yet is how to use this in an automation … I need to find a the trigger that can fire an event.
I’m really desperate because the only solution I found is how to use it when is added with the Conbee, but nobody say how to use with the “normal” way… maybe isn’t possible yet?

Hope somebody has the solution to this problem!

Thanks
Luca

I’ve found that the easiest way to use this button is with the following blueprint:

Try this:

trigger:
  - platform: state
    entity_id: sensor.sonoff_a48000919d
    to: 'single'
1 Like

He does not use ZHA, but SonoffLan. So that blueprint will not work.

1 Like

D’Oh… Missed that :man_facepalming:

It worked!!!
Thanksssssss!