Espruino and Amazon Alexa integration (implementation completed)

Posted on
Page
of 3
First Prev
/ 3
  • because "EspruinoWifi" was not found with 1.95

    It's a module that gets loaded in off the net (it's never been part of Espruino) - so if you pasted into the left hand side or didn't have an internet connection, that might have been the cause?

  • No right hand side as usual. If i require Wifi it works fine.

    Edit

    I tried your provided beta version of EspruinoWifi and the
    CIPCIPSERVER Error is gone. Sadly UPnP packages still do not arrive.. but i am a step further and have to debug it.

    Edit 2

    I changed the code of the beta EspruinoWifi so the Dgram.createSocket results in calling the AT command AT+CIPSTART=0,"UDP","0",0,1900,2 which.. according to a guide i found should listen on port 1900 for incoming messages from all addresses and allow me to respond to the sender of the last incoming message with AT+CIPSEND. If i then a UDP message to 239.255.255.250:1900 with netcat no message arrives. If i send the UDP message directly to the IP of the espruino (192.168.0.17 in my case) the message arrives.

    Does the AT firmware not support broadcast/multicast? Or what could be the problem?


    1 Attachment

    • Image1.jpg
  • It's case sensitive - if you look on http://www.espruino.com/WiFi all the examples use var wifi = require("EspruinoWiFi");

  • Oh my god.. with EspruinoWiFi it does work. Sorry i missed that!
    By the way there is still the bug when i call getIP without connecting beforehand.. i fixed this in you posted beta version and i am quite sure i did a pull request a while back that fixed this. Seems like it found its way back :D

  • Well.. if found a thread regarding UDP multicast with AT firmware http://bbs.espressif.com/viewtopic.php?f=16&t=234&p=6382&hilit=multicast#p6382 .
    The thread is a bit older but since i can't find anything thats stating the opposite it seems the AT firmware does not support this.

    Thats it then.. or has someone another idea?

  • I assume that if you know the IP address of the Alexa device there's no need to multicast? You can just send everything directly to it?

  • I would have to try that.. but its a good idea. Other possibilities are maybe tcp broadcast in combination with a own skill thats using tcp broadcast for discovery or a solution with some kind of gateway and mqtt for example. But this is all far more work then necessary.. if espressif would just have included this feature in their AT firmware.. its in the SDK.. why not exposing it in the AT firmware grml

    I did read its possible to modify the AT firmware and add features to it.. this would be another solution.. but maybe the hardest route to go.

  • So i tried a few things now.. and sadly i am can't get alexa to discover. I tried starting the scan and then manualy responding to the UPNP search from alexa with multicast du 239.255.255.250:1900 but alexa does not care about it. I sniffed the traffic with tcpdump to make sure i send after the search from alexa and that my espruino wifi is sending the right response. While looking at the traffic running in with tcpdump i saw some devices answer to alexa directly and port of 50000 but still UDP. I tried that too.. but it it does not even show up in the tcpdump log. I guess with so much else i want to do i leave it as it is. Maybe i use a ESP8266 or ESP32 myself and round up the module but for espruino boards i see no chance without complete UDP support.

  • It may be that this just isn't possible with the ESP8266 AT firmware. As far as I can tell the AT firmware provides no information on where a UDP packet came from (address/port), so it might not be possible to send a response back to the right address (unless you know for sure where Alexa is).

    The CIPSTATUS (implementation source link) seems to be the command returning the remote_port/ip information. Perhaps that could be send for every +IPD received?

  • Wow, thanks - good find! Yes, that sounds like it'd be perfect. It's never going to be super-fast so I don't think the extra overhead would be such a problem.

  • There seems to be even better way which would be to use AT+CIPDINFO according to the docs PDF.

    On github I could only find the CIPDINFO in the docs for ESP32 though and the implementation seems to be in the libat_core.a which looks like a closed source thing probably shared across the ESPs.

  • Even in a scenario where i do know the address of alexa it did not work. And if i understood the AT documentation right there is a mode (mode 2) in CIPSTART where you can answer to the message origin. And yes.. this is all just a lack of the AT firmware.

  • Interesting about CIPDINFO - I'll have to give that a try. I guess it may not be in the 0.40 firmware that the Espruino WiFis ship with, but it's worth a try :)

  • Hm.. maybe in newer versions of the AT firmware UDP multicast is properly supported too.
    Is it possible to update the firmware without risking to kill the espruino?

  • According to this the 1.5.0 version might be required http://bbs.espressif.com/viewtopic.php?f=66&t=1677&p=5517&hilit=CIPDINFO#p5517. So perhaps the CIPSTATUS workaround (could be problematic for multiple subsequent incoming +IPDs of different origins) and when the CIPDINFO works use rather that.

    But that gets complicated. Does EspruinoWifi support updating the ESP firmware? With that it could get integrated into the EspruinoWebIDE flasher which would be sufficient IMO.

  • Theoretically you can update the ESP8266 firmware via the EspruinoWiFi, but it's not an easy process. I think I'd try and stick with the existing firmware if at all possible - I don't think many people would bother updating it if I added the option to do so... And actually I just tested and CIPDINFO=1 works fine, so it looks like there's no need.

    It's just as well, because AT+CIUPDATE would have been perfect, but it seems to fail :(

    @PaddeK I'm not sure multicast is supported in any firmwares? I could be wrong though

  • I think at the moment not.. but its really not easy to find solid information about the AT firmware and its capabilities. But i did find a statement that older versions are open source and therefore are extensible.. no idea how feasible that is though.
    My only hope at this point is that you come up with some magic to make UDP multicast happen or espressif gifts us with a new AT firmware :)

  • Espruino WiFi now has UDP support: http://forum.espruino.com/conversations/316287/#comment14072238

    There's no broadcast as far as I can tell but thanks to @opichals you can now get the UDP sender's IP and port, which I imagine will help a lot

  • As soon as i got some spare time i will pick up where i left and see if this brings the hoped solution.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Espruino and Amazon Alexa integration (implementation completed)

Posted by Avatar for Vasily @Vasily

Actions