Page 1 of 1

Strange error with Twitter feed

Posted: Wed Sep 06, 2017 7:03 pm
by hoevenvd
Hi,

I've scheduled a push service, to send a Twitter-message 'after every full hour'. The message is composed as:

"#welsum [hh]:00 Temp:[th0temp-act.1]C Gras:[th1temp-hmin.1]C"

When I manually execute this message, it goes very well. Message is send (and received) as a Tweet.

However, when the message is executed as a scheduled task, is *always* fails. With the error message:"2017-09-06 19:00:02 Error: sed: unmatched '/' can not decode tweet (bad character) (no more tries)"

I dont get it. There is no "/" in the Tweet-template. or data. What is the problem?

Running version: Meteobridge 3.4 (Aug 17 2017, build 11382), FW 1.4

Re: Strange error with Twitter feed

Posted: Wed Sep 06, 2017 11:01 pm
by admin
There is some special character in your tweet that does not work. I can't say which. If you find out I can add that to the filter function.
The reported sed error is just a consequence of the bad char, not the issue itself.

Re: Strange error with Twitter feed

Posted: Thu Sep 07, 2017 9:34 am
by hoevenvd
Hi,

Yes, I understand the error message. But it figures me what that odd character is. As my Twitter-template is:

#welsum [hh]:00 Temp:[th0temp-act.1]C Gras:[th1temp-hmin.1]C

I absolutely cannot see a strange character in this. Unless the [xx]-variables are somehow 'translated' as a strange-character; might this be the case?

Furthermore, when I manually execute this push service, the tweet is succesful. When I schedule it on the top of the hour, it fails.

Re: Strange error with Twitter feed

Posted: Fri Sep 08, 2017 3:46 am
by lrosenman
I had a similar issue and wound up shortening my tweet and removing a bunch of text. I think the printing of that error message needs to have more error checking and printing what you (the script(s)) are seeing vs what we (the user(s)) entered.

Re: Strange error with Twitter feed

Posted: Fri Sep 08, 2017 8:01 am
by mikejeep
I use much longer Twitter templates (if statements, numerous variables, plain text, etc) and have no issues with scheduled tweets. The template hoevenvd is using would never even reach half of the 140 character limit for Twitter, unless his temperatures had risen into the millions of degrees! ;)

Perhaps there is an issue with Meteobridge parsing the '#' symbol as the first character? Have you tried removing that for testing purposes?

-Mike

Re: Strange error with Twitter feed

Posted: Fri Sep 08, 2017 8:05 am
by hoevenvd
Hi, thanks for the response. I've searched the forum before my posting, and eliminated the possibility of a tweet-message that's too long. That's why my current template is very short:

"#welsum [hh]:00 Temp:[th0temp-act.1]C Gras:[th1temp-hmin.1]C"

So, the length could not be the case.

However, I've found the trigger what causes the tweet to fail. Take the Twitter-template above:

* it succeeds always when I execute this template manually (by pushing the test-button). Literaly, always
* it fails always when I schedule this template 'after every full hour'. Literaly, always
* it succeeds always when I schedule this template 'every hour'. Running this one succesfully for several hours now.

So, there's nothing wrong with my twitter-template. No strange characters, and not too long.

Somehow the error is caused by the kind of schedule-period I choose. 'Every hour' goes well, 'after every full hour' fails.

Re: Strange error with Twitter feed

Posted: Fri Sep 08, 2017 8:07 am
by hoevenvd
mikejeep wrote: Fri Sep 08, 2017 8:01 am I use much longer Twitter templates (if statements, numerous variables, plain text, etc) and have no issues with scheduled tweets. The template hoevenvd is using would never even reach half of the 140 character limit for Twitter, unless his temperatures had risen into the millions of degrees! ;)

Perhaps there is an issue with Meteobridge parsing the '#' symbol as the first character? Have you tried removing that for testing purposes?

