New Component - Sonoff S20 running ESPEasy

@Bobby_Nobble

I am trying to get a Sonoff Touch to work using the MQTT broker running on Hass.io
About the MQTT_HOST address…

If I am using Duck DNS then do I still need to use the HA internal IP? or use the DuckDNS url?
Also I am using SSL on Duck DNS. I can only reach hass.io when I use https://hassio.local:8123

Hi

This is my first post here - so Hello everyone :-).

I have Hassbian on Raspberry Pi 2 and Sonoff Basic with Tasmota firmware.
configuration.yaml has:

mqtt:
    
switch:
  - platform: mqtt
    name: "sonoff-151"
    command_topic: "cmnd/sonoff-151/power"
    state_topic: "stat/sonoff-151/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true

Sonoff is on defaults, the only change is Host set to 10.0.0.7 in MQTT Parameters. Not working with default value ‘domus1’ as well.

Sonoff is visible in HA interface, it chages state to ‘Turned on’ for a 2-3 seconds (actually not toggled becasue I can’t hear the relay ‘click’) and returns to 'Turned Off with no action. It can be toggled by it’s own HTTP interfaces, so I can hear the ‘click’ - I’m sure it is working fine as device.

Tested with mqtt arendst’s Wiki configuration:

mqtt:
   port: 1883
   client_id: home-assistant-1
   keepalive: 60
   protocol: 3.1
   birth_message:
     topic: "tele/sonoff-151/LWT"
     payload: "Online"
     qos: 1
     retain: true
   will_message:
     topic: "tele/sonoff-151/LWT"
     payload: "Offline"
     qos: 1
     retain: true

but behaviour is exactly the same.

2018-02-22 22:25:47 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service_call_id=1971420752-5, service=turn_on, service_data=entity_id=switch.sonoff151, domain=homeassistant>
2018-02-22 22:25:47 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service_call_id=1971420752-6, service=turn_on, service_data=entity_id=['switch.sonoff151'], domain=switch>
2018-02-22 22:25:47 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1971420752-6>
2018-02-22 22:25:47 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service_call_id=1971420752-7, service=publish, service_data=topic=cmnd/sonoff-151/power, retain=True, qos=1, payload=ON, domain=mqtt>
2018-02-22 22:25:47 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1971420752-5>
2018-02-22 22:25:47 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1971420752-7>
2018-02-22 22:25:47 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1814892176: Sending {'success': True, 'id': 12, 'result': None, 'type': 'result'}
2018-02-22 22:25:47 DEBUG (MainThread) [hbmqtt.broker.plugins.packet_logger_plugin] home-assistant <-in-- PublishPacket(ts=2018-02-22 22:25:47.743196, fixed=MQTTFixedHeader(length=27, flags=0x3), variable=PublishVariableHeader(topic=cmnd/sonoff-151/power, packet_id=3), payload=PublishPayload(data="bytearray(b'ON')"))
2018-02-22 22:25:47 DEBUG (MainThread) [hbmqtt.mqtt.protocol.handler] Add message to delivery
2018-02-22 22:25:47 DEBUG (MainThread) [hbmqtt.mqtt.protocol.handler] Message queue size: 1
2018-02-22 22:25:47 DEBUG (MainThread) [hbmqtt.mqtt.protocol.handler] Delivering message <hbmqtt.session.IncomingApplicationMessage object at 0x5f91c228>
2018-02-22 22:25:47 DEBUG (MainThread) [hbmqtt.broker.plugins.packet_logger_plugin] home-assistant -out-> PubackPacket(ts=2018-02-22 22:25:47.752388, fixed=MQTTFixedHeader(length=2, flags=0x0), variable=PacketIdVariableHeader(packet_id=3), payload=None)
2018-02-22 22:25:47 DEBUG (MainThread) [hbmqtt.broker] home-assistant handling message delivery
2018-02-22 22:25:47 DEBUG (MainThread) [hbmqtt.broker] Retaining message on topic cmnd/sonoff-151/power
2018-02-22 22:25:47 DEBUG (MainThread) [hbmqtt.broker] broadcasting {'topic': 'cmnd/sonoff-151/power', 'session': Session(clientId=home-assistant, state=connected), 'data': bytearray(b'ON')}
2018-02-22 22:25:47 DEBUG (MainThread) [hbmqtt.mqtt.protocol.handler] 0 message(s) available for delivery

Can you help find out what is wrong ?

OK
It is working fine on Hassio with mosquitto, so it was problem specific to Hassbian