dsandor / fauxmojs

Fake WeMo device ported to NodeJS. Allows Alexa (Amazon Echo) to make api calls.
56 stars 22 forks source link

Visit https://alexa.amazon.[de|com ] #13

Closed neophob closed 6 years ago

neophob commented 6 years ago

when using fauxmojs and visiting the alexa website, suddenly all devices are powered on.

ramsnerm commented 6 years ago

I had the same issue. I added a check if the request is a set command and not a get command from Alexa. Following modification solved the issue for me:

Change in file deviceEndpoints.js:

if (request.payload.indexOf('<BinaryState>1</BinaryState>') > 0) { action = 'on'; } else if (request.payload.indexOf('<BinaryState>0</BinaryState>') > 0) { action = 'off'; }

to (by adding a check if it is a set request)

if (request.payload.indexOf('</u:SetBinaryState>') > 0) { if (request.payload.indexOf('<BinaryState>1</BinaryState>') > 0) { action = 'on'; } else if (request.payload.indexOf('<BinaryState>0</BinaryState>') > 0) { action = 'off'; } }

neophob commented 6 years ago

@ramsnerm do you mind creating a PR for that issue?

ramsnerm commented 6 years ago

@neophob done :-)

dsandor commented 6 years ago

Merged. About to bump to 1.0.3 on npm to include this and some other PRs.