Simple Homie firmware to run on Sonoff dual. Simply exposes a homie node with both relays and both buttons as device attributes.
Sonoff Dual R2 config :
Button #0 : GPIO3 (RX)
Button #1 : GPIO9
Relay #0 : GPIO12
Relay #1 : GPIO5
Case button : GPIO10
Status led : GPIO13