586837r / node-red-contrib-alexa-remote2

MIT License
87 stars 72 forks source link

Smarthome node Appliance/Group selection not working #35

Open Dakyne opened 4 years ago

Dakyne commented 4 years ago

Hello,

Let's start with the end : everything I tried works except the smarthome part of nodes. I'm using it like this for my tests :

image

With the smarthome node I have this error : "smarthome entity not found: """ And with the routine smarthome : "could not find smarthome entity: "undefined""

In the config tab of smarthome node I have this :

image

Thanks for this addon !

lukefairbank commented 4 years ago

I get the same thing, burned heaps of time on it.

586837r commented 4 years ago

What do you see in your browser's Developer Tools console when you open an Alexa Smarthome config?

586837r commented 4 years ago

What browser is this? Does it behave the same way in Chrome/Firefox?

Dakyne commented 4 years ago

I'm not home, but I was using firefox on Linux, and nodered is runing as a homeassistant (hassos) addon in the provided VM by home assistant. I'll tell you what's in the console tonight ? (in 9 hours or something) ^^

lukefairbank commented 4 years ago

I have tried chrome, edge and Firefox. Not at home to check either though

Sent from Ninehttp://www.9folders.com/


From: 586837r notifications@github.com Sent: Friday, 2 August 2019 6:20 pm To: 586837r/node-red-contrib-alexa-remote2 Cc: lukefairbank; Comment Subject: Re: [586837r/node-red-contrib-alexa-remote2] Smarthome node not working (could not find smarthome entity "undefined") (#35)

What browser is this? Does it behave the same way in Chrome/Firefox?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/586837r/node-red-contrib-alexa-remote2/issues/35?email_source=notifications&email_token=AGEF6WYFLGDGWCURRPIL3WTQCPU4PA5CNFSM4IIK2T22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3NBBFA#issuecomment-517607572, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGEF6W22TFC2PKFRXAHLZ73QCPU4PANCNFSM4IIK2T2Q.

Dakyne commented 4 years ago

Okay I got this for an Alexa Smarthome action : image

586837r commented 4 years ago

Please make sure that XHR is enabled in the console filters. (response is interesting) Do you get an error notification at the top of the page when you open the config?

Dakyne commented 4 years ago

Oh okay sorry. I get a 404 in the response and as a notification when I open the node :

URL de la requête : http://ip:port/alexa-remote-smarthome.json?account=<account.id>
Méthode de la requête :GET
Adresse distante : ip:port
Code d’état : 404
Version : HTTP/1.1

Response header :

HTTP/1.1 404 Not Found
Content-Type: text/plain; charset=utf-8
Content-Length: 14
Date: Fri, 02 Aug 2019 23:13:34 GMT
Server: Python/3.7 aiohttp/3.5.4
586837r commented 4 years ago

Are you running 3.0.6? It has fixed a 404 error (#34)

Dakyne commented 4 years ago

Fixed … Since I installed a less than a week ago I didn't think there was already an update.

mobamoba commented 4 years ago

I'm still having this issue with the most recent version. When I click Get Entities, it lists all my Smarthome Devices in the message output. However, there's doesn't seem to be a way to apply an Action to an Entity as far as I can tell.

586837r commented 4 years ago

@Dakyne Nice! No worries. @mobamoba What exactly is wrong? Can you not select an entity in Alexa Smarthome node with the Action option? Is the "Note: Select an initialised account..." still showing? Do you get an error notification at the top of the page when you open the config or a 404?

mobamoba commented 4 years ago

My account is initialized and Routines, for example, work fine. I can't select an Entity in Alexa Smarthome. I get the same ??? options as in the screenshot in the initial post.

586837r commented 4 years ago

If you don't see the "Note: Select an initialised account..." then either there is an Error while initialising the internal smarthome entities structure or you simply don't have any entity that supports at least 1 action.

Do you get a warning while the account is initialising? (You can trigger an initialisation with Alexa Init).

You can look at the internal smarthome entities structure with a flow like this to see what entities have what actions:

[{"id":"e970fc13.85c32","type":"inject","z":"c0bfc064.e8d26","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":850,"y":200,"wires":[["fe8092e8.4f02f"]]},{"id":"912e5561.093b68","type":"debug","z":"c0bfc064.e8d26","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":830,"y":320,"wires":[]},{"id":"e830f205.fc31f","type":"function","z":"c0bfc064.e8d26","name":"","func":"function map2obj(map) {\n    return Array.from(map.entries()).reduce((o,[k,v]) => (o[k] = v, o), {});\n}\n\nfunction isMap(o) {\n    return typeof o === 'object' && String(o) === '[object Map]';\n}\n\nif(isMap(msg.payload)) {\n    msg.payload = map2obj(msg.payload);\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":850,"y":280,"wires":[["912e5561.093b68"]]}]
mobamoba commented 4 years ago

Sorry meant to say: I saw the select initialized account and selected the one I'd already initialized. I still got a bunch of ???. My result looks just like the screenshot in the first post, i.e. an initialized account selected the ??? in both lists.

I get no warnings and account works perfectly fine. I'm using right now to trigger Alexa routines.

586837r commented 4 years ago

The ??? is not an error in of itself. If you don't have any smarthome entity with at least 1 action then you will see ???. You can check the internal structure with the flow i posted before to check if you have an entity with an action.

mobamoba commented 4 years ago

I'm not sure what you mean by that. Perhaps I'm misunderstanding something: I have 3 Alexa smart plugs and want to be able to turn them on and off via Node Red. When I do a complete msg output from Get Entities, I can see my smart plugs listed there in various arrays. Where would they show up such that I could turn them on or off? Thanks.

586837r commented 4 years ago

You should be able to select a smarthome device where you currently see "???". Just to debug it would be interesting what the smarthome "Simplified" structure looks like.

mobamoba commented 4 years ago

Sure - here's the output of Get Simplified:

msg : Object
object
payload: object
empty
_msgid: "2fb07cd0.5cdac4"

By contrast, here's what I see for Get Entities (I picked the first plug rather than cut/paste the whole thing):

msg : Object
object
payload: array[5]
0: object
id: "66003d9c-4b37-4891-b18f-7909a2d40616"
displayName: "Trunk Lamp"
description: "Amazon Smart Plug"
supportedProperties: array[2]
0: "turnOff"
1: "turnOn"
supportedTriggers: array[0]
supportedOperations: array[2]
0: "turnOff"
1: "turnOn"
availability: "AVAILABLE"
icon: object
value: "SMARTPLUG"
providerData: object
enabled: true
relationships: array[0]
categoryType: "APPLIANCE"
deviceType: "SMARTPLUG"
586837r commented 4 years ago

Please get the simplified with this flow:

[{"id":"e970fc13.85c32","type":"inject","z":"c0bfc064.e8d26","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":850,"y":200,"wires":[["fe8092e8.4f02f"]]},{"id":"912e5561.093b68","type":"debug","z":"c0bfc064.e8d26","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":830,"y":320,"wires":[]},{"id":"e830f205.fc31f","type":"function","z":"c0bfc064.e8d26","name":"","func":"function map2obj(map) {\n    return Array.from(map.entries()).reduce((o,[k,v]) => (o[k] = v, o), {});\n}\n\nfunction isMap(o) {\n    return typeof o === 'object' && String(o) === '[object Map]';\n}\n\nif(isMap(msg.payload)) {\n    msg.payload = map2obj(msg.payload);\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":850,"y":280,"wires":[["912e5561.093b68"]]}]

And you can copy the output with this button: Capture

mobamoba commented 4 years ago

Imported your flow and inserted Smarthome Get Simplified with my account chosen between the Inject and the Function and go nothing:

image

lukefairbank commented 4 years ago

I have the same issue on 3.0.6 and have run the flow you provided above. I also get the empty message as above. image

586837r commented 4 years ago

Are you sure that you don't get a warning like Capture in the console when initialising?

In any case you can send me the output json of Smarthome Get Devices and Smarthome Get Entities so i can see where it fails. You can send it directly to my email.

mobamoba commented 4 years ago

Is there private information in either of those? If not I'm fine posting here if that's easier.