New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding devices on runtime. #357
Comments
Hello, I'm doing a dynamic driver configuration from electron UI & IPC by using require. electron IPC Code: ipc.on('device', (event, arg) => {
console.log("ipc called");
const DeviceServer = new DeviceHttpServer(arg);
DeviceServer.start();
}); Dynamic Server Code: import http from "http";
class DeviceHttpServer{
constructor(device){
this.device = device;
console.log("DeviceHttpServer object created");
}
start(){
require( __dirname +"/" + this.device);
}
}
export default DeviceHttpServer; cylon module code called by require: import Cylon from "cylon";
Cylon.api("http", {
host: '127.0.0.1',
port: '3001',
ssl: false,
auth: false
});
Cylon.robot({
name: "hoge",
connections: {
bebop: { adaptor: 'hoge' }
},
devices: {
drone: { driver : 'hoge' }
},
work: function(my){
}
}).start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am using Cylon for my Smart Devices framework, I am using MQTT for this purpose. I've defined a driver for my AirConditionar let's say. I have an ESP8026 chip in each AC which may use the different driver, but let's stick to one for now and I am using MQTT for communication.
I've added MQTT device with a topic devices/events on which every device will send data. I am using this device inside ESP's custom driver.
Now I want to add more devices dynamically to this robot in my MQTT's onConnect event on broker side. How can I do that?
This is the way I am defining my driver
and this is the way I've defined my driver.
The text was updated successfully, but these errors were encountered: