How can i implement Percentage controller on Fan in Google home? - google-home

I had implemented Fan turn on/off feature with OnOff trait and fan modes('High', 'Medium', 'Low') with Fanspeed trait, now i want to implement percentage controller. Ex: set the fan speed to 50 percent. How can i implement this?

Take reference supportsFanSpeedPercent Boolean. If set to true, this device will accept commands for adjusting the speed using a percentage from 0.0 to 100.0. Defaults to false.
It seems that you have set the value for this as False or not mentioned this attribute in your capability.
Look at this sample code:
{
"availableFanSpeeds": {
"speeds": [{
"speed_name": "S1",
"speed_values": [{
"speed_synonym": ["low", "speed 1", ... ],
"lang": "en" } , … ]
},
{
"speed_name": "S2",
"speed_values": [{
"speed_synonym": ["high", "speed 2", ... ],
"lang": "en" } , … ]
}, ...
],
"ordered": true
},
"supportsFanSpeedPercent": true,
"reversible": true
}
Source: https://developers.google.com/assistant/smarthome/traits/fanspeed#response-nodejs

Related

How To Display a static measure or column once in webdatarocks

I am creating a Classic layout using rows, column and measure. I want to add a static column( without doing any sum/average) as a last column. How can this be achieved?
Given the following configuration:
"rows": [
{
"uniqueName": "Type",
"sort": "desc"
},
{
"uniqueName": "SubCategory"
}
],
"columns": [
{
"uniqueName": "Month"
},
{
"uniqueName": "Measures"
}
],
"measures": [
{
"uniqueName": "Amount",
"aggregation": "sum",
"format": "02fecc33bec74ccd9c8a0835259938f0"
},
{
"uniqueName": "Budget",
"formula": "min('BudgetAmount') ",
"caption": "Budget"
}
]
How can I display “Budget” column, which is static and will be the same, only once; whilst “Amount” is categorized by “Month”?
Can you please help me with an example incase it can be achieved by creating an additional instance of WebDataRocks to display the “Budget” measure with the desired configuration? I am not sure how this can be done.TIA
There is no built-in solution because, as a general rule, the pivot table approach does not allow adding fixed columns.
As a workaround, you can create the second component with following slice:
slice: {
rows: [{
uniqueName: "Type",
sort: "desc"
},
{
uniqueName: "SubCategory"
},
],
columns: [{
"uniqueName": "[Measures]"
}],
measures: [{
uniqueName: "Budget",
formula: "min('BudgetAmount') ",
caption: "Budget",
}]
}
}

Is Weaviate compatible with fielded search?

I'm working with a dataset that contains multiple fields. I need to conduct searches on several fields simultaneously. Is Weaviate compatible with fielded search? If that is the case, I'd appreciate it if you could instruct me on how to combine many search queries.
This is a scheme:
schema = {
"classes": [{
"class": "Post",
"vectorizer": "none", # explicitly tell Weaviate not to vectorize anything, we are providing the vectors ourselves through our BERT model
"properties": [{
"name":"pmid",
"dataType": ["int"],
},
{
"name":"title",
"dataType": ["text"],
},
{
"name": "body",
"dataType": ["text"],
},
{
"name":"summary",
"dataType": ["text"],
}]
}]
}
I'd want to do a simultaneous search on the body and summary. For instance, it identifies publications that have the term "HIV" in their body and summary.
This is certainly possible. Check out the where-filter in the Weaviate docs :-)
Example based on your example schema.
{
Get {
Post(
nearVector: {
vector: [0, 0, 0] # <== your custom vector
}
where: { # <== searching for a pmid > 12
operator: GreaterThan
valueInt: 12
path: ["pmid"]
}
) {
pmid
title
}
}
}

IBM Speech To Text - Get alternative with highest confidence and keyword found as first result

I'm using IBM Speech to Text. The results are OK, but I'm wondering why they are not sorted by highest confidence first. Is there a parameter returning this sorted, so that I could just pick the first alternative? Best would be to only return a result if also the passed keyword is also found.
There is a max_alternatives parameter defaulting to 1, but also when specifying this explicitly, more than one alternative is returned.
I'm currently sorting the response manually and I need no code sample for accomplishing this.
JSON example:
"result": {
"result_index": 0,
"results": [
{
"final": true,
"alternatives": [
{
"transcript": "l\u00f6schen es tut echte betroffen ",
"confidence": 0.71
}
],
"keywords_result": {}
},
{
"final": true,
"alternatives": [
{
"transcript": "sie sp\u00fcren dass eine \u00e4ra zu ende ",
"confidence": 0.91
}
],
"keywords_result": {}
},
{
"final": true,
"alternatives": [
{
"transcript": "auto fahre eins zwei drei vier ",
"confidence": 0.95
}
],
"keywords_result": {
"auto": [
{
"start_time": 6.31,
"end_time": 7.19,
"confidence": 0.99,
"normalized_text": "auto"
}
]
}
}
]
},
...
The issue was the end_of_phrase_silence_time. When a default 0.8 silence period is detected, the speech is split into an additional phrase. So what I have seen is not a different recognition result, but an existing phrase in the audio recording mentioned before. See the parameter end_of_phrase_silence_time

Merge profile based on 2 property in Apache-Unomi

I am trying to build an customize logic in action for profile merging, can anybody suggest me how to create a rule where I can merge profile based on email and phone-number, as of now I am able to do with only one property value email. you can find the sample rule below in code :
"metadata": {
"id": "exampleLogin",
"name": "Example Login",
"description": "Copy event properties to profile properties on login"
},
"condition": {
"parameterValues": {
"subConditions": [
{
"type": "eventTypeCondition",
"parameterValues": {
"eventTypeId": "click"
}
}
],
"operator": "and"
},
"type": "booleanCondition"
},
"actions": [
{
"parameterValues": {
"mergeProfilePropertyValue": "eventProperty::target.properties(email)",
"mergeProfilePropertyName": "mergeIdentifier"
},
"type": "mergeProfilesOnPropertyAction"
},
{
"parameterValues": {
},
"type": "allEventToProfilePropertiesAction"
}
]
}
In order to be able to merge based on multiple identifiers you would have to extend the default built-in action to support that.
This can be done by creating a module but it will require some Java knowledge since this is how Unomi is implemented.
The code for the default merge action is available here:
https://github.com/apache/unomi/blob/master/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/actions/MergeProfilesOnPropertyAction.java

Is there any way to display multiple datasets without comparing option in amchart?

Here is my fiddle!
I dont want to show compare to block and i tried with making comaparable to false, but this didn't work.
"stockGraphs": [ {
"id": "g1",
"valueField": "value",
"comparable": false,
"compareField": "value",
"balloonText": "[[title]]:<b>[[value]]</b>",
"compareGraphBalloonText": "[[title]]:<b>[[value]]</b>"
} ],
You can set compared to true in your other datasets (ignore the first one as it is always displayed by default) to show the datasets without using the selector:
"dataSets": [ {
"title": "first data set",
"fieldMappings": [ {
"fromField": "value",
"toField": "value"
}, {
"fromField": "volume",
"toField": "volume"
} ],
"dataProvider": chartData1,
//don't set compared in the first dataset or it will be displayed twice
"categoryField": "date"
}, {
"title": "second data set",
"fieldMappings": [ {
"fromField": "value",
"toField": "value"
}, {
"fromField": "volume",
"toField": "volume"
} ],
"dataProvider": chartData2,
"compared": true,
"categoryField": "date"
},
// ... etc
If you want to display the other datasets without the percent change, set recalculateToPercents to "never" in your desired panel(s) or globally in panelsSettings.
Updated fiddle
Edit
If you're looking to just hide the "Compare To": section, add the following CSS:
.amcharts-compare-div {
display: none;
}
/* hide the br tags before and after the dropdown, brining the compare to box up */
.amcharts-data-set-selector-div br:first-child, .amcharts-data-set-selector-div br+select+br, .amcharts-data-set-selector-div br+select+br+br {
display: none;
}
You also need to set the dataSetSelector's compareText property to an empty string.
Updated fiddle

Resources