Compatibility between mysensors and RF24 library on same node.



  • Hello everybody
    I am a newby on the forum and in RF communication, so please excuse me if my question is stupid....
    I use presently an Arduino node linked to a gateway on RPI and Domoticz controller to monitor the water level in a well and recording the behavior of 2 pumps controlling this level. It works quite correctly. Domoticz shows me data every 5 minutes.
    On the same Arduino node, same sketch and loop(), is it possible to implement, in addition to the mysensors instructions, some instructions of the NR24 library, so that this Arduino can also exchange data directly with another Arduino equipped with RF24 library but without mysensors one (of course independantly of the GW and Domoticz) ? Is there a risk of mess between frequencies, channels, node ID, data ID etc... used by both communication structures ?
    Thanks in advance.


  • Mod

    @GLAB it is probably possible, given enough time, skill and motivation. But my guess would be multiple weeks of work, unless you are very skilled.

    Could you expand on why adding MySensors to the other node isn't feasible?

    An alternative might be to build a non-MySensors Arduino that talks nrf24, and let this Arduino be a "sensor" connected to the MySensors node over serial, i2c or some other protocol.



  • @mfalkvidd Thanks for your time and your warning....
    My problem with mysensors is that the only way I know to collect the data received by the GW through mysensors is domoticz, and domoticz reports data to me every 5 minutes. I like to monitor the data through internet, together with meteo, home temperatures and so on.
    But a 5 min period is not frequent enough to show me the progressive change in the water level when the pump is working (the average duration of a period of powered on pump is most often a handle of minutes) : to achieve this, my node samples and sends data to GW approx every 5 seconds and it is frustrating to find data in domoticz only every five minutes.
    To cope with this issue, I have presently a second -independant- pair of arduino linked by nr24 protocole : one of them collect the data and send them every 5 secondes to the 2nd arduino which starts electromechanical timers cumulating the working time of the pumps with sufficient reliability and accuracy. This cumulated time, cross checked with meteo data and water level, is useful to me to verify that the pumps are working normally. The problem is that I do not know a way to access these info via internet.
    So my today situation is that I have, working in parallel, the mysensors system, opened on internet but poorly reactive, and the nr24 system, accurate enough, but that I can only read when I am at home.... Fortunately, presently, these two systems work in parallel apparently without interfering negatively....
    My dream would be to unify the two systems....


  • Mod

    Thanks for explaining @GLAB

    You could report the cumulatuve times to Domoticz, if that gives you sufficient information.

    Or use a different controller. There are about 20 different controllers with MySensors support. To my knowledge, Domoticz is the only controller that refuses to save more detailed information than 5 minutes.

    Or skip the controller and log the data to a file, if that is suitable.



  • @GLAB I'd suggest using a time-series database like InfluxDB and visualize the stored data with whatever granularity you desire in Grafana dashboards and make it internet-accessible, if you wish. A public-facing analytics software should also pose a smaller potential security risk than a full blown home automation system. Or setup alerts and let it send you e-mails or push notifications if the incoming data suggest that something is wrong - no need to monitor it personally anymore.

    I've never touched Domoticz, so I don't know its limitations. Maybe it will allow you to setup alarms / notifications aswell, so you wouldn't have to change anything in your hard- and software setup, if you feel comfortable with it. Domoticz has native InfluxDB support, so you should be able to forward incoming sensor values easily.



  • @mfalkvidd Thanks for your answer.
    I understand the possible advantages of a controller change.
    But I am 75 years old, and I tend to be prudent in front of drastic changes in my installation. I would not like to migrate from a system unperfect but basically working to a system theoretically better but that I could not master.
    I like your idea of calculating at node level cumulated times of pump working, , and transferring them to Domoticz, instead of the amperage drawn by my pumps that I transfer today (at the beginning I expected to forecast early some pumps malfunctions by checking evolution with time of the absorbed power, but I do no more think today that it is realistic). I will modify the sketches in this way during the next days (or maybe weeks). I will keep you informed when it is working.
    Could you kindly developp a little further your idea of skipping the controller and logging data to a file, so that I can evaluate if this is in my range of competence ?
    Many thanks again.



  • @BearWithBeard Thanks for your answer. My feeling is that you describe a perfect solution (with database + Grafana etc...). The possibility of linking influxdb and domoticz looks very promising.
    The issue is that I have presently no competence in these tools, and my knowledge of Domoticz is limited to the basis. I am therefore reluctant in jumping directly in such an adventure 🤔
    However I will go on thinking to this option, at least maybe in a first step for brain training.....🙇‍♂️
    Thanks again.


  • Mod

    @GLAB said in Compatibility between mysensors and RF24 library on same node.:

    Could you kindly developp a little further your idea of skipping the controller and logging data to a file, so that I can evaluate if this is in my range of competence ?

    A MySensors gateway writes one line for each measurement. Depending on type of gateway, this line is transferred through tcp, serial port or mqtt. For rcp, a netcat command can be uwed for logging. For serial port, all you need is the linux cat command, or any tool that can log data from a serial port (putty for windows for example). For mqtt, there are multiple mqtt clients that can log. If you build a raspberry pi gateway, it has built-in functionalty to log to a file.

    So there are lots of possibilities. Which one is more suitable depends on what skills you have.



  • @GLAB May have misread this but perhaps a different perspective? Currently using mysensors with domoticz, all on rfm69 connections, my water supply is from an underground bulk tank monitored by ultrasonics and reported every hour, so the pump rate is not so much an issue here, I only need know that it is been topped up by the borehole at silly o'clock and how many days supply I have left should the borehole pump fail.
    However, when I wanted to monitor the CH boiler run times I hit the same 5 minute default in Domoticz .
    The Node wakens on an Interrupt from the boiler contactor changing state On/Off, it also reads feed and return temps at 1 and 5 minute intervals but the Interrupt is deadly accurate.
    This is notified by the Node to a logical switch in Domoticz, but the problem was it is complicated rather than simple to read.
    b3900439-da33-4063-b4bf-900b9fcba30f-image.png
    What I used within Domoticz was a short script to update a dummy meter. The horizontal scale on the graph is the default accuracy of 5 minutes, BUT the vertical value is to one minute of accuracy, reset every midnight via a second script. You could presumably do this for any time value on the vertical scale or even to estimate a cumulative volume used I guess, but again only really useful to compare daily run times.
    6d70ef89-c856-4e0f-92e7-9c43ef97cf2a-image.png
    The Utility page from which this graph is obtained holds the overview of the daily cumulative (left side 3rd down - 41 minutes).
    8e13faec-116f-4c92-bd8a-7431ae4afcb2-image.png
    Is that the sort of thing you are trying to achieve ?



  • Hello
    Thank you for this description of your installations. There are many similarities with mine. Except -as I understand- that your risk might be an empty tank, while I fear an overflow of mine in case of strong rain and pump failure, resulting in flooding my cellar.... But basically I could find a solution similar to yours to show in a Domoticz graph (date and time on horizontal axis), when a pump is turned on, by drawing vertical segments every 5 min of domoticz, with a height showing the duration - cumulated by the node- of pump working since the moment it has been turned on. And this duration would be reset when the pump is turned off.
    I think I can do that without using interrupts on Arduino and dummy variables in Domoticz that I do not really master (I have never experienced them).
    One of the difficulties I expect when doing that is to manage the risk that Domoticz records a 5 min sample a few minutes (i.e. 2 min) before the pump is turned off : in that case, the duration working time displayed would be underestimated. I am confident that I can find a turnaround to cope with this difficulty, maybe by a delay (5min ?) of the reset by the node of the cumulated time after pump turn off.
    Anyway, it will be a funny challenge...



  • @GLAB Indeed my tank controls the pumps (borehole in and supply out) on standard level controllers to the contactors within a full/empty range, the Node is only used to verify tank levels with the ultrasonic. However...

    As I understood it, the time default of 5 minutes in Domoticz is your principle issue, which is why you have the parallel pair taking the same data to operate "electromechanical timers" which does satisfy your requirements, but only locally.
    My point was that Domoticz can do the "electromechanical timers" part internally, all it needs is a stop/start for pump OFF/ON to control it, you can count it in seconds if you want but minutes is probably sufficient for what you are after.
    The second pic showed my boiler running times as a "Switch" in Domoticz. The third pic shows this transformed to a counter/meter which is a Dummy or Virtual Meter counting the minutes run as set up here.
    dcd52d1c-c1a0-4907-9c52-77b85797bfe2-image.png
    The 8 line script under "Events" is what updates the meter from the ON/OFF every minute of every day, a second script resets it every midnight, but it could be let roll over if that's what you wanted.
    68889018-5ca7-4681-b5cf-f136bd7ccbcc-image.png
    Trust me, you may be 9 years older than me, but it's not that difficult once you look at it from another perspective 😉



  • Thank you for these info. I will have a look on tutorials on scripts and lua in Domoticz. Not so obvious at first glance ! I will need time....
    Thanks again.



  • @GLAB No worries, was in a similar situation.. My perspective was on what the Node could be made to provide, not what could be done within Domoticz to address the requirement - eg Had heard of Dummy counters but had no experience nor understood their purpose, nor had ever used scripts.
    I had been sending a logical ON/OFF as well as a cumulative total from the Node and hit the same hair-pulling scenario as yourself.
    Now only the ON/OFF is sent and the short script makes the transposition within Domoticz to a dummy meter (I think kWhr) using the internal clock in Domoticz.
    Have fun 😉



Suggested Topics

1
Online

11.4k
Users

11.1k
Topics

112.6k
Posts