• 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?



Avatar for M.Montore @M.Montore started