Sonoff - WiFi Wireless Smart Switch For MQTT

Building and connecting hardware to OpenNethome
perjarle
Posts: 32
Joined: Wed Aug 03, 2016 8:08 am

Re: Sonoff - WiFi Wireless Smart Switch For MQTT

Post by perjarle »

Thank you for replying

I think the best solution would be a MqttButton.
Preferably with more than 2 available actions to make it more universal.

If it also can be controlled by external command such as Jabber it would be awesome

Best regards
PJ
stefangsbb
Site Admin
Posts: 313
Joined: Sun Nov 30, 2014 2:16 pm

Re: Sonoff - WiFi Wireless Smart Switch For MQTT

Post by stefangsbb »

Hmm, sounds reasonable - but differs a bit from the standard pattern in ONH. Maybe the Item would be called MQTTMessage instead then? If there are multiple actions, should they all share the same topic? So the Item would be a MQTTTopicController, with actions like "Message1", "Message2" and so on and you configure the messages?
Or do you think it is better to have separate topic for each action button? (I am guessing not, since then there is nothing really holding them together)
perjarle
Posts: 32
Joined: Wed Aug 03, 2016 8:08 am

Re: Sonoff - WiFi Wireless Smart Switch For MQTT

Post by perjarle »

I think your suggestion about MQTTMessage and MQTTTopicController sounds reasonable as it follows the same pattern as the SMPP logic

And yes, i think they should share the topic.
Don MC
Posts: 31
Joined: Mon Nov 16, 2015 7:40 am

Re: Sonoff - WiFi Wireless Smart Switch For MQTT

Post by Don MC »

This one is very interesting too. Would be great to control this with ONH.
https://www.itead.cc/sonoff-4ch-pro.html

Oh, the possibilities!
Don MC
Posts: 31
Joined: Mon Nov 16, 2015 7:40 am

Re: Sonoff - WiFi Wireless Smart Switch For MQTT

Post by Don MC »

I ordered one of those Sonoff 4ch Pros. I’m not good at programming/coding, but I could help with testing, if that would help anyone.
stefangsbb
Site Admin
Posts: 313
Joined: Sun Nov 30, 2014 2:16 pm

Re: Sonoff - WiFi Wireless Smart Switch For MQTT

Post by stefangsbb »

I have now added a MqttComander and MqttLamp in the nightly build according to what we discussed. Take them for a spin and say what you think...
perjarle
Posts: 32
Joined: Wed Aug 03, 2016 8:08 am

Re: Sonoff - WiFi Wireless Smart Switch For MQTT

Post by perjarle »

Hi
I have tested the MQTT lamp, and it works fine sending out messages.

But in addition to sending out messages, it needs to subscribe to the same topic. If not it will not update it's status when the messages come from other sources.

Same functionality as Nexa which listen for events
perjarle
Posts: 32
Joined: Wed Aug 03, 2016 8:08 am

Re: Sonoff - WiFi Wireless Smart Switch For MQTT

Post by perjarle »

Hi
I have been testing MQTTLamp a bit more.

It works excellent for one way communication. It sends out mitt messages when turning on and off.

The one thing I miss is that it will update it's status if on- and off-messages are sent from other sources.

I have made a mitt receiver for my garage door using a Wemos D1 (ESP8266), a relay and a reed switch.
It listen for mqtt messages such as open and close. The reed switch determine if the door is open or close, and is sending a mqtt message every minute. If it is open, it sends the open-message. And close-message if it is closed.

It would be very nice if the MQTT lamp would update it's status when it receives open or closed.

I tried solving it with the MQTTRemapButton, but i can't get it working.

I think this functionality will be very useful for typical IOT projects.

Do you have an advice for me?
stefangsbb
Site Admin
Posts: 313
Joined: Sun Nov 30, 2014 2:16 pm

Re: Sonoff - WiFi Wireless Smart Switch For MQTT

Post by stefangsbb »

Ok, thanks for the feedback. To let it be updated by the messages sound like a good idea, I will fix that. One small problem is that you will have to make sure there is a MqttClient configured to subscribe for that topic.
stefangsbb
Site Admin
Posts: 313
Joined: Sun Nov 30, 2014 2:16 pm

Re: Sonoff - WiFi Wireless Smart Switch For MQTT

Post by stefangsbb »

I have now updated the MqttLamp so it also listens for messages and updates its state accordingly. I also added the toggle function. It is in the Nightly build.
Post Reply