C/C++ Question ESPAlexa a library to control ESP via Alexa. Is there a way to port this library to B4R?

daveinhull

Active Member
Licensed User
Longtime User
Hi Gonza8,

I rolled back to 1.8.11 and it compiled but it doesn't work. Akexa doesn't discover any new devices. I've tried from my echo show and my echo dot (although I don't think it makes any difference which echo device you use on your network to scan for me devices) and my alexa on my phone and Web.

I've also gone back to the the Arduino IDE and loaded the example which comes with the library and still no go.

I'm at a bit of a loss now as to what to do next.

Thank Dave
 

daveinhull

Active Member
Licensed User
Longtime User
Hi candid,

That would be great, please let us know when you get chance to do it.

BTW is there a guide on producing wrappers, I'd very much like to learn how to do it?

Dave
 

daveinhull

Active Member
Licensed User
Longtime User
Hi All,

I'm not sure if I've done things correctly, but:
1. I copied the new Espalexa.h file from Github to the additonal libaries folder (where rEspAlexa is)
2. I had to edit rEspAlexa.cpp to remove processing routine as it was not in the EspAlexa.h file
3. Also had to remove it from rEspAlexa.h and from rESPAlexa.xml
4. The xample I was using id have a call to processing in the "PinButton_Change" routine which I just commented out

and OMG, it works :oops: ?

But I'm note sure what 'processing' was doing.

Dave
 

candide

Active Member
Licensed User
processing routine was added only to test callbacks, it can be removed without impact.i

i am also testing wrapper with new version 2.7.0 and i am facing an error :

Espalexa.h:610:2: error: #endif without #if
610 | #endif
| ^~~~~
exit status 1

it is linked with preprocessing #ifdef /#ifndef / #elif /#endif not working with my version of arduino

i will update my version of arduino 1.8.15 to 1.8.19 to check impact
 
Last edited:

daveinhull

Active Member
Licensed User
Longtime User
Hi,

As per earlier comments, you have to roll back to an earlier version of the Arduino IDE. I went back to 1.8.11 and it works well. Gonza8 had got it working with 1.8.14, but I don't think any later versions work.

I actually had version 1.8.19 installed initially and it didn't work.

It would of course be good to find out why later versions don't compile.

Dave
 

daveinhull

Active Member
Licensed User
Longtime User
Hi @candide,

When you had it running on the old version, did you see if the ESP device was listed in the Alexa app list of devices?
As mentoned, I've got it discovered by Alexa and it works, but when I looked at All Devices in the Alexa app it isn't there? I'm not sure how that could happen to be honest. She knows its there as she responds to my voice requests, but it ain't listed:rolleyes:

When you get it working, could you check in your Alexa app to see if the device(s) is/are listed?

Thanks
Dave

[Edit: I went into the Alexa web app and it is listed - now I'm really confused ?]
 

candide

Active Member
Licensed User
for issues seen under B4R, please to look at issues with this library under arduino :

wrapper don't change arduino library behavior...
 

candide

Active Member
Licensed User
we have a strange behevior of B4R with new versions of arduino.

from tests done of ESPAlexa v2.5.0 and v2.7.0 with several version of arduino we can see:


ESPAlexa 2.5.0
arduino 1.8.12 =>OK
B4R 3.90 + arduino 1.8.12 OK
ESPAlexa 2.7.0
arduino 1.8.12 =>OK
B4R 3.90 + arduino 1.8.12 OK

ESPAlexa 2.5.0
arduino 1.8.13 =>OK
B4R 3.90 + arduino 1.8.13 OK
ESPAlexa 2.7.0
arduino 1.8.13 =>OK
B4R 3.90 + arduino 1.8.13 OK




ESPAlexa 2.5.0
arduino 1.8.14 =>OK
B4R 3.90 + arduino 1.8.14 NOK multiple errors
Espalexa.h:1:1: error: '' does not name a type
1 | //#if !defined Espalexa_h
ESPAlexa 2.7.0
arduino 1.8.14 =>OK
B4R 3.90 + arduino 1.8.14 NOK error #endif

ESPAlexa 2.5.0
arduino 1.8.15 =>OK
B4R 3.90 + arduino 1.8.15 NOK multiple errors
Espalexa.h:1:1: error: '' does not name a type
1 | //#if !defined Espalexa_h
ESPAlexa 2.7.0
arduino 1.8.15 =>OK
B4R 3.90 + arduino 1.8.15 NOK error #endif


ESPAlexa 2.5.0
arduino 1.8.19 =>OK
B4R 3.90 + arduino 1.8.19 NOK multiple errors
Espalexa.h:1:1: error: '' does not name a type
1 | //#if !defined Espalexa_h
ESPAlexa 2.7.0
arduino 1.8.19 =>OK
B4R 3.90 + arduino 1.8.19 NOK error #endif

conclusion: from arduino 1.8.14 and later, some compilations of library OK under arduino but are NOK with B4R
=> from arduino 1.8.14 some compatibilities are lost in B4R
 

candide

Active Member
Licensed User
in fact if ESPAlexa v2.7.0 is installed under arduino and if Espalexa.h, EspalexaDevice.cpp, EspalexaDevice.h are removed in B4R directory rEspalexa, compilation is OK with B4R
i will make a new delivery of rEspalexa v2.7.0 in this way, but i don't understand why compilation is NOK when ESPAlexa library is in rESPAlexa directory.
 

thetahsk

Active Member
Licensed User
Longtime User
in fact if ESPAlexa v2.7.0 is installed under arduino and if Espalexa.h, EspalexaDevice.cpp, EspalexaDevice.h are removed in B4R directory rEspalexa, compilation is OK with B4R
i will make a new delivery of rEspalexa v2.7.0 in this way, but i don't understand why compilation is NOK when ESPAlexa library is in rESPAlexa directory.
This looks like an encoding problem.
Remove the BOM identifier ( Byte Order Mark) from your source codes. ( see details: https://en.wikipedia.org/wiki/Byte_order_mark)
If you use Notepad++, convert all your files to UTF-8 (without BOM) and save them.
I checked the original archieve from https://github.com/Aircoookie/Espalexa/archive/refs/tags/v2.7.0.zip.
The espalexa.h file is wrong UTF-8-BOM encoded.

That's why the preprocessor gets confused and creates errors like
"Espalexa.h:610:2: error: #endif without #if" or "Espalexa.h:1:1: error: '' does not name a type".

Tip: Notepad++ shows always the encoding rigth below.
1659444873426.png

have a nice day
 
Last edited:
Top