I'm using Fauxmo library to work with Alexa Dot. I would like to identify the Alexa device which is requesting for a command.
Is it possible and if yes how?
Thanks by advance for your help!
This is possible only if your modify the library. The current version of the library doesn't offer that information to the callbacks.
Hello Pylon,
That's what I thaught, I had a look to library code but i don't know where to investigate in the code, may be arround the http request from Alexa, could you give me a track ?
Thanks by advance for your help.
I'm not experienced in the protocol but I guess you should modify the _onTCPControll() routine, access the client parameter, get the pcb_tcp structure by calling the pcb() method on it and use the remote_ip field of it (of type ip_addr_t).
Remember this will be a lot of work, you'll be using methods explicitly marked as "do not use" and there's no guarantee that future version will still support this.
Be sure you use a version control system (git is the only relevant player nowadays) so you at least might be able to use later versions of the libraries.
Hello Pylon,
That's great of you to have investigated to give me a track to setup the fonctionnality I'm looking for.
For some days I will be far from my computer so I'll to do further what's you propose me.
Thanks again for your help, I'll let you know as soon as possible !
Hello Pylon,
As you suggested me, in fauxmoESP.cpp I investigate the _onTCPControll() routine and modify it in this way.
I replace:
_setCallback(id, _devices[id].name, _devices[id].state, _devices[id].value);
by:
_setCallback(client->remoteIP().toString().c_str(), id, _devices[id].name, _devices[id].state,
_devices[id].value);
Then in fauxmoESP.h I made this modifcation.
I replace:
typedef std::function<void(unsigned char, const char *, bool, unsigned char)> TSetStateCallback;
By:
typedef std::function<void(const char *, unsigned char, const char *, bool, unsigned char)> TSetStateCallback;
And finally in my code I modify the fauxmo.onSetState call back event in accordance with the new signature and it works perfect!
Thanks to have helped me!
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.