Wrong Condition code from Yahoo Weather - yahoo-weather-api

I am using the Yahoo Weather API to get forecast on my website but I've noticed that the "scattered showers" code is 39 instead of 40 and "scatttered thunderstorms" is 47 instead of 37 or 38 as indicated on Yahoo's documentation.
It seems that it is not just a recent bug. But I couldn't find any updated condition list.

I think yahoo has noticed this bug and might be working on it.
I tried playing around with their developer network api trying to pull the various condition codes and had no luck. Then I finally found this which is where they store the gifs for the weather condition codes and on there it is incorrect as well. Yet when you go to their main page it says that "Yahoo! Will be right back...Our Engineers are working quickly to resolve the issue.
http://l.yimg.com/
http://l.yimg.com/a/i/us/we/52/40.gif
http://l.yimg.com/a/i/us/we/52/39.gif - Both give scattered rainshowers
http://l.yimg.com/a/i/us/we/52/37.gif
http://l.yimg.com/a/i/us/we/52/38.gif - Both give isolated thunderstorms

Looks like yahoo engineers do not work quickly enough - or just never worked on it ;)
{
"query": {
"count": 1,
"created": "2017-09-06T09:47:17Z",
"lang": "en",
"results": {
"channel": {
"item": {
"condition": {
"code": "39",
"date": "Wed, 06 Sep 2017 10:00 AM CEST",
"temp": "62",
"text": "Scattered Showers"
}
}
}
}
}
}
official documentation lists 39 as scattered thunderstorms
https://developer.yahoo.com/weather/documentation.html

Related

Email alert based on monitors going down / coming back up

I am fairly new to this but I need some help with my watcher setup. - I am using the X-Pack Watchers.
I have setup Heartbeat and I currently have 7 monitors.
i.e
monitor-01
monitor-02
etc.
I need help setting up my exact scenarios, I need help with 3 scenarios:
Scenario 1:
If monitor-01 goes offline, I want to send ONLY 1 email to "test#domain.com" with the body of: "Hello there, monitor-01 just went offline! Please check, thanks."
If monitor-02 goes offline, I want the exact same result as above.. I dont want multiple emails alerting me every second / minute if the monitor is down, I only want 1 email.
Scenario 2:
If monitor-01 or any my monitors are offline... Every 3 hours, I want a refresh email sent out (I would like the email body to contain how long the specific monitor is down for, i.e monitor down for 120hours 13 minutes). So, if 3 hours pass, I want to send an email to "test#domain.com" with the body of: "Hello there, this is a reminder email that monitor-01 is still offline! Please check, thanks."
Scenario 3:
If any of the monitors come back online, I want to send out an email to "test#domain.com" with the body of: "Hello there, great news! monitor-02 is back online. The monitor was down for 7hours 12 minutes. Thanks."
Can someone please assist? I looked everywhere and cannot find the correct syntax to create the above scenarios. These would be scenarios I feel could benefit other members of the community.
P.s, I currently have an advanced watch that I found in the forums but does not match my criteria. Here is the code for it:
{
"trigger": {
"schedule": {
"interval": "30s"
}
},
"input": {
"search": {
"request": {
"search_type": "query_then_fetch",
"indices": [
"heartbeat-*"
],
"rest_total_hits_as_int": true,
"body": {
"query": {
"bool": {
"must": {
"match": {
"monitor.status": "down"
}
},
"filter": {
"range": {
"#timestamp": {
"from": "now-50s"
}
}
}
}
},
"aggregations": {
"by_monitors": {
"terms": {
"field": "monitor.name"
}
}
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.total": {
"gt": 0
}
}
},
"actions": {
"email_admin": {
"email": {
"profile": "standard",
"from": "noreply#domain.com",
"to": [
"test#domain.com"
],
"subject": "Monitor is DOWN: {{ctx.payload.aggregations.by_monitors.buckets.0.key}}",
"body": {
"text": "Hello, there is a monitor offline currently. Please check..."
}
}
}
}
}
The above script I put together sends an email every 30 seconds if a monitor is down which is not what I want.
Here is what the email says when everything is put together:
Subject: Monitor is DOWN: [UAT] Test Website
Body: Hello, there is a monitor offline currently. Please check...
Can someone assist with my scenarios? I spent days on this already.. many hours gone in, not much to come out from it!
Thanks.
There are two things you could look into: throttling and acknowledging notifications
throttling: once an action is done (eg sending an email), don't do that action again for 3 hours
acknowledge: : in this case you need to call the API to say: "I did receive the notification that watcher01 has found an error, don't send any notifications about it again."

Multiple response in action on google dialogflow

How can i get multiple response on action on google console using dialogflow ?
i simulated on Action on google console but only two responses are showing on it
where as third response are not showing
here is my json response
{
"source": "webhook",
"data": {
"google": {
"is_ssml": true,
"permissions_request": null,
"expect_user_response": true
}
},
"messages": [
{
"type": 0,
"speech": "peter Got around 28 marks in maths. which is ranked 1 among 3 candidate in class 1"
},
{
"textToSpeech": "peter Got around 28 marks in maths. which is ranked 1 among 3 candidate in class 1",
"platform": "google",
"displayText": "peter Got around 28 marks in maths. which is ranked 1 among 3 candidate in class 1",
"type": "simple_response"
},
{
"textToSpeech": "Working",
"platform": "google",
"displayText": "Working",
"type": "simple_response"
},
{
"textToSpeech": "Working 2",
"platform": "google",
"displayText": "Working 2",
"type": "simple_response"
}
]
}
Here is my console output
any help regarding this is much appreciated
Thank you
Regards Saif
Only two simple responses will be accepted as a response. If you want more content you will need to consolidate your text into one of the two responses.
As you can see on the AoG Responses docs, it is specified as a requirement :
At most 2 chat bubbles per turn
So your third bubble won't display, as intended by Google.
As suggested in the previous answer from Nick, you need to consolidate your text and wrap everything in your 2 bubbles. In a simple response, you can line break by adding a \n where needed.
In a Basic Card however, you can access a limited subset of markdown, as stated in the docs link I provided, like that :
New line with a double space
**bold**
*italics*
Rich responses have the following requirements and optional properties that you can configure:
Supported on surfaces with the actions.capability.SCREEN_OUTPUT
capability.
The first item in a rich response must be a simple response.
At most two simple responses.
At most one basic card or StructuredResponse.
At most 8 suggestion chips. (you can add more than 8 also but you will get a warning not an error.)
Suggestion chips are not allowed in a FinalResponse
Linking out to the web from smart displays is currently not
supported.

How to fetch comments with Facebook Graph API from comments plugin

I am trying to get all comments from my website.
I have found this method in plugin FAQ:
https://graph.facebook.com/v2.6/?fields=og_object{comments}
&id=<YOUR_URL>
&access_token=<YOUR_TOKEN>
But it neither corresponds to API reference (there's no field named comments in returned OpenGraph object), nor actually works. So I managed only to fetch amount of comments, but not actually their contents. Is it possible to do so?
The code referred to in the FAQ appears to be for v2.6 of the API, and so may be superceded.
I get comments from the Comments Plugin with the following.
First I get the Facebook Graph ID for the URL the Comments Plugin is operating within:
https://graph.facebook.com/v2.8/?id=<<YOUR_URL>>
&access_token=<<YOUR_TOKEN>>
This returns a response like this:
{
"og_object": {
"id": "<<OBJECT_ID>>",
"description": "<<OPENGRAPH_DESCRIPTION>>",
"title": "<<OPENGRAPH_TITLE>>",
"type": "article",
"updated_time": "2017-02-08T13:53:48+0000"
},
"share": {
"comment_count": 0,
"share_count": 0
},
"id": "<<YOUR_URL>>"
}
We then take that Open Graph Object ID and plug it into this:
https://graph.facebook.com/v2.8/<<OBJECT_ID>>/comments?summary=1
&filter=stream
&order=reverse_chronological
&access_token=<<YOUR_TOKEN>>
You'll get an object with a data property which will be an array of comments.
Testing for URL Provided by OP
https://graph.facebook.com/v2.8/
id=http://pdffiller.com/6962253&access_token=[REDACTED]
Returned
{
"og_object": {
"id": "1195506680497732",
"description": "Fill w9 fill out online 2014-2017 form irs instantly, download blank or editable online. Sign, fax and printable from PC, iPad, tablet or mobile. No software. Try Now!",
"title": "2014-2017 Form IRS W-9 Fill Online, Printable, Fillable, Blank - PDFfiller",
"type": "website",
"updated_time": "2017-02-08T12:08:37+0000"
},
"share": {
"comment_count": 0,
"share_count": 24
},
"id": "http://pdffiller.com/6962253"
}
Note the comment_count is zero, hence why no comments are returned by the Graph API

Age, gender, & country not showing in Facebook Insights data

Nearly all the other metrics are available to view in Facebook Insights, except the user demographics. When I try to view them, I get an empty array:
"data": [
{
"name": "page_impressions_by_age_gender_unique",
"period": "day",
"values": [
{
"value": {
},
"end_time": "2015-10-08T07:00:00+0000"
}
],
"title": "Daily Reach Demographics",
"description": "Daily: Total Page Reach by age and gender.",
"id": "x/insights/page_impressions_by_age_gender_unique/day"
}
],
I have most permissions set: read_insights, manage_pages, publish_actions.
For me it's working for my page. If you don't have for daily means search in weekly or 28 days report. May be todays report not updated yet.
"Daily Reach Demographics" Also have "weekly and 28_days Reach Demographics" Search for that. And "read_insights" permission will be okay for this action.
Maybe it is related to one of these Facebook issues:
1993653884193030: page_impressions_by_age_gender_unique missing from page insights
1010193999087765: Some metrics are missing for period "day"
Response from Facebook:
This is actually not a bug, but by design. There are not enough impressions/data available to create a breakdown for that specific timeframe (in your case "day") so we do not return any data.

Difficulty using `populate` with `groupBy` and `sum` with Waterline query in Sails.js

I have run into a strange problem with the groupBy and sum methods when used with populate. I have a set of associated models: User, Source (books, etc), Recommendation, and Discipline (i.e. academic discipline).
I attempted the following waterline query:
Recommendation.find({
where: {discipline: '5559ea07dfa9bd0499f9f799'},
groupBy: ['source'], sum: ['rating']
}).exec(console.log);
This worked well, returning:
[
{
"source": "5571e72ab50f0c3c49fe19f6",
"rating": 4
},
{
"source": "5571b88c51861950360fac1c",
"rating": 12
}
]
I then tried it with populate on the source because I wanted to have the full source data linked to the each recommendation. So I tried:
Recommendation.find({
where: {discipline: '5559ea07dfa9bd0499f9f799'},
groupBy: ['source'], sum: ['rating']
}).populate('source').exec(console.log);
This yielded something strange:
[
{
"source": {
"type": "book",
"identifiers": [
{
"type": "ISBN_10",
"identifier": "1400823226"
},
{
"type": "ISBN_13",
"identifier": "9781400823222"
}
],
"title": "Patterns for America",
"subtitle": "Modernism and the Concept of Culture",
"publisher": "Princeton University Press",
"year": 1999,
"language": "en",
"categories": [
"Literary Criticism"
],
"abstract": "In recent decades, historians and social theorists have given much thought to the concept of \"culture,\" its origins in Western thought, and its usefulness for social analysis. In this book, Susan Hegeman focuses on the term's history in the United States in the first half of the twentieth century. She shows how, during this period, the term \"culture\" changed from being a technical term associated primarily with anthropology into a term of popular usage. She shows the connections between this movement of \"culture\" into the mainstream and the emergence of a distinctive \"American culture,\" with its own patterns, values, and beliefs. Hegeman points to the significant similarities between the conceptions of culture produced by anthropologists Franz Boas, Edward Sapir, Ruth Benedict, and Margaret Mead, and a diversity of other intellectuals, including Randolph Bourne, Van Wyck Brooks, Waldo Frank, and Dwight Macdonald. Hegeman reveals how relativist anthropological ideas of human culture--which stressed the distance between modern centers and \"primitive\" peripheries--came into alliance with the evaluating judgments of artists and critics. This anthropological conception provided a spatial awareness that helped develop the notion of a specifically American \"culture.\" She also shows the connections between this new view of \"culture\" and the artistic work of the period by, among others, Sherwood Anderson, Jean Toomer, Thomas Hart Benton, Nathanael West, and James Agee and depicts in a new way the richness and complexity of the modernist milieu in the United States.",
"imageLinks": {
"smallThumbnail": "http://bks3.books.google.de/books/content?id=OwYWU2H3me4C&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api",
"thumbnail": "http://bks3.books.google.de/books/content?id=OwYWU2H3me4C&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api"
},
"createdAt": "2015-06-05T14:56:12.714Z",
"updatedAt": "2015-06-05T14:56:12.724Z",
"id": "5571b88c51861950360fac1c"
},
"rating": 4
},
{
"source": {
"_bsontype": "ObjectID",
"id": "Uq¸Q\u0019P6\u000f¬\u001c"
},
"rating": 12
}
]
As you can see rather than replacing the source id with the full source properties, it added the source as an object in the returned array, and then added another object with a new source id reference, and the summed rating amount. Strangely, it also attached just one of the rating values to the source object it appended to the results.
Is this what should be happening. I can't follow the logic and it feels a bit buggy. In any case, what I would like is to have the source within each returned row, alongside the summed total. Can anyone explain what's going on here, and if I made an error perhaps?