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

Wich Alexa device send fire the onsetstate event #217

Open
sergio83100 opened this issue Feb 24, 2022 · 3 comments
Open

Wich Alexa device send fire the onsetstate event #217

sergio83100 opened this issue Feb 24, 2022 · 3 comments

Comments

@sergio83100
Copy link

Hello everybody,
The issue I have to fix is not a really bug but just a request for enhancement ..
Could it be possible to get the Alexa device IP address when the "onsetstate" is fired?
This will be very helpfull to associate Hue emulator and Alexa device
Thanks by advance for any help ...

@pvint
Copy link
Member

pvint commented Feb 24, 2022

Do you mean, for example, printing out the IP of the device (to serial) that sent the command?

You can get that by enabling debugging in fauxmoESP.h with `#define DEBUG_FAUXMO Serial' (but you get a lot of other "noise" as well). Having ability to print it out without being verbose on everything would be useful. I'll try to have a look at this (when I've had my coffee! ;) )

@sergio83100
Copy link
Author

Hello Paul,

Many thanks to consider my request so quickly.

I've 8 Alexa Dot in my house and 8 ESP boards each assigned to one Alexa device regarding Amazon managing. My purpose is, at ESP level, to accept or denie an Alexa device request depending of my own association rules. This will allow to associate or not logically one Alexa device to selected ESP boards, and to interact depending these associations rules.

May be this could be done by adding a parameter in the callback "onsetstate" like: "String alexa_device_ip".

Many thanks again, and ... enjoy your coffee!

@sergio83100
Copy link
Author

sergio83100 commented Mar 21, 2022

Hello Paul,

Finally I made a fork (for my own usage) of your library to reach my needs.

The modification is very simple, in the _onTCPcontrol() routine I just modified the onSetState call back signature by adding the remote IP new argument:

_setCallback(client->remoteIP().toString().c_str(), id, _devices[id].name, _devices[id].state, _devices[id].value);

instead of:

_setCallback(id, _devices[id].name, _devices[id].state, _devices[id].value);

Then I modified in accordance the call back prototype in fauxmoESP.h, and finally I modified my own code to be in accordance withe the new call back signature.

This seems work perfect, but from your point of view is my modification correct?

But I don't know how to keep both call back signatures to garanty the compatibility with already existing code using your library ...

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants