I am currently working on a HomeKit project with Espruino WiFi and I'm running some tests first.
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?
Espruino has a page that describes how to handle modules.
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.
Hi - I think the issue you've got is it's a multi-file typescript library. You may have some luck installing it and then using just the dist/index.js file (which is the compiled JS bundle), but looking at it, it pulls in a bunch of extra modules from elsewhere as well - some of which look pretty heavyweight.
I'm afraid there's a very good chance that there's just too much code to fit on an Espruino device. I'm sure you could make an Espruino device into a HomeKit device, but you may have to implement it from scratch I'm afraid (at least hap-nodejs's dependencies look a bit heavy to me)
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.
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem