Closed kmehran closed 5 years ago
I designed a wifi light-switch, based on Homie and Openhab Server, the first important function of each light switch is turning on and off the lights, but it cannot turn on/off the light during wifi/mqtt connection or even when one or both of them lost. One of the Most important matter about adding extra functionality or new technology to an old system (like Light Switch) is do not affect its basic function(s).
I found this somewhere else here, maybe in another issue description, the solution is depending on your implementation that you run the loop where you handle the events the manual switch raises in the mail loop in addition to the Homie.loop(). Here an excerpt of one of my implementations:
void loop()
{
Homie.loop();
button.tick();
}
In this firmware is use the lib "OneButton" for handling a button, it is a uplight control firmware and the uplight has one button where you can turn it on and off in addtion to control it with Homie. You can see the "loop" for handling the button events is also in the main loop where the Homie.loop() is too. So both are run and no matter how the Homie state is the button events are processed...
Dear Alexander,
That should be my solution, thanks for your complete answer.
Regards, Kaveh.
Sent from my iPhone
On Oct 22, 2018, at 10:37 AM, Alexander Leisentritt notifications@github.com wrote:
I found this somewhere else here, maybe in another issue description, the solution is depending on your implementation that you run the loop where you handle the events the manual switch raises in the mail loop in addition to the Homie.loop(). Here an excerpt of one of my implementations:
void loop() {
Homie.loop();button.tick(); } In this firmware is use the lib "OneButton" for handling a button, it is a uplight control firmware and the uplight has one button where you can turn it on and off in addtion to control it with Homie. You can see the "loop" for handling the button events is also in the main loop where the Homie.loop() is too. So both are run and no matter how the Homie state is the button events are processed...
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
See here, how to change the Homie-ESP8266 sources to get your desired behavior:
@euphi, as this is labeled with Feature_V3
, does it means that this will be added to develop-v3 branch?
I'm trying to build Wemos D1 based multi-relay switch and recently I found this repo. Because OpenHab support homie 3.x I want to use this library.
As many wrote before sometimes we don't want to wait for MQTT to connect at the start, the most important thing is the working relay.
I've found an example that I want to use as a base for my sketch - https://github.com/homieiot/homie-esp8266/blob/develop-v3/examples/IteadSonoffButton/IteadSonoffButton.ino
How should I change it so that I can toggle replay when I don't have MQTT connected? Example showing such behavior would be awesome.
Closed with #490.
[...template with no change deleted...]