ID and Descriptions of objects for Alexa

9 views
Skip to first unread message

Christopher Piggott

unread,
Jan 8, 2018, 9:01:01 AM1/8/18
to pytomation
I have built an Alexa Smart Home Skill that allows the Echo to communicate with a Pytomation instance via Pytomation's REST API.  I'm still working out the details of it but so far so good.  It works as an AWS Lambda that reaches out to Pytomation to do both discovery and control.

AWS Smart Home skills require three things: a device ID, a name, and a friendlyName.  The 'friendly' name is how you address the device using voice commands.

1. In the Pytomation API there is an ID, it's a string like "Light11" ... how stable are those numbers from runt or un?  I need them to be very stable, even if I change the order they appear in the instance configuration.  I'd really like a way to be able to specify that ID myself, is that possible?

2. Pytomation Lights and other objects have a 'name'; but not a 'friendlyName' ... how hard would it be to add it, as a more generic "Description" property?  I attempted to add it to the superclass of Light but it didn't show up in /api/devices.  For now I'm setting both fields to 'name' but that makes things a little awkward. 



David Heaps

unread,
Jan 8, 2018, 11:46:25 AM1/8/18
to pytom...@googlegroups.com
1) Not stable. The ID is an auto assigned number, at runtime, based on how many objects have been loaded at the time. Dustin was adding some code to allow you to control a device by name (it's required to be unique anyhow); just last night I was working out a plan to merge and forward port that code.

2) I think the change by Dustin would help your case, you but I am also planning a feature to add synonyms to device names and commands, to aid in voice commands. If there Amazon API allows, you could just send the entire spoken text to Pytomation, as it can already understand spoken text.

Let me first say this is really cool, and would love to add this capability to the Pytomation repo. I should, however, declare my bias: I, personally, don't like Alexa or Google Assistant. I don't like how the technology requires Amazon and Goggle to record audio in your home and send and save that data on their servers, all the time, no exceptions.

I've been, silently and slowly I'll admit, working on building a script to handle continuous speech recognition, using the Kaldi gstreamer server, so it can feed commands to Pytomation when it hears the keyword of your choosing. Kaldi is free, opens source, has comparable accuracy with US English, and runs on your own server.

Some would see this as a good thing, others not so much, so I really would like to keep the options open, for people to choose themselves.

After that, I'd add Wolfram hooks to send the spoken text query to Wolfram if Pytomation couldn't recognize the command internally. With the more interfaces (or skills) added to Pytomation, the more it becomes it's own Assistant.

--
You received this message because you are subscribed to the Google Groups "pytomation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytomation+unsubscribe@googlegroups.com.
To post to this group, send email to pytom...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Christopher Piggott

unread,
Jan 8, 2018, 11:57:42 AM1/8/18
to pytom...@googlegroups.com
The Alexa smart home interface isn't hat bad, though, and I don't think there's a ton of work to make it work smoothly.  One of the nice things about doing it their way is that you can just address it with a command - you don't have to invoke a particular application.  Example:

   "Alexa, turn on living room lights"

vs. 

   "Alexa, tell pytomation to turn on living room lights"


I don't know if all this voice stuff is good or bad either.  Sometimes hitting a button or two is faster than a voice command.

I'm not doing anything magical here, though, so I'll try to get it on github asap.

Dustin was adding some code to allow you to control a device by name 

Just an idea but what if you could specify IDs manual, but if you don't it falls back to auto generating the way it does now?




--
You received this message because you are subscribed to a topic in the Google Groups "pytomation" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pytomation/QLPZLLo-0Eg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pytomation+unsubscribe@googlegroups.com.

David Heaps

