The Haaska Super Thread

I see it was suppised to be haaska.event_handler. I changed it & the error changed.
I set my configuration.yaml just like the wiki.

api:

alexa:
  smart_home:

The error is now

START RequestId: ad5776f3-ecfc-49e2-bca6-36bc64929ab7 Version: $LATEST
(‘Connection aborted.’, RemoteDisconnected(‘Remote end closed connection without response’,)): ConnectionError
Traceback (most recent call last):
File “/var/task/haaska.py”, line 111, in event_handler
return ha.post(‘alexa/smart_home’, event, wait=True)
File “/var/task/haaska.py”, line 65, in post
timeout=(None, read_timeout))
File “/var/task/requests/sessions.py”, line 581, in post
return self.request(‘POST’, url, data=data, json=json, **kwargs)
File “/var/task/requests/sessions.py”, line 533, in request
resp = self.send(prep, **send_kwargs)
File “/var/task/requests/sessions.py”, line 646, in send
r = adapter.send(request, **kwargs)
File “/var/task/requests/adapters.py”, line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: (‘Connection aborted.’, RemoteDisconnected(‘Remote end closed connection without response’,))

END RequestId: ad5776f3-ecfc-49e2-bca6-36bc64929ab7

Any ideas?? I notice if I browse to /api/smart_home I get a text page from HA saying 404 not found.

Hello!
I was able to set-up haaska and I can see aaaaaalll my devices in Alexa.
Now, which is the best way to ask alexa for a sensor? :slight_smile:
I can see it on the app and it’s showing me the temperature.
Many thaks and great job!!
Simon

Do mean you see it in the alexa app and see the temp?

Hello,
I see the value in the Alexa app, yes.
I would like to ask alexa to read it, i.e. "Alexa, tell me the actual temperature in ".
I can actually do it for turning ON/OFF the devices.
Thanks!!
Simon

Hmm interesting. I have some ecobee sensors and thermostat set up in Alexa using the ecobee skill. I am able to ask alexa what is the temp of the thermostat. But was was pretty neat, was I created rooms with Alexa, added the individual ecobee sensors to each room and then was able to ask “alexa what is the temperature of the bedroom.” Try playing around with that. Basically if the app sees the temp, I suspect you should be able to ask, just might take a few tries to figure out the actual wording

Ok, thanks, I’ll give a detailed try. Most of the time, I’m asking wrong and funny things happens, like music from spotify :smiley:
BTW, another question. Now, I’ve NOT filtered devices, so via haaska near everything is shown.
I’ve a device (connected from Home Assistant via MQTT / mysensors) which is shown as follow in Home Assistant:

    "sensor_id": 24,
    "children": {
        "1": {
            "id": 1,
            "type": 13,
            "description": "WATT",
            "values": {
                "24": "262.5",
                "25": "182.0",
                "17": "268.1"
            }
        },

Its possible that nested values are not exposed to haaska / Amazon?
The device doesn’t show up. In Home assistant is like this:

 [sensor.node24power_24_1]
 268.1
 battery_level: 0
 heartbeat: 0
 child_id: 1
 description: WATT
 device: mqtt
 node_id: 24
 V_VAR1: 262.5
 V_VAR2: 182.0
 V_WATT: 268.1
 unit_of_measurement: W
 friendly_name: node24Power 24 1

Ideas?

Thanks!

Simon

I am facing a problem in Testing Haaska

START RequestId: c2d52e4f-82f8-45ad-b81d-44237b05928d Version: $LATEST
Expecting value: line 2 column 10 (char 11): JSONDecodeError
Traceback (most recent call last):
  File "/var/task/haaska.py", line 106, in event_handler
    config = Configuration('config.json')
  File "/var/task/haaska.py", line 80, in __init__
    self._json = json.load(f)
  File "/var/lang/lib/python3.6/json/__init__.py", line 299, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/var/lang/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/var/lang/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/var/lang/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 10 (char 11)

END RequestId: c2d52e4f-82f8-45ad-b81d-44237b05928d
REPORT RequestId: c2d52e4f-82f8-45ad-b81d-44237b05928d	Duration: 30.76 ms	Billed Duration: 100 ms 	Memory Size: 128 MB	Max Memory Used: 65 MB

Hi @xefil! I just replied on your GitHub issue, but for everyone here to see:

Alexa’s Smart Home Skill API does not support all sensors. As a result, it’s not something that either Haaska or Home Assistant can fix/change.

For reference, this page lists the capabilities that could be used (please note that not all of these are implemented by Home Assistant):
https://developer.amazon.com/docs/device-apis/list-of-interfaces.html

It does have a handy reference for utterances (phrases) though!

1 Like

Hi @smile :wave:

It looks like there’s an error in your config.json. If I had to guess, you’re missing something in the URL line.

Just like in the example, it’s important to make sure that the quotes " are there, and that the colon :is there as well.

{
  "url": "http://localhost:8123/api",
  "bearer_token": "",
  "debug": false,
  "ssl_verify": true,
  "ssl_client": []
}

Even if everything looks correct, try taking out the quotes and putting them back in. Sometimes a computer/phone/tablet will put in smart/curly quotes “”, instead of the correct straight quotes "".

config.json

{
  "url": "http://hassio.local:8123/api",
  "bearer_token": "example QiLCJhbGciOiJIUzI1NiJ",
  "debug": false,
  "ssl_verify": true,
  "ssl_client": []
}


Response:
{
  "errorMessage": "HTTPConnectionPool(host='hassio.local', port=8123): Max retries exceeded with url: /api/alexa/smart_home (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f7b49bb4c50>: Failed to establish a new connection: [Errno -2] Name or service not known',))",
  "errorType": "ConnectionError",
  "stackTrace": [
    [
      "/var/task/haaska.py",
      111,
      "event_handler",
      "return ha.post('alexa/smart_home', event, wait=True)"
    ],
    [
      "/var/task/haaska.py",
      65,
      "post",
      "timeout=(None, read_timeout))"
    ],
    [
      "/var/task/requests/sessions.py",
      581,
      "post",
      "return self.request('POST', url, data=data, json=json, **kwargs)"
    ],
    [
      "/var/task/requests/sessions.py",
      533,
      "request",
      "resp = self.send(prep, **send_kwargs)"
    ],
    [
      "/var/task/requests/sessions.py",
      646,
      "send",
      "r = adapter.send(request, **kwargs)"
    ],
    [
      "/var/task/requests/adapters.py",
      516,
      "send",
      "raise ConnectionError(e, request=request)"
    ]
  ]
}

Request ID:
"c744a72a-7459-4fd7-ad92-ccd9524b27b9"

Function Logs:
START RequestId: c744a72a-7459-4fd7-ad92-ccd9524b27b9 Version: $LATEST
HTTPConnectionPool(host='hassio.local', port=8123): Max retries exceeded with url: /api/alexa/smart_home (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f7b49bb4c50>: Failed to establish a new connection: [Errno -2] Name or service not known',)): ConnectionError
Traceback (most recent call last):
  File "/var/task/haaska.py", line 111, in event_handler
    return ha.post('alexa/smart_home', event, wait=True)
  File "/var/task/haaska.py", line 65, in post
    timeout=(None, read_timeout))
  File "/var/task/requests/sessions.py", line 581, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/var/task/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/var/task/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/var/task/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='hassio.local', port=8123): Max retries exceeded with url: /api/alexa/smart_home (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f7b49bb4c50>: Failed to establish a new connection: [Errno -2] Name or service not known',))

END RequestId: c744a72a-7459-4fd7-ad92-ccd9524b27b9
REPORT RequestId: c744a72a-7459-4fd7-ad92-ccd9524b27b9	Duration: 216.82 ms	Billed Duration: 300 ms 	Memory Size: 128 MB	Max Memory Used: 63 MB	

config.json

{
  "url": "http://my.duckdns.org/api",
  "bearer_token": "example QiLCJhbGciOiJIUzI1NiJ",
  "debug": false,
  "ssl_verify": true,
  "ssl_client": []
}


Response:
{
  "errorMessage": "2019-03-16T00:50:12.736Z 29f3eb20-7820-4a71-825f-9c340566f10a Task timed out after 3.00 seconds"
}

Request ID:
"29f3eb20-7820-4a71-825f-9c340566f10a"

Function Logs:
START RequestId: 29f3eb20-7820-4a71-825f-9c340566f10a Version: $LATEST
END RequestId: 29f3eb20-7820-4a71-825f-9c340566f10a
REPORT RequestId: 29f3eb20-7820-4a71-825f-9c340566f10a	Duration: 3003.15 ms	Billed Duration: 3000 ms 	Memory Size: 128 MB	Max Memory Used: 64 MB	
2019-03-16T00:50:12.736Z 29f3eb20-7820-4a71-825f-9c340566f10a Task timed out after 3.00 seconds

Hi all,

I’ve been enjoying playing with Haaska - it’s doing a better job with my colour temp hue bulbs that the proper hue skill, which has a habit of forgetting they’re not just dimmables.

That said, was having a bit of a headache getting my amp to work with Haaska - could turn it on and off, but couldn’t get volume to work.

After doing some digging, I spotted the “supported” array under the relevant interface in the discover json was coming back blank. After doing some more digging I made a clone of the alexa component as a custom component and modified the _AlexaSpeaker and _AlexaStepSpeaker classes to define the supported properties and the supporting functionality:

class _AlexaSpeaker(_AlexaInterface):
"""Implements Alexa.Speaker.

https://developer.amazon.com/docs/device-apis/alexa-speaker.html
"""

def name(self):
    return 'Alexa.Speaker'

def properties_supported(self):
    return [{'name': 'volume'},{'name':'muted'}]

def properties_retrievable(self):
    return True

def get_property(self, name):
    if name != 'volume' and name != 'muted':
        raise _UnsupportedProperty(name)
    if name == 'volume' and 'volume_level' in self.entity.attributes:
        return self.entity.attributes['volume_level']
    if name == 'muted' and 'is_volume_muted' in self.entity.attributes:
        return self.entity.attributes['is_volume_muted']
    return 0

class _AlexaStepSpeaker(_AlexaInterface):
"""Implements Alexa.StepSpeaker.

https://developer.amazon.com/docs/device-apis/alexa-stepspeaker.html
"""

def name(self):
    return 'Alexa.StepSpeaker'

def properties_supported(self):
    return [{'name': 'volume'},{'name':'muted'}]

def properties_retrievable(self):
    return True

def get_property(self, name):
    if name != 'volume' and name != 'muted':
        raise _UnsupportedProperty(name)
    if name == 'volume' and 'volume_level' in self.entity.attributes:
        return self.entity.attributes['volume_level']
    if name == 'muted' and 'is_volume_muted' in self.entity.attributes:
        return self.entity.attributes['is_volume_muted']
    return 0

(These classes appear around line 594 in smart_home.py)

I can now control the volume of my amp :slight_smile: - although there’s no slider in the Alexa app on my phone (that may just be the way things are though?)

Hope this is of use to someone!

1 Like

@Matt_Gray Wow! Amazing stuff! Thanks for sharing that.

That’s the thing with Haaska, we only relay whatever Home Assistant provides, and unfortunately that module needs some work to map functionality better.

Is it possible to clean all discovered entity?

@Superimo88 Do you mean, to remove them from Alexa?

The fastest way I know of is to use the Alexa website, and even then it is still selecting them one by one. This same issue applies even if you use other Smart Home skills.

Hi guys, I’ve been following the tutorial and I can make it work when trying the “Testing-Haaska” test.
But when I go into my alexa app and select my skills, it doesn’t let me enable it. It’s like the button does nothing.
What could it be?
Thanks in advance.

Welcome @cristianlazarop!

It doesn’t show anything? Not even an error message?

I might suggest trying to enable through the Alexa website: https://alexa.amazon.com

Hi all,
I have a strange problem that started occuring today, I’m no longer able to get Alexa to turn on/off my devices by speaking to it, despite the device still being controllable from the Alexa app.
For example, I have a device called TV in the app which I can turn off fine. But if I try to turn off the TV by telling Alexa, it says it cannot find TV. Normally this works perfectly. It’s the same issue with all my devices now it seems.
Has anyone else had this?
Thanks,
Mat.

--------- UPDATE ! ----------
didnt realise the wife had switched over to her profile on the echo!
works fine back on my profile! can i add te same functionality to her profile?

Could Haaska work with intends?
Would love to interact with my shopping_list:

Hi @mathewtaylor2007!
There is a way to do this… It’s certainly not standard, but here goes:

  1. Go to the Amazon Developer Console
  2. Go to Alexa > Alexa Skills Kit. Click “Edit” on your current skill.
  3. Go to the “Distribution” tab. Fill in everything that’s required, and make sure to put in a Privacy Policy URL. It can be anything, even your personal site. You’ll also need an icon. Use this: https://github.com/mike-grant/haaska/files/3056190/icons.zip
  4. In the next step, “Privacy & Compliance”, you should answer the questions. A quick break down:
  • “…real money?” > No
  • “…personal information?” > No
  • “…target children under the age of 13?” > No
  • “…advertising?” > No

Be sure to check the “Export Compliance” box. Put in anything you’d like under testing instructions, as we’re not submitting it for review.

  1. Now, in “Availability”, you should see the “Beta Test” box. If everything has been filled out correctly, you can open it. Add your own e-mail address in the Administrator box, and in the “Tester” box, add your wife’s Amazon account e-mail.

Your wife should get an e-mail asking if she wants to enable this skill on her profile, which she then can. Now everyone will have access! :slight_smile:

2 Likes

Hi @Underknowledge!

Haaska can only work with the Smart Home skill stuff, which means Devices. It doesn’t replace intents. I haven’t tested it, but you should still be able to use custom intents with no problem.

1 Like