Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alexa improvements #10632

Merged
merged 28 commits into from
Nov 17, 2017
Merged

Conversation

robbiet480
Copy link
Member

@robbiet480 robbiet480 commented Nov 17, 2017

Description:

This is me trying to match the major functionality of Haaska and because @maddox begged and pleaded for me to do so 😝

  • Adds support for the following domains:

    • alert
    • automation
    • cover
    • fan
      • supports on/off and set speed
    • group
    • lock
    • media_player
      • play
      • pause
      • stop
      • set volume
      • adjust volume
      • next track
      • previous track
    • scene
  • Adds customize attributes

    • Props to customize display/invocation
      • alexa_hidden - hide from Alexa
      • alexa_name - change name displayed/used by Alexa
      • alexa_description - change description shown in Alexa
    • Props to control displayCategories
      • alexa_display_categories - set displayCategories, useful for things like media_player (TV/SPEAKERS) or scene (ACTIVITY_TRIGGER/SCENE_TRIGGER)
  • Change description to entity ID instead of empty string so it looks better in Alexa app

  • Change manufacturer name from Unknown to Home Assiatant as per discovery recommendations and so it looks better in Alexa app

  • Minor grammar/readability fixes

Checklist:

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

@postlund
Copy link
Contributor

This is awesome! 👍

@robbiet480
Copy link
Member Author

@balloob (calling you out since I believe you own the skill) you should be aware of special requirements for SceneController, specifically that only certain devices are allowed to be controlled via scenes. I'm unsure if logic should be added to ensure that blacklisted devices can't run, let me know what you want to do...

@robbiet480
Copy link
Member Author

Also we need a way to blacklist or whitelist entire domains just like Haaska. Unsure how best to do this since cloud is bringing up alexa.smart_home. Configuration under cloud seems a bit weird...

@maddox
Copy link
Contributor

maddox commented Nov 17, 2017

🤗

@maddox
Copy link
Contributor

maddox commented Nov 17, 2017

I noticed last night that when asking alexa to run a Scene, it worked, but it returned an error. But having that Scene triggered via a Routine, it worked without Alexa mentioning an error. I'll try to get some logs next time.

@balloob
Copy link
Member

balloob commented Nov 17, 2017

Nice!

For filtering, let's use the entity filter helper. (In a future PR)

Configuration via the cloud.

cloud:
  alexa:
    filters:
      include_domains:
      include_entities:
      exclude_domains:
      exclude_entities:

This will make it easier for us in the future to make a UI for it 👍

Update: I initially included that we shouldn't use customize but put that under cloud config instead, but realized that we lose context.

hass.states.async_set(
'{}.test'.format(domain), 'off', {
'friendly_name': "Test {}".format(domain)
})

call = async_mock_service(hass, domain, 'turn_on')
call = async_mock_service(hass, 'homeassistant', 'turn_on')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason we would change this to homeassistant instead of directly calling the domain? Saves 1 service call -> faster.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I guess it doesn't work for groups.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in this PR since time is of the essence for Alexa.

@balloob balloob added this to the 0.58 milestone Nov 17, 2017
@balloob balloob merged commit 2b60fca into home-assistant:dev Nov 17, 2017
@maddox
Copy link
Contributor

maddox commented Nov 17, 2017

THIS IS A HUGE DEAL!!!!!!

Thanks everyone!

@arsaboo
Copy link
Contributor

arsaboo commented Nov 17, 2017

HUGE indeed....thanks a lot!

@Redferne
Copy link

Great work! We are still limited by Amazon by having us saying "Alexa, ask to...." and the manual dual configuration in both HA and ASK, right? This was/is the main reason for the great Haaska which is running great on the V2 api. Configure the lambda once and no need to ever touch it again.

@jer78
Copy link

jer78 commented Nov 18, 2017

Very excited for this!! 😁

balloob pushed a commit that referenced this pull request Nov 18, 2017
* Initial scene support

* Initial fan support

* ordering

* Initial lock support

* Scenes cant be deactivated; Correct the scene display category

* Initial input_boolean support

* Support customization of Alexa discovered entities

* Initial media player support

* Add input_boolean to tests

* Add play/pause/stop/next/previous to media player

* Add missing functions and pylint

* Set manufacturerName to Home Assistant since the value is displayed in app

* Add scene test

* Add fan tests

* Add lock test

* Fix volume logic

* Add volume tests

* settup -> setup

* Remove unused variable

* Set required scene description as per docs

* Allow setting scene category (ACTIVITY_TRIGGER/SCENE_TRIGGER)

* Add alert, automation and group support/tests

* Change display categories to match docs

* simplify down the display category props into a single prop which can be used on any entity

* Fix tests to expect proper display categories

* Add cover support

* sort things

* Use generic homeassistant domain for turn on/off
@balloob balloob mentioned this pull request Nov 18, 2017
cgtobi pushed a commit to cgtobi/home-assistant that referenced this pull request Nov 20, 2017
* Initial scene support

* Initial fan support

* ordering

* Initial lock support

* Scenes cant be deactivated; Correct the scene display category

* Initial input_boolean support

* Support customization of Alexa discovered entities

* Initial media player support

* Add input_boolean to tests

* Add play/pause/stop/next/previous to media player

* Add missing functions and pylint

* Set manufacturerName to Home Assistant since the value is displayed in app

* Add scene test

* Add fan tests

* Add lock test

* Fix volume logic

* Add volume tests

* settup -> setup

* Remove unused variable

* Set required scene description as per docs

* Allow setting scene category (ACTIVITY_TRIGGER/SCENE_TRIGGER)

* Add alert, automation and group support/tests

* Change display categories to match docs

* simplify down the display category props into a single prop which can be used on any entity

* Fix tests to expect proper display categories

* Add cover support

* sort things

* Use generic homeassistant domain for turn on/off
@nordicblue
Copy link

Hey guys!

Got excited when the latest release of HA brought me to this page and I saw that there is fan support. I'm just a little confused as to how it functions?

In the API/pi/lights, it seems that my fan is still listed as a dimmable light, I'm assuming this is not for the emulated hue and requires me to setup the lambda API? Can someone please point me to what I need to configure in order to ask Alexa to set my fan speed?

Thanks a bunch!!

	"2": {
		"modelid": "HASS123",
		"name": "Fan",
		"state": {
			"bri": 85,
			"on": true,
			"reachable": true
		},
		"swversion": "123",
		"type": "Dimmable light",
		"uniqueid": "fan.bedroom_fan"
	},


@home-assistant home-assistant locked and limited conversation to collaborators Nov 24, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants