Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. Honza Liška
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Honza Liška

    @Honza Liška

    4
    Reputation
    6
    Posts
    320
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Honza Liška Follow

    Best posts made by Honza Liška

    • send() after receive()

      Hi all,
      I would like to ask for an advice: I am working on some autonomous watering gizmo built on barebone Atmel328p, HomeAssistant and MySensors. As my units run on batteries, I use long smartSleep()s to save power.

      The release water command is initiated by controller. After the specific amount of water is released, I would like to send some information back to the controller (remaining amount of water in the tank and the fact that the pump was switched off after the watering was done). Sending this information from within receive() is a no-no, as I learned recently (a lots of !MCO:PRO:RC=1), so instead of sending the outbound messages directly, I put them into a linked queue which is flushed in the loop(). This works, somewhat.

      But due to the fact that the receive() is called just before smartSleep(), my messages must wait in the queue till the smartSleep() is finished and they get out only after the unit wakes up again (say, after 30 minutes).

      It's not the end of the world, but I have quite a strong feeling I am trying to reinvent the wheel here. Is there some "proper" way how to send out message to controller in a reaction to some received() data? I tried to play with wait() after waking up, but it did not work as I hoped it would.

      Many thanks in advance,
      Jan

      posted in Development
      Honza Liška
      Honza Liška
    • Multiple NRF24 gateways

      Hi all. First, let me thank you guys for the awesome work on MySensors - it fits my purpose perfectly and it spared me a lot of time and hassle with some homemade system.

      Now, to my problem: I have my controller (home assistant) running on Raspi with attached NRF24.

      Because we have some thick walls here where I live, from time to time some nodes does not see GW properly. So I thought of adding another gateway (ESP8266 + NRF24) as a second "support" GW.

      However, when I put together my test setup, I found out that my testing node (arduino Nano with some switch and NRF24) seems to register with both gateways - I can see the button widget twice in my Home Assistant GUI and the node status is persisted in two separate status files (each GW has its own status file at the controller's filesystem).

      I tried to set a preferred/static parent node with MY_PARENT_NODE_ID and MY_PARENT_NODE_IS_STATIC, but this does not help, as all gateways have a NODE_ID = 0. So no luck there.

      Now I wonder whether this setup is supported at all... or whether I miss some basic concept.

      I do have some ideas how to move on (set up a repeater node instead of another gateway; operate second GW on a different frequency...), but I would like to better understand the principles before I start looking for a solution.

      Thanks in advance for your insight!

      posted in Troubleshooting
      Honza Liška
      Honza Liška
    • RE: send() after receive()

      Thank you for the information! From the linked discussion I somewhat feel that you understand it quite well. 😉

      To perform the send() from within receive() indiscriminately and hope that the controller will be prescient enough not to send any further messages while MySensors perform their I_PRE_SLEEP_NOTIFICATION wait() surely is a recipe for some pretty interesting problems down the line.

      I try to add some pre-sleep evaluation callback to _sleep() in the similar manner to the solution described by @tmandel in the discussion linked above. Or I just accept the fact that it can't be done.

      However it still feels kind of weird that there is no "proper" way how to deal with this scenario...

      posted in Development
      Honza Liška
      Honza Liška
    • RE: Multiple NRF24 gateways

      Thanks for the info and confirmation! I will then move my testing setup to different frequency and the problems with coverage will resolve with repeaters.

      (I do also have some RFM69 units laying around, but I do not want to use them for the time being due to their bigger footprint)

      posted in Troubleshooting
      Honza Liška
      Honza Liška

    Latest posts made by Honza Liška

    • RE: send() after receive()

      From what I understood, the solution from @tmandel was meant to revoke sleep based on incoming message. I needed to delay sleep due to messages waiting in the outgoing queue.

      At the end, I just got my fork of MySensors and added additional extern callback to MySensorsCore.cpp/_sleep just after the pre-sleep wait(MY_SMART_SLEEP_WAIT_DURATION_MS). The callback is then implemented in my source, where I check whether the oubound queue is empty. If not, MY_SLEEP_NOT_POSSIBLE is returned and the queue is flushed immediately in the next loop().

      It may be crude but... hey, it keeps my flowers watered.

      Many thanks for the advice and the direction provided!

      posted in Development
      Honza Liška
      Honza Liška
    • RE: send() after receive()

      Thank you for the information! From the linked discussion I somewhat feel that you understand it quite well. 😉

      To perform the send() from within receive() indiscriminately and hope that the controller will be prescient enough not to send any further messages while MySensors perform their I_PRE_SLEEP_NOTIFICATION wait() surely is a recipe for some pretty interesting problems down the line.

      I try to add some pre-sleep evaluation callback to _sleep() in the similar manner to the solution described by @tmandel in the discussion linked above. Or I just accept the fact that it can't be done.

      However it still feels kind of weird that there is no "proper" way how to deal with this scenario...

      posted in Development
      Honza Liška
      Honza Liška
    • RE: send() after receive()

      Hmm, interesting idea, I will try to pursue it further.
      However, I've noticed that there are some "official" examples out there with send() within receive() - namely https://github.com/mysensors/MySensors/blob/development/examples/DimmableLEDActuator/DimmableLEDActuator.ino

      Is there any rule to follow under which it would be possible to send() from receive() without any radio conflicts? Maybe I am just doing it wrong.

      posted in Development
      Honza Liška
      Honza Liška
    • send() after receive()

      Hi all,
      I would like to ask for an advice: I am working on some autonomous watering gizmo built on barebone Atmel328p, HomeAssistant and MySensors. As my units run on batteries, I use long smartSleep()s to save power.

      The release water command is initiated by controller. After the specific amount of water is released, I would like to send some information back to the controller (remaining amount of water in the tank and the fact that the pump was switched off after the watering was done). Sending this information from within receive() is a no-no, as I learned recently (a lots of !MCO:PRO:RC=1), so instead of sending the outbound messages directly, I put them into a linked queue which is flushed in the loop(). This works, somewhat.

      But due to the fact that the receive() is called just before smartSleep(), my messages must wait in the queue till the smartSleep() is finished and they get out only after the unit wakes up again (say, after 30 minutes).

      It's not the end of the world, but I have quite a strong feeling I am trying to reinvent the wheel here. Is there some "proper" way how to send out message to controller in a reaction to some received() data? I tried to play with wait() after waking up, but it did not work as I hoped it would.

      Many thanks in advance,
      Jan

      posted in Development
      Honza Liška
      Honza Liška
    • RE: Multiple NRF24 gateways

      Thanks for the info and confirmation! I will then move my testing setup to different frequency and the problems with coverage will resolve with repeaters.

      (I do also have some RFM69 units laying around, but I do not want to use them for the time being due to their bigger footprint)

      posted in Troubleshooting
      Honza Liška
      Honza Liška
    • Multiple NRF24 gateways

      Hi all. First, let me thank you guys for the awesome work on MySensors - it fits my purpose perfectly and it spared me a lot of time and hassle with some homemade system.

      Now, to my problem: I have my controller (home assistant) running on Raspi with attached NRF24.

      Because we have some thick walls here where I live, from time to time some nodes does not see GW properly. So I thought of adding another gateway (ESP8266 + NRF24) as a second "support" GW.

      However, when I put together my test setup, I found out that my testing node (arduino Nano with some switch and NRF24) seems to register with both gateways - I can see the button widget twice in my Home Assistant GUI and the node status is persisted in two separate status files (each GW has its own status file at the controller's filesystem).

      I tried to set a preferred/static parent node with MY_PARENT_NODE_ID and MY_PARENT_NODE_IS_STATIC, but this does not help, as all gateways have a NODE_ID = 0. So no luck there.

      Now I wonder whether this setup is supported at all... or whether I miss some basic concept.

      I do have some ideas how to move on (set up a repeater node instead of another gateway; operate second GW on a different frequency...), but I would like to better understand the principles before I start looking for a solution.

      Thanks in advance for your insight!

      posted in Troubleshooting
      Honza Liška
      Honza Liška