unread,
Jan 8, 2018, 12:20:18 PM1/8/18
to pytom...@googlegroups.com
That's the exact reason why I stopped using the Tasker AutoVoice feature to handle this; it was too cumbersome to be practical. As of right now, I only issue voice commands if I'm already running the web interface, which has it built in. (Right now I have OK Goggle turned off completely, due to my bias, but that's besides the point)

From what I understand, Google Assistant can allow the same (that API has a whole home automation section). The new Kaldi interface would also do the same. I completely agree that it's a big step up to making these features practical.

It's possible to do what your saying. You'd have to change the main Pytomation object's init and po_common to allow it. This could break the API for some though, as it is expected for ID to consist of the device name followed by a number to make it unique. But if it's optional, it should be ok.

I'm not against the change, as long as it's optional, but why is the ID preferred over the unique name?

Christopher Piggott

unread,
Jan 8, 2018, 12:25:55 PM1/8/18
to pytom...@googlegroups.com
I'm not against the change, as long as it's optional, but why is the ID preferred over the unique name?

For Amazon Smart Home device purposes, the only reason is that IDs have rules that pytomation "name" doesn't ... especially spaces/punctuation.  So I could use the name but filter it to make it "legal" I suppose.


David Heaps

unread,
Jan 9, 2018, 2:23:41 AM1/9/18
to pytom...@googlegroups.com
That makes sense. If Alexa doesn't support spaces for this purpose, a static ID is what you need.

Jason Sharpee

unread,
Jan 9, 2018, 7:17:04 AM1/9/18
to pytom...@googlegroups.com
I designed the ID initially to support the UI without any interaction from the instance config.   


Haven't looked at the code in a few years, but I believe you can just expose it in the attributes, assign it manually (override), and shouldn't result in any harm.   Just be careful not to reuse an ID obviously.

David

unread,
Jan 14, 2018, 4:05:22 PM1/14/18
to pytomation
I updated pytomation_object.py to allow for this (it was really just 5 lines of additional code). You can find the change in the dev branch and, from docker, dheaps/pytomation:dev (it's actually building now, so in 15 minutes).

Please let me know if you require anything else to allow Pytomation to integrate with Alexa.

Jason Sharpee

unread,
Jan 14, 2018, 4:47:10 PM1/14/18
to pytom...@googlegroups.com
Excellent!

BTW: how long did it take you to test with the back porch light ID typo? :)

On Jan 14, 2018 4:05 PM, "David" <king.dop...@gmail.com> wrote:
I updated pytomation_object.py to allow for this (it was really just 5 lines of additional code). You can find the change in the dev branch and, from docker, dheaps/pytomation:dev (it's actually building now, so in 15 minutes).

Please let me know if you require anything else to allow Pytomation to integrate with Alexa.

--

David

unread,
Jan 14, 2018, 4:54:46 PM1/14/18
to pytomation
About 10 minutes; it was a pretty basic change. What typo?

Jason Sharpee

unread,
Jan 14, 2018, 5:24:58 PM1/14/18
to pytom...@googlegroups.com
I saw you changed the address of your back porch light and thought it was a typo ;)

On Sun, Jan 14, 2018 at 4:54 PM, David <king.dop...@gmail.com> wrote:
About 10 minutes; it was a pretty basic change. What typo?
--
You received this message because you are subscribed to the Google Groups "pytomation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytomation+unsubscribe@googlegroups.com.
To post to this group, send email to pytom...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Jason Sharpee

David Heaps

unread,
Jan 14, 2018, 5:31:37 PM1/14/18
to pytom...@googlegroups.com
No, just a new address. I don't keep that instance file updated with my true addresses as they're not pertinent to the examples.

Christopher Piggott

unread,
Jan 14, 2018, 8:28:16 PM1/14/18
to pytom...@googlegroups.com
I will try to get this Amazon Echo code uploaded this week.  I should have time.

I'm going to make a public git project for it, then anyone can do what they want with it.  I'll try to develop some instructions as well, but setting up permissions etc. for aws lambda is a little complicated.  I can eventually put something into the app store but the issue with this is it wouldn't be free for me to host the service for more than a few users.  Because of that I think I'd rather just open source all the code and folks can do with it what they wish.

More soon.

--C


You received this message because you are subscribed to a topic in the Google Groups "pytomation" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pytomation/QLPZLLo-0Eg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pytomation+unsubscribe@googlegroups.com.

David

unread,
Jan 14, 2018, 8:59:31 PM1/14/18
to pytomation
Awesome, thank you. I've heard a few others that want Alexa working with this... my brother-in-law being one of them.

Amazon actually pays developers to add an Alexa skill. I'm not so sure that this is a qualifying category (could be under productivity), but some people make a living off of making these skills. You might want to check that out: https://developer.amazon.com/alexa-skills-kit/rewards

I didn't realize that Alexa skills required paid hosting by the developer/company and not paid by Amazon... That's interesting, and counter-intuitive to trying to recruit developers by paying them.
Reply all
Reply to author
Forward
0 new messages