Code Monkey home page Code Monkey logo

wot-book's People

Contributors

dependabot[bot] avatar domguinard avatar jtcmedia avatar vladounet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wot-book's Issues

Only LED 1 seems to work with UI.html

I am working in Chapter 10 and am using the code from the wot-pi image. I changed Simulate to false for the LEDs. The problem is that only LED 1 can be changed using the UI.html app. I even switched GPIO assignments for LED 1 and 2 to confirm nothing was wrong with my pin or LED. When I did that, the LED assigned as LED 1 (gpio used to be assigned to LED 2) would work, but LED 2 still doesn't change. I monitor the traffic and the Action message is sent with the proper parameters, but the LED 2 is not affected. I am not sure where to start the troubleshooting with this one.

Chapter7-implementation/part1-2-direct-gateway; Error while starting

Hello,
I wanted to seek some help, in order to get things started for chapter 7, part1-2-direct-gateway nodejs server.
Till now what I get is (after installing some npm packages which it prompted were missing)

$ node wot-server.js
Simulated Passive Infrared sensor started!
/home/pi/Desktop/wot-book/chapter7-implementation/part1-2-direct-gateway/plugins/internal/ledsPlugin.js:32
  Object.observe(what, function (changes) {
         ^

TypeError: Object.observe is not a function
    at observe (/home/pi/Desktop/wot-book/chapter7-implementation/part1-2-direct-gateway/plugins/internal/ledsPlugin.js:32:10)
    at Object.exports.start (/home/pi/Desktop/wot-book/chapter7-implementation/part1-2-direct-gateway/plugins/internal/ledsPlugin.js:13:3)
    at Object.<anonymous> (/home/pi/Desktop/wot-book/chapter7-implementation/part1-2-direct-gateway/wot-server.js:14:12)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.runMain (module.js:590:10)
    at run (bootstrap_node.js:394:7)

The thing worth noting is, the problem seems to be for the ledsPlugin particularly. When I comment the following line in wot-server.js

ledsPlugin.start({'simulate': true, 'frequency': 10000}); //#B

It seems to run perfectly!

$ node wot-server.js
Simulated Passive Infrared sensor started!
Simulated Temperature & Humidity sensor started!
HTTP server started...
WebSocket server started...
Your WoT Pi is up and running on port 8484
not anymore!
there is someone!
not anymore!
there is someone!
not anymore!
Temperature: 38 C, humidity 80 %
there is someone!

Bad path to config folder in proxy.js

On lines 8 and 9 of proxy.js, the path to the private key and certificate files need to be fixed to

    key: fs.readFileSync('../config/change_me_privateKey.pem', 'utf8'),
    cert: fs.readFileSync('../config/change_me_caCert.pem', 'utf8'),

Issue with setup.sh script on Linux (Ubuntu)

From: https://forums.manning.com/posts/list/39557.page

Hi Dom,
Really sorry for posting unrelated question in another thread.
I'm using Ubuntu 16.10. I have registered an EVRYTHNG account and got a operator API key.
Then in terminal when I run [ $ sh setup.sh XXX ], I've got an error "setup.sh: 9: setup.sh: Syntax error: "(" unexpected".
I tried again with [ $ ./setup.sh XXX ], It does steps 1-4 and also create action and redirect Url for me, and I also checked, project, product, thng has been created in my ERVYTHNG account and 5 times updated by setup.sh. But when I run
[ $ npm install ] //success
[ $ node simple-plug.js ]
The terminal just log with "Using Thng #YYY with API Key: XXX" and not updating my thng properties.
Thanks for replying soon.

Package "ws": "^7.3.1"

The new changes of ws to 7.3.1 result in an error when running the code. Please reverse the dependency number back to 0.7.2

setInterval vs setTimeout

In the script called simple-plug.js (chapter 7), it'd be better to call setInterval() instead of setTimeout on line 18, so that updateProperties() doesn't need to schedule a new timeout every time it is called.

Then in the closing logic, you could simply call clearInterval() to clean it up properly.

how I can bring figure 10.3 ?

hi and thanks for your good book.

I can start the server with "node wot.js" command in a secure mode correctly (I catch tocken key and use it with https).
but I don't know how can I use UI.html and bring figure 10.3 in chapter 10.
I think files such as UI.html and form-only.html is not embeded in the model, where I must accomodate them?

plz guide me
thank you in advance.

The Yahoo weather API has been retired since January 3rd 2019.

As per Yahoo weather developers site:

As of Thursday, Jan. 3, 2019, the weather.yahooapis.com and query.yahooapis.com for Yahoo Weather API will be retired.
To continue using our free Yahoo Weather APIs, use https://weather-ydn-yql.media.yahoo.com/forecastrss. Follow below instructions to get credentials and onboard to this free Yahoo Weather API service.

The mashup code uses yahoo API to compare temperature from a given location to Pi's location. Now it is easy for me fork the code and implement the newer or changed API but it requires an API key.

Return type might not be the clients' preferred

The current implementation of converter.js does not take into account the q parameter of content-negotiation. E.g.,:
Accept: text/html,application/xhtml+xml,application/xml;q=0.7,image/webp,application/json;q=0.8
will return JSON not HTML.

Chapter 7-can't control led by toggle button

I can change the status value by postman.
But it not worked when i use plug.html.
I can get the html response and I can see the Action on the dashboard of EVRYTHING.
but plug-with-control.js has not receive any message

Watching input pins with onoff

The following piece of code is from here

var Gpio = require('onoff').Gpio,
    sensor = new Gpio(17, 'in');

sensor.watch(function(err, value) {
    if (err) exit(err);
    console.log(value ? 'there is some one!' : 'not anymore!');
});

The watch callback is probably never called because the Gpio constructors optional edge parameter isn't used. The edge parameter specifies whether "falling", "rising", or "both" types of edges on the GPIO input pin should trigger interrupts which in turn will result in the watch callback being called. See here for more info.

For example, to detect interrupts on falling edges something like this would be used:

var Gpio = require('onoff').Gpio,
    sensor = new Gpio(17, 'in', 'falling');

sensor.watch(function(err, value) {
    if (err) exit(err);
    console.log(value ? 'there is some one!' : 'not anymore!');
});

Error after running wot-server.js

I am new to javascripct coding, so pardon me if this is a stupid issue because of lack of my knowledge. Every-time I run Wot-server.js with sudo su user (as sudo node doesn't work with nvm) I get an timeout error as following. Could you please see why this error is happening and how it can be resolved.

events.js:141
throw er; // Unhandled 'error' event
^

Error: No reply in 247s
at null._onTimeout (/home/pi/wot-pi/node_modules/coap/lib/retry_send.js:70:16)
at Timer.listOnTimeout (timers.js:92:15)

Maskup code - Chapter 2 in GitHub different that what's in the book

The code in GitHub is not the samw as in the book:

BOOK:
function prepareMessage(name, location, localTemp, piTemp) {
var diff = localTemp - piTemp;
var qualifier = ' > ';
if (diff < 0) {
qualifier = ' < ';
}
var result = name + '@' + location + qualifier + Math.abs(diff);
return result;
}

Chapter7-implementation/part1-2-direct-gateway ... TypeError: Object.observe is not a function

Any chance of someone applying a fix for this, now that the official node LTS version is 6.9.1?

kevin

pi@raspberrypi:~/wot-book/chapter7-implementation/part1-2-direct-gateway$ node wot-server.js
Simulated Passive Infrared sensor started!
/home/pi/wot-book/chapter7-implementation/part1-2-direct-gateway/plugins/internal/ledsPlugin.js:29
Object.observe(what, function (changes) {
^

TypeError: Object.observe is not a function
at observe (/home/pi/wot-book/chapter7-implementation/part1-2-direct-gateway/plugins/internal/ledsPlugin.js:29:10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.