-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Add command Ping
(#7176)
#8119
Add command Ping
(#7176)
#8119
Conversation
Many thanks for this! I'm just a bit confused on what I need to do to create a .bin file that includes the sensors and ping. Or maybe it could be included in the sensors bin considering it is intended to be used as a presence sensor? |
Please, address this to the Tasmota Support Chat. The chat is a better and more dynamic channel for helping you. Github issues are meant for Tasmota Software Bug Reporting. Please check the Contributing Guideline and Policy and the Support Guide. Thanks. Support InformationSee Wiki for more information. |
We need Theo's approval to include in the tasmota-sensors distribution. @arendst what's your opinion? |
Wouldn't grow too large? With the current, not code size optimized sensor influx it starts to reach the max size very soon. |
Can we have option to set the timeout and the buffer size please @s-hadinger? I'm trying this and I'm able to successfully ping all devices on Ethernet, but most devices on WiFi are timing out. I'd like to be able to configure the timeout especially. |
I made a few tests and the results are very strange to me. Some devices are being marked as reachable while others are not. From my laptop I can ping all of them. And it's not a timeout issue; I connected my laptop with Ethernet and I still can't ping it, but I CAN ping a WiFi device. Also, I'm getting unreachable when trying to get it to ping itself. I can ping the Sonoff from my laptop, but it can't ping itself? |
Apologies, some of the strange results have to do with issues I was having with my main router. Yet, the problem with being unable to ping oneself and to set a timeout still persist. Also, may I please suggest a change in the JSON formatting which would make it easier to deserialize to a class instance? Can: Change to: |
Indeed a Tasmota device cannot ping itself, I'm not sure why but it's maybe because when it's sending an ICMP packet, it can't receive it at the same time. I don't know why some of your device are not reachable, maybe an ARP issue at router or AP level. Can you see with WireShark what is happening at wifi level? Also see #8092 The JSON format is aligned with sensors and zigbee. Actually it has some benefits to have a distinct json tree structure per device, for ex when using AWS IoT and device shadows. |
I confirm there is a problem when I try to ping multiple devices at the same time. Most packets end up with time-outs. Either they are not sent at all, or the responses are ignored. I will need to look deeper. Advice: send pings once at a time. Edit: I tied to increase time-out to 2 seconds and it won't change anything. Actually I'm considering now forcing pings one at a time, and refuse to send more ping if one ping in on-going. Actually it simplifies code to do so. What do you think? @MarkCiliaVincenti |
More tests, they show without any doubt that the ping feature in LWIP2 is no re-entrant. It will only accept pings one at a time, and ignore previous responses. That's why the first 3 pings succeed only once and the last one succeeds on all 4 packets.
There also seem to be a bug in |
To be honest, I'm only interested in the value of 'Reachable'. In fact, ideally for me it would stop pinging upon the first successful response, so a more timely result is achieved. But I understand others may want to use the response times. That said, I'm working with this feature now :) |
I understand, but with the current Ping api from LWIP2, you can't stop pings once they started. I will change the code to make sure 2 pings don't collide. |
@MarkCiliaVincenti I revamped the Ping engine and simplified it. Now you can send multiple pings at the same time. Also I implemented |
You're the king @s-hadinger! Cheers for this! |
It's been 2 years since the last post here. |
@mrneutron42 If you want it you need to compile your own build Or use tasmota-platinum from the unoffical builds |
Yes, I saw the custom-compile note in the first post of this thread. I did not know about the tasmota platinum builds. |
Description:
Add
Ping<x> <addr>
where<x>
is the number of packets to send (at 1 second interval) and<addr>
the address either as domain name or IPv4 address.The answer is asynchronous when all packets have been sent and responses handled (success or time-outs).
As ICMP ping code from Arduino takes more than 2KB of Flash,
Ping
will most certainly not be included by default. You will need to self compile and set#define USE_PING
Ex:
Related issue (if applicable): fixes #7176
Checklist: