marcoschwartz / node-aREST

Node.js module for the aREST framework
http://aREST.io/
11 stars 10 forks source link

no method 'send' #1

Closed spotrevoc closed 9 years ago

spotrevoc commented 9 years ago

Hello, when I try to run node app.js, I get an object has no method 'send' error. spotrevoc@penguin:~/arduino/arduino-wifi-powerswitch/interface$ node app.js Listening on port 3700 TypeError: Object function defaultClient() { return target.apply(undef, arguments); } has no method 'send' at /home/spotrevoc/arduino/arduino-wifi-powerswitch/interface/app.js:21:9 at Layer.handle as handle_request at next (/home/spotrevoc/node_modules/express/lib/router/route.js:110:13) at Route.dispatch (/home/spotrevoc/node_modules/express/lib/router/route.js:91:3) at Layer.handle as handle_request at /home/spotrevoc/node_modules/express/lib/router/index.js:267:22 at Function.proto.process_params (/home/spotrevoc/node_modules/express/lib/router/index.js:321:12) at next (/home/spotrevoc/node_modules/express/lib/router/index.js:261:10) at SendStream.error (/home/spotrevoc/node_modules/express/node_modules/serve-static/index.js:107:7) at SendStream.emit (events.js:95:17)

marcoschwartz commented 9 years ago

Hello,

Are you referring to this article: https://www.openhomeautomation.net/arduino-wifi-switch/ ?

If yes, I updated it since then, please use the newest version of the code :)

spotrevoc commented 9 years ago

I am referring to that article, however I have the error using the most recent code from github, unless it was updated within the last 2 weeks. On May 2, 2015 11:06 AM, "marcoschwartz" notifications@github.com wrote:

Hello,

Are you referring to this article: https://www.openhomeautomation.net/arduino-wifi-switch/ ?

If yes, I updated it since then, please use the newest version of the code :)

— Reply to this email directly or view it on GitHub https://github.com/marcoschwartz/node-aREST/issues/1#issuecomment-98383409 .

marcoschwartz commented 9 years ago

It has been updated about a month ago. I just checked, there is no more send() function in the new code on this repository.

spotrevoc commented 9 years ago

Thanks for the update! I would also like to know if you can help a little with an ESP8266. I have been using an ATMega328p paired with an Adafruit CC3000 wifi shield to control 6 optically isolated triacs with zero-cross detection so I can independently dim up to 6 A/C outlets using a modified version of your interface. But as I have discovered, TI's CC3000 is crap so I purchased a couple ESP-12 modules loaded with NodeMCU firmware.

The "arduino" sketch uses the external interrupt to detect a zero crossing on an H11AA1 opto-coupler connected to INT0, then starts a timer interrupt to trigger an ISR every 800us so I get 10 levels of dimming with 333us left over to reset the triacs. The sketch is based on your aREST/CC3000 Wifi example with my own functions to handle the dimming and parsing additional parameters from the API. Since the CC3000 causes a lot of lockups, I disabled the mdns responder and totally removed the watchdog timer. It made the CC3000 significantly, and I mean significantly, more stable, but not good enough. On top of that, the SD card takes up another 2 or 3 pins on my ATMega forcing me to use the TX/RX and analog input pins as GPIO.

I'm very, very new to LUA and have not fully explored the capabilities of the 8266, so I was wondering if you know if it's possible to do something similar on NodeMCU, or through the new version of the Arduino IDE with 8266 support installed. I have managed to add a function of my own to the aREST.lua for a "momentary" press, basically briefly triggers a relay used to open/close my garage door. Please find code attached.

Thanks for your help!

On Sun, May 3, 2015 at 1:18 AM, marcoschwartz notifications@github.com wrote:

It has been updated about a month ago. I just checked, there is no more send() function in the new code on this repository.

— Reply to this email directly or view it on GitHub https://github.com/marcoschwartz/node-aREST/issues/1#issuecomment-98454195 .

marcoschwartz commented 9 years ago

Great, closing the issue :) For your project with the ESP8266 I really recommend using the Arduino IDE that was written specifically for this chip:

https://github.com/esp8266/Arduino

My aREST library is also now compatible with the ESP8266 Arduino IDE. It might work with Lua, but that's something I cannot help you with. With the Arduino IDE it should work fine. Good luck!