-
-
Notifications
You must be signed in to change notification settings - Fork 894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MySensors entities are not properly set when activating scenes/automations in Home Assistant #1529
Comments
See also issue #1512. @feanor-anglin Hi, do you also use signing? And do you use NRF24 radios for wireless? |
No, I don't use signing, since I use RS485 wired communication. The guy from home assistant issue said he used wireless. |
I assume it has to do with RS485. |
Unfortunately, I can't provide debug from gateway, since there is too little memory to enable it. But, the author of the issue I've linked has provided some.
|
Those messages show signing failures, so the cause of those messages is probably not related to your setup. |
Ok, so it seems there are 2 kinds of problems with sending messages with short time interval: signing problem and RS485 problem. Shortly I will try to check if the issue is also applicable to wireless setup with no signing and RS485 setup under domoticz (serial and Ethernet). Do you guys think we should move this discussion to mysensors forum? |
Github is better if the problem is related to the library code. Since we're really at the troubleshooting stage, we might get better help in the forum. Hopefully someone with a RS485 setup can chime in. |
I've debugged exact same problem, I did not use signing. I've used PJON with gateway-node communication, but it's not on that layer IMHO. I could reproduce the issue even on the serial gateway without any node too. You can simply flood the gateway with a lot of messages, and only part of the messages gets executed and the others are lost. That's why in many places you recommend using In comparison, I've noticed that OpenHab configuration has the Does the gateway implement any buffer for received messages? |
@chytreg I came to the same conclusion about this issue, very nice to hear you support it. The |
@feanor-anglin Looks like Domoticz implements As for HomeAssistant they are using pymysensors with the asyncio. |
@chytreg I've reported this issue to HA and included your findings. Hope something will be finally done with this. |
It seems HA dev requires the |
@feanor-anglin sorry, I don't understand. MySensors does not have anything called sendDelay. According to a comment above, openHab does have such a property. But would it really make sense for MySensors to document a property that exists in openHab? |
I did some tests, with HA and Domowicz here are my findings, https://gist.github.com/chytreg/dcd1c7449fca25e9480c7c463d7ec031
It's not about flooding the gateway, it's about that node requires some time to process the messages. I think it's not even a HA vs Domowicz thing. In my simple node sketch when I remove The same happens in HA, because it sends all the command in the same time to the Node. There is one thing I don't understand why I need to use I did some recordings: IMG_2361.1.movHA: Turn ON all relays => NACKs on Node IMG_2362.1.mov |
@MartinHjelmare Could you take a look, I'm trying to understand where is the problem, is it hardware limitation of message processing or it's software issue with MySensors. Why other controllers like Domoticz or OpenHub implemented communication with MySensors a bit different than HA. |
@mfalkvidd, @feanor-anglin I did some googling and found a parameter send_delay in the Pilight integration of HA. I think from HA point of view Pilight is a similar usecase as MySensors. HA Pilight send_delay |
@virtual-maker Smth like that, could solve the problem. Domoticz and OpenHub, implemented it that way. My main question is why it's even needed? Why I have to |
@chytreg I have no experience with PJON transport. I'm using NRF24. And there is a problem when two or more nodes send at almost the same time which produces collisions of the telegrams with NACKs for both nodes. But what I see from your video is you have a gateway and only one node with 16 relays connected to it. Is this right? |
Imho transport doesn't matter, I was able to reproduce the same problem on USB serial and HA which trigger the scene.
Yes
Hmm, imho HA sends turn_on message to all 16 relays in the same time, maybe that's the problem? Domoticz does one by one message. The messages goes nicely though gateway, but the NACKs pop up on Node https://gist.github.com/chytreg/dcd1c7449fca25e9480c7c463d7ec031 all the logs in gist. |
@chytreg Thank your for your logs. This is helpful! This is from your HA log:
You can see there is a separate telegram from gateway to node for each relay with additional echo request. This echo tells HA the new state of the relay (to display this actual new state in HA screen). But this echo send fails often for your setup. I assume that the gateway try to send the next telegram for the next relay and at same time the node tries to send the echo. |
With "handle" I mean automatically resolve the collision. |
@virtual-maker This is part of the logs when I comment out
In your opinion, is this also a collision? |
No, this is not a collision. But when you send two or more messages one after other then you shall add a wait() to give the receiver some ms to process the message. With NRF24 I use 10ms but this depends from the data transfer rate and will differ with PJON for sure. In your code (without wait()) you flood the gateway from the node side. Basically to send a telegram takes less time than the gateway is able to process it. |
As we managed to determine, |
Hey, @mfalkvidd have you seen my answer above? Does it make sense to you now? |
Thanks for the reminder @feanor-anglin Yes I have seen it, but I still have trouble understanding. Is the sendDelay a setting configurable by the user, or is it a fixed value? If it is a fixed value, what value do you recommend? |
btw, is anyone aware of any existing MySensors requirement documentation for Controllers? I think it would make sense to put this new requirement in the same place, but I don't know where that place is. |
@mfalkvidd these are all very good questions, since As far as I understand it (please let me know if you agree), while there is no queue implemented in gateway, the real solution should be like this:
*Clearly, with a defined (or definable) timeout period.
Referring the details you asked about: If there is no such thing as 'MySensors requirements for controllers documentation', it should certainly come to existence, giving the limitations of gateway capabilities. |
Yes, the acknowledgement method could be better, if MySensors supported acknowledgement. Adding support for acknowledgement has been discussed extensively, but I don't think such support will be added in the near term so the sendDelay solution is the realistic way to go. I have created https://www.mysensors.org/controller/requirements as a placeholder for controller requirements. |
I don't entirely understand what you mean by "MySensors doesn't support ack". I always use ack e.g. under MYSController and nodes always send it. Maybe you mean that ack is not implemented on transport layer? But this is not really an issue here. |
I have no knowledge of MYSController. But yes, MySensors does not support ack on the transport layer, which means that it is impossible for any layer to reliably acknowledge that a message reached its destination. |
There are some special cases where ack is possible, but that is not something a Controller can rely on. |
Hello again @mfalkvidd, could you please put the info about controller requirements to MySensors website? |
@feanor-anglin sure. Have we determined what those requirements are? They are not clear to me, so I would need help understanding if I am supposed to write them. |
Until now, we determined that asynchronous method of sending commands to the gateway is bad. We also determined that acknowledgement method is not possible right now due to MySensors limitations. The workaround is to define a |
@feanor-anglin how about the text present on https://www.mysensors.org/controller/requirements now? (added below in case the site has caching issues that prevent you from seeing the updated version) From github discussion: See https://github.com/tobof/openhab-addons/wiki/Configuration#configuring-the-gateway for how OpenHab has implemented this feature. [1]: When (enough of) the following parameters are fulfilled:
|
I'm not in favor of adding a user configurable option for the send delay to Home Assistant UI. If a delay is needed a recommendation for that time should be defined by MySensors. Alternatively a config option should be added to the MySensors API, in |
@MartinHjelmare a generic recommendation is impossible. The appropriate delay will vary depending on all the bullet points listed in the recommendation. Using I_CONFIG might make sense, but that is data FROM the controller, not from the gateway. isMetric (which is the only I_CONFIG setting) is set in the Controller. The gateway fetches this setting from the Controller. There is no way to set isMetric from the Gateway. Documentation for I_CONFIG: https://www.mysensors.org/download/sensor_api_20#controller-configuration |
Yeah, I know |
But why? Adding it to the same dialog box where user chooses gateway variant and library version would be a neat solution in my opinion. |
Adding options increases maintenance and the complexity to set up the controller. This option isn't required for setting up the communication with the gateway so it should not be part of the controller options. |
Actually it is, at least if we are talking about setting it up accurately and reliably. Let me be more descriptive though. Imagine you have a set of all possible combinations of messages from controller to gateway. It would be something like this: Ignoring the simple fact that MySensors gateway needs a |
Yes, that is quite bad performance. See https://www.youtube.com/watch?v=Mq9ad47P9cI for a demo where thet keypad is a MySensors node sending keypresses to the MySensors gateway so the situation might not be 100% comparable but I don't think the direction of the messages matter that much - the radio link will probably be the bottleneck in both cases. This demo is also a good example of when setting a non-zero delay would completely destroy the user experience. |
I have the same problem as described here: home-assistant/core#59388
When sending multiple messages at the same time from HA to MySensors nodes I frequently experience some messages remain undelivered. The author of the issue I've linked to has managed to identify the problem is on MySensors side, but haven't provided any details. In my opinion this is a really serious disadvantage, probably the most important I experience using MySensors in my project. Can we do something about it? :)
Additional details: I use Ethernet Gateway and RS485; the problem is also present when using Serial Gateway and wireless communication.
The text was updated successfully, but these errors were encountered: