Help on ideias for code


  • Hardware Contributor

    Hello all, I'm now building my project to control my home, mainly I'm using my custom board that you can find on openhardware, here.

    The main feature of this board is the ability to control the lights from the controller (openhab) and a switch that I add directly connected to the node. My main idea is to keep the mechanic switches of my house and add it the stack of controlling by openhab. Now my main problem.

    If by some problem my gateway is down or my server with openhab is down, the node will not enter the loop part of the arduino code, and I will not be able to control my nodes.

    My idea is that the node boots without depending on the gateway, so that I can control it always, I know that there is a variable to declare that does this, can you tell me what it is?

    Now a question, lets assume that I boot my node and my gateway is down. And then the gateway comes back online, will I have to reboot all my nodes to they register on the gateway?

    Second problem, my gateway is a MQTT gateway, so allso, if my MQTT broker is down, the gateway will not boot. Can I bypass that and make it control only my nodes, without the MQTT? And what will happen when the MQTT broker comes back online?

    Thank You



  • Not sure about the MQTT thing, but in general, you may add a

    #define MY_TRANSPORT_WAIT_READY_MS 1
    

    to make nodes fully boot and enter the loop() without connection to the controller. As soon as the controller is available, the presentation() will be executed.

    There exists also a "light synchonising switch" example somewhere in the forum. As far as I remember, this code checks if connection to gw is available on a regular basis and keeps controller also updated in case it reapears after manual switches (in case connection is lost during normal operation). Should be not to hard to find...

    EDIT: This should be the mentionned thread.


  • Hardware Contributor

    That is it! Thank you!


Log in to reply
 

Suggested Topics

  • 1
  • 1
  • 1
  • 6
  • 3
  • 10

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts