Alexa Smart Home Skills IoT Alexa.PlaybackController - iot

I have an IoT device that needs to support various operations, one of which is next from the Alexa.PlaybackController. My device is a multimedia device and requires many of the other Controllers as well. I'm including the Alexa.PlaybackController in the discovery response for my devices like so:
{
"type": "AlexaInterface",
"interface": "Alexa.PlaybackController",
"version": "3",
"supportedOperations": ["Next"],
}
I've also tried:
{
"type": "AlexaInterface",
"interface": "Alexa.PlaybackController",
"version": "3",
"properties": {
"supported": [
{"name": "next"}
]
},
}
but neither work. I get a schema error on CloudWatch:
is not valid under any of the given schemas
Looking below at the schema, I see that PlaybackController indeed is not included inside the schema. However, all of the documentation makes it seem like this should be trivial. I'm wondering if I need to include something else to indicate that playback is something that I need.
Is PlaybackController special in some way and unable to be included in combination with other Controllers? I've tried googling about this schema error but it's too vague and nothing's coming up.
Any help would be much appreciated!
__
EDIT:
I see now that video devices seem to get a different set of available Controllers, but there is still reference to using PlaybackController in a lot of places around the regular Smart Home Skill for entertainment devices. Really hope that it's possible!

So should have probably figure this out sooner. I'm using the python validation class provided by Amazon. Turns out that the schema from the same repo simply doesn't include any reference to Alexa.PlaybackController. Therefore, the validation fails every time with the error about mismatching schemas. Maybe they've added some controllers recently and forgot to update the schema.
I submitted an issue to the Smart Home repo here: https://github.com/alexa/alexa-smarthome/issues/62

Related

SendGrid API - Cannot use dynamic template data with a legacy template

Trying to follow the sample here https://docs.sendgrid.com/ui/sending-email/how-to-send-an-email-with-dynamic-templates,
I'm sending the following JSON to this url: "https://api.sendgrid.com/v3/mail/send" (and I have sent a simple email before using the same code, now I want to try a template with substitution):
{
"personalizations": [
{
"subject": "Test template email from SendGrid",
"to": [
{
"name": "Neal Walters",
"email": "myRecipient#example.com"
}
],
"dynamic_template_data": {
"Applicant_Name": "John Doe",
"Send_Date": "December 30, 2022"
}
}
],
"from": {
"name": "NealWalters(SendGrid)",
"email": "mySender#example.com"
},
"template_id": "bcab1b12-d922-4cdd-b6f5-9f39b16d9823"
}
and getting this cryptic error:
{"errors":[{"message":"Cannot use dynamic template data with a legacy template
ID","field":"personalizations.0.dynamic_template_data","help":null}]}
I have no idea what is a dynamic nor a legacy template. I copied one of Send Grid's demo templates (Nonprofit Newsletter Email Template) and added some of my own tags.
When I used the template name ("NealDemo Duplicate Nonprofit Newsletter Email Template") instead of the GUID (which I got from the URL when I was editing the template), the message was similar but added this to the above error - which leaves me with the question of can I use the template name or not? It's unclear what a "template_id" is on how to find it, if it is not the name of the template as I saved it.
{"message":"The template_id must be a valid GUID,
you provided 'NealDemo Duplicate Nonprofit Newsletter Email Template'.","field":"template_id","help":"http://sendgrid.
com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.template_id"},{"message":"Unless a valid template_id is
provided, the content parameter is required. There must be at least one defined content block. We typically suggest
both text/plain and text/html blocks are included, but only one block is required.","field":"content","help":"http://s
endgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.content"}]}
Disappointed these are not listed on this errors page:
https://docs.sendgrid.com/api-reference/mail-send/errors
Are there two template editors?
I used this one:
https://mc.sendgrid.com/design-library/your-designs/bcab1b12-d922-4cdd-b6f5-9f39b16d9823/editor
I didn't see any other guid/id for the template, so I tried "bcab1b12-d922-4cdd-b6f5-9f39b16d9823" from the URL.
But now I see there is also a dynamic template editor???
https://mc.sendgrid.com/dynamic-templates
As mentioned below, I copied one of your demo templates, which already had some substitution variables in at the bottom ({{Sender_Name}}
{{Sender_Address}}, {{Sender_City}}, {{Sender_State}} {{Sender_Zip}}). I just added two of my own at the top.
I have referenced this: Getting "Cannot use dynamic template data with a legacy template" with non-legacy template
The saga continues. I went to this page: https://mc.sendgrid.com/dynamic-templates and was able to copy over my previous template, so perhaps it was a legacy template. It now gave it a clearly labeled template-id of: d-a35d9d48ce304588bbebf7828811b473 (which looks like a "d-" followed by a guid).
I ran that through the API call, which resulted in no immediate errors, but then I got this email:
Usually when I can't figure things out, it is either the documentation is lacking, or I was speed-reading it.
When I first setup my account, I apparently clicked a link that took me to SendGrid's main site, and I signed up for an account there. Apparently this step was totally unnecessary (also their site requires a 2FA, separate from Azure). So I built my templates on their site, which was under a different account then the one I created in Azure. Thus I was able to send emails with the token from Azure, but any time I tried to send a template from my second account, of course, it was not recognized with my Azure account.
You can create templates inside of Azure, from the links shown below:
Then this:
NOTE 1 - their "pretty" designs are still under the Legacy Templates, and "Dynamic Templates" seem to be the newer preferred way to go. You can build a "legacy template", then apparently copy it's HTML over to a "dynamic template".
NOTE 2 - I only solved this by opening a support ticket with SendGrid.

Change Eve Python DOMAIN collection schema dynamically during runtime

I am using the Eve Python API Framework for MongoDB. I am writing a feature that allows my users to edit metadata sections for the documents that they are writing.
Example JSON:
{
"metadata": {
"document_type": ["story"],
"keywords": ["fantasy", "thriller"]
}
}
We have a CMS for the document editor that admins can use to allow them to do things like add new metadata fields for the authors (normal users) to add more information about their posts. For example, the site admin may want to add a field called "additional_authors" which is a list of strings. If they add this section to the frontend we would like some way to add it to the Eve Schema on the backend in real time without restarting the server. It is very important that it be real time and not part of a coding change in Eve or requiring Eve to restart.
Our current hard-coded metadata schema looks like this for the document collection:
{
"metadata": {
"type": "dict",
"schema": {
"document_type": {"type": "list", "required": True},
"keywords": {"type": "list", "required": True}
}
}
}
I understand that we can go with a non-strict approach when writing the "metadata" type dict so that it does not care what is inside but from my understanding this means we would not be able to use "projection" properly meaning that if I only wanted to return "metadata.additional_authors" of all documents through my API call, I would not be able to do so. Also, this would mean that we would have to deal with the required check ourselves using hooks instead of the built-in Eve schema check.
Is there anyway around this issue by essentially having a dynamic schema based on a MongoDB document that we can store the entire collection configuration dict in and retrieve it without restarting the server for it to take effect? Even if this means adding a hook to the new schema_dict collection and calling some internal Eve function I am all ears.
Thank you ahead of time for your help.

microsoft graph API /calendars id is not unique

When requesting calendars, the ID returned from the calendar sometimes changes.
We saw that the name of calendar differs sometimes (agenda or Calendar) - this is also reflected in the changeKey field, but would that mean that the calendar ID also changes?
It does not happen to all of our clients, just a few. What can cause this? What are we missing?
We already use the Immutable Id headers, but these don't apply to the calendars according to the docs.
{
"id": "AAMkADgyMzdkNzAyLTVhZGEtNDg1Yi***AAAAEGAAAqQIxwV34sQLN18DH-lwsGAAAAAYeRAAA=",
"name": "Agenda",
"color": "auto",
"changeKey": "qr2mXiE5k0+ASL9waSq4XAADFAI=",
"canShare": true,
"canViewPrivateItems": true,
"canEdit": true,
"owner": {
"name": "***",
"address": "***#***.com"
}
},
Any help is appreciated!
IIRC, calendars are actually folders under the covers and therefore are not affected by the ImmutableId prefer header. The reason for this is that folder ids are supposed to stay the same within a given mailbox regardless of where they are moved. As such, a calendar only has one id (PR_ENTRYID) and no immutableId (PR_IMMUTABLE_ENTRYID).
That doesn't of course explain what is happening here. I am curious if it is possible that the calendar folder is getting recreated somehow which would explain why the calendar id would be changing. Can you look at the creation time of the folder to see if it is more recent than you expect it to be?
There is a known issue with calendar folder immutable ids where they do change that is being investigated by our engineering team. Apologies for the inconvenience here.

How do you format data so that it can be easily consumed by MV* frameworks like Angular, Backbone, Ember, etc.?

I'm asking this question to fill a hole in my knowledge, myself having historically been primarily a front-end developer with little concern for server-side code for the longest time. I basically need some way to structure my data so that all relevant information from multiple tables in my database all exist in one place. So, let's say I have a user profile page for a Rails-based site that will use Angular.js on the client. My Angular code might expect a data model like this:
var user = {
"first_name": "Arkady",
"last_name": "Dracul",
"courses": [
{
"name": "Intro to Chemistry",
"id": "CH101",
},
{
"name": "Intro to Computer Science",
"id": "CS101",
},
{
"name": "Intro to Whatever",
"id": "W101",
}
],
"clubs": [
{
"name": "Salsa",
"id": "SDA"
},
{
"name": "Tango",
"id": "TDA"
}
]
}
How on earth do I actually get the data from the various tables in my database to come out structured like this? Mind you, I'm guessing (!) that I may need to have different data models for different views but am uncertain as to whether that would be a good practice if two views are mostly similar. Really, I'm not sure how to go about structuring data for consumption by the front end. Apart from any answers you provide here, are there any books that provide useful beginner-/intermediate-level information for someone like myself?
I'm not sure what you are asking, but if you are on rails, you can use a someUser.to_json to convert your database object to json.
Beside this, if you are trying to implement an API with rails, I strongly recommend grape https://github.com/intridea/grape. It is in active development, and I love it!
You also can build JSON views along with grape using Rabl https://github.com/nesquena/rabl or json_builder https://github.com/dewski/json_builder

Typeahead.js -> Token different from value doesn't work for me

this is my data
[{"Id": "21", "name": "Šport", "value": "Šport","tokens": ["Šport", "Sport"]}]
I want to the data to be found even if user does not use 'special' characters so it doesn't matter if he types in "Sport" or "Šport"' the data "Šport" will be found.
Should this be working or maybe any workaround sugestions ?
Thanks.
It should work. If it doesn't work, then I would start by checking whether this is really the data the Typeahead sees.
Is this remote? If so, have you made sure this is indeed what you server returns and what your client sees? Look at the Firefox/Chrome developer tools network requests to be sure.
If not, maybe you have stale (old) data in local storage (where Typeahead caches stuff)? Remove any dataset name just to be sure.
Finally, to verify that it works, try this exact data with `local.

Resources