Avatar for M.Montore

M.Montore

Member since Feb 2020 • Last active Mar 2021
  • 2 conversations
  • 5 comments

Most recent activity

  • in Other Boards
    Avatar for M.Montore

    Hi Gordon,

    I was afraid that would be the case. I tried what you said about "index.js" but it didn't work in the end. I will have to do it from scratch as you suggest. Thanks a lot for the help anyways.

  • in Other Boards
    Avatar for M.Montore

    Hi MaBe,

    I already checked the page you linked before, however it is not helping me. As I said, I can not convert the package to an actual file .js that I can upload to the Espruino.

    Thanks again

  • in Other Boards
    Avatar for M.Montore

    I am currently working on a HomeKit project with Espruino WiFi and I'm running some tests first.

    There is a git that has a great example (https://github.com/homebridge/HAP-NodeJS­-examples/tree/master/light-example-java­script). The project has a "light.js" program and "package.json". In the terminal (linux), I just install the necessary dependencies with "npm install" and I execute the application "node src/light.js". It works perfectly, I find the extension in Apple HomeKit App in my phone, I can edit the light parameters, everything.

    However, when I try to do the same inside the Espruino Web IDE, I can not access to the module in require("hap-nodejs"). In the terminal, the npm does everything for me, but here I know I need to introduce the .js file in the module section in Espruino Web IDE, but "hap-nodejs" is not a .js file. I need to transform the "package.json" into my "hap-nodejs.js" so I can use it as a private module. I tried to find a way to do it but nothing seems to work. I also downloaded the .tgz file from "https://www.npmjs.com/package/hap-nodejs­", and try to find what I need from there. But it is the same in the end, another package and directories containing the dependencies needed.

    My question is: How can I get the module I need (hap-nodejs) to execute "light.js" inside the Espruino?

    Thanks

  • in General
    Avatar for M.Montore

    Thanks for replying so fast, Gordon!

    I understand what you are saying. However, I want to create a device with an easy setup/configuration, in which case I need to provide constant feedback. The information submitted (WiFi password, IP, Gateway and Netmask) can be correct or not, and whichever the case is, I need to be able to inform it to the customer, and my only way to communicate is through the web page. If I close the server first, I am unable to inform of the result.
    Also, I need to create the web server before connecting to the second network, because the parameters of the second one are provided by the customer in the web page.

    Any suggestions? Are you planning on implementing something that may help with this issue in the near future?

    Thanks again for the help!

  • in General
    Avatar for M.Montore

    Hi!
    I am still learning so I want to apologize in advance if I say something incorrect.

    The thing is, I initialize the Espruino as an AP and create a Web Server with the AP IP address. The pages presented by the Web Server show a list of the nearby Access Points detected by "wifi.scan" in checkboxes. It also has 4 text fields: to introduce the WiFi password, an IP, a Gateway and a Netmask. The customer should select one of the detected WiFi networks and fill the blanks in the four text fields.
    With the inputs submitted by the customer it tries to connect to this new WiFi and creates another WebServer with the IP, gateway and netmask received.

    So, after this process Espruino WiFi should be able to have simultaneously the AP generated by the Espruino and connected to the WiFi network, each one with its Web Server associated. When I create the second page, the first Web Server disappears, and also the Espruino stops working as an AP itself.

    How can I keep both Web Servers active and the Espruino working as an AP also connected to the new WiFi network I receive? Am I missing something important?

    Thanks for the help!

Actions