experiment and look at pos after construct done
parent
c43fa52b95
commit
d222bddc9c
8
init.lua
8
init.lua
|
@ -3,7 +3,7 @@ if not http_api then
|
|||
print("ERROR: in minetest.conf, this mod must be in secure.http_mods!")
|
||||
end
|
||||
|
||||
minetest.register_node("connected:iotswitch", {
|
||||
local node = minetest.register_node("connected:iotswitch", {
|
||||
tiles = {"textures/tutorial_decowood.png"},
|
||||
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
||||
on_rightclick = function (pos, node)
|
||||
|
@ -17,5 +17,9 @@ minetest.register_node("connected:iotswitch", {
|
|||
print(dump(res))
|
||||
end)
|
||||
end)
|
||||
end
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
-- register with rest API to the server ?
|
||||
print(dump(pos))
|
||||
end
|
||||
})
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "connectedJS",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"mosca": "^0.29.0"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
var mosca = require('mosca');
|
||||
var settings = {
|
||||
port: 1883
|
||||
};
|
||||
|
||||
var server = new mosca.Server(settings);
|
||||
|
||||
server.on('clientConnected', function(client) {
|
||||
console.log('client connected', client.id);
|
||||
});
|
||||
|
||||
// fired when a message is received
|
||||
server.on('published', function(packet, client) {
|
||||
console.log('Published', packet.payload);
|
||||
});
|
||||
|
||||
server.on('ready', setup);
|
||||
|
||||
// fired when the mqtt server is ready
|
||||
function setup() {
|
||||
console.log('Mosca server is up and running');
|
||||
}
|
Loading…
Reference in New Issue