Page 2 of 3
Re: Sonoff - WiFi Wireless Smart Switch For MQTT
Posted: Sun Feb 25, 2018 8:21 am
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
Re: Sonoff - WiFi Wireless Smart Switch For MQTT
Posted: Sun Feb 25, 2018 10:36 am
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)
Re: Sonoff - WiFi Wireless Smart Switch For MQTT
Posted: Mon Feb 26, 2018 10:23 am
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.
Re: Sonoff - WiFi Wireless Smart Switch For MQTT
Posted: Sat Mar 03, 2018 6:31 pm
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!
Re: Sonoff - WiFi Wireless Smart Switch For MQTT
Posted: Sun Mar 04, 2018 10:59 am
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.
Re: Sonoff - WiFi Wireless Smart Switch For MQTT
Posted: Mon Mar 05, 2018 9:22 pm
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...
Re: Sonoff - WiFi Wireless Smart Switch For MQTT
Posted: Sun Mar 18, 2018 7:36 pm
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
Re: Sonoff - WiFi Wireless Smart Switch For MQTT
Posted: Sat Mar 24, 2018 10:31 am
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?
Re: Sonoff - WiFi Wireless Smart Switch For MQTT
Posted: Sat Mar 24, 2018 12:46 pm
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.
Re: Sonoff - WiFi Wireless Smart Switch For MQTT
Posted: Sat Mar 24, 2018 1:42 pm
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.