How can I have a test environment separate from production



  • Howdy,

    Title says it all. I'd like to have the ability to build and debug sensors with a test gateway and have a way to present to the production gateway when they've been tested.

    I am mostly using SenseBenders in my production setup, with a few Nano's as repeaters.

    Any ideas on how to be able to run up a sensor without it presenting to the production gateway?

    Why do I want to do this? I've had issues when using HomeAssistant keeping the state of test child sensors that change while I'm still working and debugging the sketch. I'd like to run a test HomeAssistant with the test gateway.

    Thanks,
    Simon.


  • Hardware Contributor

    Hello, @simbo, I think the simple way is to just use a different radio channel for the test and the production environment ?



  • @Nca78

    Ok....That sounds reasonable. I am assuming that is set with the #define MY_RF24_CHANNEL?


  • Hardware Contributor

    @simbo yes it is 🙂



  • Awesome...thanks.



  • I have in mind to use a DIP switch on my sensors to switch between production and test. If the DIP switch is set to TEST I want to transmit on the Test Channel.

    Is it possible to set the MY_RF24_CHANNEL at run time, rather than at compile time?


  • Mod

    @mljbr4 You can change it on the fly by calling

    RF24_setChannel( c );
    

    But, that's probably not going to work in your situation.... If you change it in before() it will be overwritten by the MySensors stack, if you do it in setup() you're already too late...

    What you could try is define a variable holding the channel, and make sure this gets set to the right value before MySensors starts, e.g.:

    uint8_t channel = 76;  // default
    #define MY_RF24_CHANNEL (channel)
    #include <MySensors.h>
    
    void before()
    {
      channel = 90;  // debug channel
    }
    

 

252
Online

7.8k
Users

8.7k
Topics

93.0k
Posts