-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[telegram] sendTelegramPhoto should be more resilient #10807
Comments
You could try adding a few seconds of delay into your rule as a workaround.
|
What happens if you call the URL for the photo multiple times in a normal web browser by pressing F5 for refresh? Do you get 404 if the same url is called multiple times? |
Having read this again I understand what it is your asking, that a work around be implemented for when a camera or other source has a fault. I'm not sure what other peoples view is but there are a few ways forward.
What do others think? I probably support doing number 3. |
Ok I have implemented option 3 for sending photos, videos and animations. Simply doing a delay in a rule as the example above given would not solve the issue. I see it as pointless making the code be overly complex when it could be the camera is doing a weekly reboot or be fully offline. |
I will add another thing I discovered reading the code. That is it will return a boolean as false if the download fails.. var result = telegramAction.sendTelegramPhoto(WelcomeHome_SnapshotURL.state.toString, "Doorbell ring") You can then check the result of the var to see if it is true or false and then use a delay/timer to retry. |
Hello, thank you very much. That sounds like a very good solution (it is now guaranteed that a message is sent, there is hint in the message when the picture download failed and everybody can now also realize a retry function within a rule when desired). Perfect! :-) I will test it soon. Will it be within the next 3.1.x version? |
It should be in 3.2milestone2 and newer, this should be out very soon as in days. If you subscribe to the announcement category of the forum you will then get notified. |
I'm using telegram actions to send a photo when someone is ringing the doorbell. Sometimes it happens, that the event is triggered and the photo URL is available, but the photo isn't ready to download.
This error occurs in that case: "Download from https://... failed with status: 404".
That is fatal, because it causes that no telegram message is sent. It would be good when at least the message/caption from sendTelegramPhoto is sent without the photo. Or better: When the telegram action trys to sent it again 1 or 2 seconds later.
OpenHAB 3.0.2 is used.
This is my example rule:
rule "Doorbell ring"
when
Channel "netatmo:NAWelcomeHome:xy:welcomeHomeEvent" triggered INCOMING_CALL
then
val telegramAction = getActions("telegram","telegram:telegramBot:xy")
telegramAction.sendTelegramPhoto(WelcomeHome_SnapshotURL.state.toString, "Doorbell ring")
end
The text was updated successfully, but these errors were encountered: