I am using the REST API for the Nest themostat, and I seem to be getting incomplete data from the Nest servers. The names of some of the thermostats are missing (and the word "Thermostat" is in the place of the names), and the away temperature target temperature of the thermostats is also missing. Following is the JSON returned from a GET HTTP request. Has anyone else seen this?
{
"devices":{
"thermostats":{
"vMVMwQjG5n9k6fK8shB1it40C6OIbcTY":{
"humidity":40,
"device_id":"vMVMwQjG5n9k6fK8shB1it40C6OIbcTY",
"ambient_temperature_c":23.5,
"ambient_temperature_f":74,
"structure_id":"wbF3Bg291lfTwr7L3QiSKtxJuEvVByOwG5G_f4KpKW4VCe_3KzC6XA",
"name":"Thermostat",
"name_long":"Thermostat",
"is_online":true
},
"vMVMwQjG5n-_ES9UeSTCm940C6OIbcTY":{
"humidity":55,
"device_id":"vMVMwQjG5n-_ES9UeSTCm940C6OIbcTY",
"ambient_temperature_c":17.0,
"ambient_temperature_f":63,
"structure_id":"wbF3Bg291lfTwr7L3QiSKtxJuEvVByOwG5G_f4KpKW4VCe_3KzC6XA",
"name":"Thermostat",
"name_long":"Thermostat",
"is_online":true
},
"vMVMwQjG5n-n3KHstCHhCN40C6OIbcTY":{
"humidity":40,
"device_id":"vMVMwQjG5n-n3KHstCHhCN40C6OIbcTY",
"target_temperature_c":22.5,
"target_temperature_f":73,
"ambient_temperature_c":25.5,
"ambient_temperature_f":78,
"structure_id":"wbF3Bg291lfTwr7L3QiSKtxJuEvVByOwG5G_f4KpKW4VCe_3KzC6XA",
"name":"Thermostat",
"name_long":"Thermostat",
"is_online":true
},
"vMVMwQjG5n8AytjfXztxst40C6OIbcTY":{
"humidity":45,
"device_id":"vMVMwQjG5n8AytjfXztxst40C6OIbcTY",
"ambient_temperature_c":24.0,
"ambient_temperature_f":75,
"structure_id":"wbF3Bg291lfTwr7L3QiSKtxJuEvVByOwG5G_f4KpKW4VCe_3KzC6XA",
"name":"Master Bedroom",
"name_long":"Master Bedroom Thermostat",
"is_online":true
},
"vMVMwQjG5n8P8TeDkZXGBd40C6OIbcTY":{
"humidity":55,
"locale":"en-US",
"temperature_scale":"F",
"is_using_emergency_heat":false,
"has_fan":false,
"software_version":"4.3.1",
"has_leaf":false,
"device_id":"vMVMwQjG5n8P8TeDkZXGBd40C6OIbcTY",
"name":"Downstairs",
"can_heat":true,
"can_cool":true,
"hvac_mode":"heat",
"target_temperature_c":24.0,
"target_temperature_f":76,
"target_temperature_high_c":24.0,
"target_temperature_high_f":75,
"target_temperature_low_c":20.0,
"target_temperature_low_f":68,
"ambient_temperature_c":24.0,
"ambient_temperature_f":75,
"away_temperature_high_c":24.0,
"away_temperature_high_f":76,
"away_temperature_low_c":12.5,
"away_temperature_low_f":55,
"structure_id":"wbF3Bg291lfTwr7L3QiSKtxJuEvVByOwG5G_f4KpKW4VCe_3KzC6XA",
"fan_timer_active":false,
"name_long":"Downstairs Thermostat",
"is_online":true
}
}
},
"structures":{
"wbF3Bg291lfTwr7L3QiSKtxJuEvVByOwG5G_f4KpKW4VCe_3KzC6XA":{
"smoke_co_alarms":[
"JJcqUcVH2RV_Ung1pBneG940C6OIbcTY"
],
"name":"Home",
"away":"home",
"thermostats":[
"vMVMwQjG5n-_ES9UeSTCm940C6OIbcTY",
"vMVMwQjG5n8P8TeDkZXGBd40C6OIbcTY",
"vMVMwQjG5n9k6fK8shB1it40C6OIbcTY",
"vMVMwQjG5n-n3KHstCHhCN40C6OIbcTY",
"vMVMwQjG5n8AytjfXztxst40C6OIbcTY"
],
"structure_id":"wbF3Bg291lfTwr7L3QiSKtxJuEvVByOwG5G_f4KpKW4VCe_3KzC6XA"
}
}
}
It looks like you have names for two (Downstairs Thermostat, Master Bedroom Thermostat) of the five thermostats in your list. I would guess no specific name was defined when the thermostat was set up at Nest.com.
The away setting is in a different portion of the api, under the structures data element. The theory being, if you're away, it would impact all of your thermostats.
Related
Has anyone here used the PUT /MoveEntry call successfully before? I can make the call to create the record, but I was expecting the API to populate the lot number and it is not. It does by UI, but not by API. Is there a trick that I'm missing?
Update 1:
PUT /MoveEntry
{
"Hold": {
"value": true
},
"Details": [
{
"OrderType": {
"value": "RO"
},
"ProductionNbr": {
"value": "RO0000001"
},
"Quantity": {
"value": 1
},
"Location": {
"value": "PRODRECPT"
},
"Warehouse": {
"value": "ABBOTSFORD"
}
}
]
}
It always records the document successfully, but never has the lot number.
Could it be a lot class configuration issue?
Update 2:
Acu support agrees this looks like a defect and has passed the case on to Acu development.
I would take a look at the Numbering Sequence called AMBatch as that is the one that seems to be used by default for me on the Move Entry screen.
After working with Acu Support, it came back the API requires the "OperationNbr" field to be populated with the Bill of Materials operation number. Then the lot number is generated as expected.
I am using Perspective API (you can check out at: http://perspectiveapi.com/) for my discord application. I am sending an analyze request and api returning this:
{
"attributeScores": {
"TOXICITY": {
"spanScores": [
{
"begin": 0,
"end": 22,
"score": {
"value": 0.9345592,
"type": "PROBABILITY"
}
}
],
"summaryScore": {
"value": 0.9345592,
"type": "PROBABILITY"
}
}
},
"languages": [
"en"
],
"detectedLanguages": [
"en"
]
}
I need to get "value" in "summaryScore" as an integer. I searched it on Google, but i just found reading value for not categorized or only 1 times categorized json files. How can i do that?
Note: Sorry if i asked something really easy or if i slaughtered english. My primary language is not english and i am not much experienced on node.js
First you must make sure the object you have recived is presived by nodeJS as a JSON object, look at this answer for how first. After the object is stored as a JSON object you can do the following:
Reading from nested objects or arrays is as easy as doing this:
object.attributeScores.TOXICITY.summaryScore.value
If you look closer to the object and its structure you can see that the root object (the first {}) contains 3 values: "attributeScores", "languages" and "detectedLanguages".
The field you are looking for exists inside the "summeryScore" object that exists inside the "TOXICITY" object and so on. Thus you need to traverse the object structure until you get to the value you need.
I'm trying to execute some aggregate queries against data in TSI. For example:
{
"searchSpan": {
"from": "2018-08-25T00:00:00Z",
"to": "2019-01-01T00:00:00Z"
},
"top": {
"sort": [
{
"input": {
"builtInProperty": "$ts"
}
}
]
},
"aggregates": [
{
"dimension": {
"uniqueValues": {
"input": {
"builtInProperty": "$esn"
},
"take": 100
}
},
"measures": [
{
"count": {}
}
]
}
]
}
The above query, however, does not return any record, although there are many events stored in TSI for that specific searchSpan. Here is the response:
{
"warnings": [],
"events": []
}
The query is based on the examples in the documentation which can be found here and which is actually lacking crucial information for requirements and even some examples do not work...
Any help would be appreciated. Thanks!
#Vladislav,
I'm sorry to hear you're having issues. In reviewing your API call, I see two fixes that should help remedy this issue:
1) It looks like you're using our /events API with payload for /aggregates API. Notice the "events" in the response. Additionally, “top” will be redundant for /aggregates API as we don't support top-level limit clause for our /aggregates API.
2) We do not enforce "count" property to be present in limit clause (“take”, “top” or “sample”) and it looks like you did not specify it, so by default, the value was set to 0, that’s why the call is returning 0 events.
I would recommend that you use /aggregates API rather than /events, and that “count” is specified in the limit clause to ensure you get some data back.
Additionally, I'll note your feedback on documentation. We are ramping up a new hire on documentation now, so we hope to improve the quality soon.
I hope this helps!
Andrew
I'm using swagger with node.js. I want to use x-ms-dynamic-values to return values to my parameter dynamically.
Basically the first parameter will have a URL then the node.js endpoint will make a get request to that URL and pull back lets say questions, Each URL can have a different amount of questions and the questions can also vary. The get request can get a json response with amount of questions on the page. In my next parameter I want to be able to select a question based on that response.
This is where the x-ms-dynamic-values will come in to play, But I'm nearly 100% sure there are no examples of this being used with node.js only thing I could find was c# example which i will link under this.
So basically my questions is, can anyone provide my with a little example of the node.js I may be able to work from ?
example of the swagger code :
"paths":{
"/api/contacts/{name}":{
"get":{
"tags":[
"DynamicSchemas"
],
"summary":"Get Contact Info",
"description":"Gets contact info of the specified type",
"operationId":"GetContactInfo",
"consumes":[
],
"produces":[
"application/json",
"text/json",
"application/xml",
"text/xml"
],
"parameters":[
{
"name":"name",
"in":"path",
"required":true,
"type":"string",
"x-ms-summary":"Contact Name"
},
{
"name":"contactType",
"in":"query",
"description":"Try either \"Phone\" or \"Email\"",
"required":true,
"type":"string",
"x-ms-summary":"Contact Type"
}
],
"responses":{
"200":{
"description":"OK",
"schema":{
"$ref":"#/definitions/ContactInfo"
}
},
"400":{
"description":"Invalid type specified"
},
"default":{
"description":"OK",
"schema":{
"$ref":"#/definitions/ContactInfo"
}
}
}
Api Example: https://github.com/nihaue/TRex/tree/master/Source
I am investigate possibility to switch to ElasticSearch from SphinxSearch.
What is good about SphinxSearch - full-text search just work out of the bot on pretty good level. Make it work on ElasticSearch appeared not as easy as I expected.
In my project I have search box with typeahead, means I stype Clint E and see dropdown with results including Clint Eastwood on the first place. Type robert down and see Robert Downey Jr. on the first place. All this I achieved with SphinxSearch out of the box just providing it my DB credentials and SQL query to pull the necessary fields.
On the other hand, with ElasticSearch I can't get satisfying results even after a day of reading about Fuzzy Like This Query, matching, partial matching and other. A lot of information but it does not make task easier. I feel like I need to be PhD in search just to make it work at simplest level.
So far I ended up with such configuration
{
"settings": {
"analysis": {
"analyzer": {
"stem": {
"tokenizer": "standard",
"filter": [
"standard",
"lowercase",
"stop",
"porter_stem"
]
}
}
}
},
"mappings": {
"movies": {
"dynamic": true,
"properties": {
"title": {
"type": "string",
"analyzer": "stem"
}
}
}
}
}
The Query look like this:
{
"query": {
"query_string": {
"query": "clint eastw"
"default_field": "title"
}
}
}
But quality of search in this case is not satisfying at all - back to my example, it can not find Clint Eastwood profile until I type his name completely.
Then I tried to use
{
"query": {
"fuzzy_like_this": {
"fields": [
"title"
],
"like_text": "clint eastw",
"max_query_terms": 25,
"fuzziness": 0.5
}
}
}
It helps but not much, now I can find what I need with shorter request clint eastwo and after some manipulations with parameters with clint eastw but still not encouraging.
So I wonder, is there a simple recipe how to cook full-text search with ElasticSearch and get decent quality of results. I spend a day reading but didn't find the solution.
Couple of images to demonstrate what I am talking about:
Elastic, name almost complete but no expected result, note that there is no better match as well.
One letter after, elastic found it!
At the same moment Sphinx shining :)
Elasticsearch ships with auto completion suggester.
You need not put this into query functioanility , the way it works is on token level and not on partial token level.
Go for completion suggester , it also have support for fuzzy logic.