-Mike
Thanks for the response. I will try removing the #-sign, will give follow up on this. However, that does not explain fully why this very twitter-template goes well without any problems when I manually execute it. And also goes very well when I use another type of schedule (see other reply from me). Odd...

Re: Strange error with Twitter feed

Posted: Fri Sep 08, 2017 9:04 am
by hoevenvd
mikejeep wrote: Fri Sep 08, 2017 8:01 am Perhaps there is an issue with Meteobridge parsing the '#' symbol as the first character? Have you tried removing that for testing purposes?

-Mike
Removing the #-sign doesnt make any difference. Still failing on the top of the hour:

2017-09-08 09:00:00 Error: sed: unmatched '/' can not decode tweet (bad character) (no more tries)

Re: Strange error with Twitter feed

Posted: Fri Sep 08, 2017 6:19 pm
by mikejeep
hoevenvd wrote: Fri Sep 08, 2017 8:05 am "#welsum [hh]:00 Temp:[th0temp-act.1]C Gras:[th1temp-hmin.1]C"

* it succeeds always when I execute this template manually (by pushing the test-button). Literaly, always
* it fails always when I schedule this template 'after every full hour'. Literaly, always
* it succeeds always when I schedule this template 'every hour'. Running this one succesfully for several hours now.

Somehow the error is caused by the kind of schedule-period I choose. 'Every hour' goes well, 'after every full hour' fails.
On the Templates wiki, hmin is defined as "minimum value of this hour". This is just a theory, but perhaps Meteobridge is having difficulty parsing it immediately at hh:00:00 because no data had been recorded for *that* hour yet? I could be reading the definition too literally, but you might be thinking "past 60 minutes" but the software is thinking "since the top of the hour" and since only a moment had passed when the scheduled tweet happens, it fails..

-Mike

Re: Strange error with Twitter feed

Posted: Fri Sep 08, 2017 10:35 pm
by hoevenvd
Hi Mike,

Thanks for the good thoughts. I was convinced the cause must be lying somewhere in the choosen interval, so I tested the schedule 'just before every hour'. And guess what, no errors anymore.

I think you nailed it, and your analysis is sound (and logical). Now I have tweets send every 59 minutes of an hour, making the variable hmin calculated correctly over the last 59 minutes (which is exactly what I want).

Thanks Mike!

Re: Strange error with Twitter feed

Posted: Sat Sep 09, 2017 12:24 am
by mikejeep
Awesome, glad you found it -- happy to help.

Boris, perhaps the Templates wiki can be clarified so others don't run into this?

-Mike

Re: Strange error with Twitter feed

Posted: Sat Sep 09, 2017 1:53 am
by admin
what you should also do is the give default data in case the sensor does not deliver data.
I think that is the root cause for your problem, not the scheduling...

Code: Select all

#welsum [hh]:00 Temp:[th0temp-act.1:--]C Gras:[th1temp-hmin.1:--]C"

Re: Strange error with Twitter feed

Posted: Sat Sep 09, 2017 8:37 am
by hoevenvd
Agreed Boris. Scheduling is not the root cause, but it is the trigger of the error. Applying default values will solve it.

Thanks for all the help! Will apply the default values, and follow up on this.

Re: Strange error with Twitter feed

Posted: Sat Sep 09, 2017 12:22 pm
by hoevenvd
Check, all in working order now. Default values applied. This is my current tweet-template I'm using. Shooting ath the end of every hour (59 minutes in my case):

#welsum [hh]:[mm] Temp:[th0temp-act.1:---]°C Gras:[th1temp-hmin.1:---]°C Wind:[wind0wind-avg10.1:---]m/s [wind0dir-act.0:---]° Stoot:[wind0wind-max10.1:---]m/s Baro:[thb0press-act.1:---]hPa Zon:[sol0rad-act.0:---]W/m2 UV:[uv0index-act.1:---] Regen:[rain0total-daysum.1:---]mm