Thanks @cooper for sending me in this direction. I know some of this info you will not need but Im going to put it in one post so others can see.
I have successfully gotten this working. The only down fall is it looks as though this only works for the on board momentary switch. However you can still use an external momentary if you solder two wires onto the pads in the picture below.
The way I have it configured is a single tap turns the relay on on the Sonoff, Double tap sends the mqtt topic of cmnd//POWER TOGGLE and if you hold it sends the topic cmnd//POWER HOLD
You will then configure the Sonoff like you normally would. @DrZzs has great video of how to get the sonoff up and running with Tasmota and HA.
Once you can access the Web UI of the sonoff and have the basics setup you will need to go to the console of the sonoff and enter the following commands
Once you have that configured you should be able to push the button and see the different topics in the console.
Now to configure Home assistant. I am sure there might be multiple ways to do this but here is how I got it to work. A note, with the double tap and Hold there is not an on and off command from the sonoff. So once you double tap or hold the switch that you have setup for that particular command will stay on until turned on in the HA UI. I fixed this with an Automation that would set it to off after 1 second.
Set up the HA configuration File.
For the Onboard Relay/Single Tap
switch
- platform: mqtt
name: "Sonoff Relay"
command_topic: "cmnd/sonoff/POWER"
state_topic: "stat/sonoff/POWER"
qos: 1
payload_on: "ON"
payload_off: "OFF"
retain: true
For the Double tap and hold. The sensor will equal the payload of either TOGGLE or HOLD depending on if you double tap or hold the switch.
Sensors
- platform: mqtt
name: "Sonoff Double Tap Hold"
state_topic: "cmnd/sonoff-button-tap/POWER"
qos: 1
expire_after: "1"
Setting up that Automations
- alias: Turn On with Double Tap
trigger:
- platform: state
entity_id: sensor.sonoff_double_tap_hold
to: 'TOGGLE'
condition:
condition: state
entity_id: switch.other_light
state: 'off'
action:
service: switch.turn_on
data:
entity_id: switch.other_light
- alias: Turn off with Double Tap
trigger:
- platform: state
entity_id: sensor.sonoff_double_tap_hold
to: 'TOGGLE'
condition:
condition: state
entity_id: switch.other_light
state: 'on'
action:
service: switch.turn_off
data:
entity_id: switch.other_light
You would use the same automation if you want to trigger with Hold just by changing state of the sensor to HOLD instead of TOGGLE. I know that this automation for on and off can be handled with a template but I have not figured templates out yet.
I hope this all makes sense. I can attempt to answer questions about what I have but not sure if I could go more in depth.
@DrZzs Since I had asked if you had ever worked with double taps earlier in this thread I didnt know if you would want to base one of your up coming videos on this. This idea came from attempting to make a cheaper version of the HomeSeer HS-WS100+ that I have purchased that is scene capable with the double and triple taps. Since I got this working on the sonoff these can essentially be done for about $15 using the sonoff and this momentary switch I found on Amazon to replace an existing switch. http://a.co/fEj8MIJ however it can probably be done much cheaper utilizing the touch buttons and momentary buttons you have used which I would like to try too.