Author Topic: Help needed in specific configuration  (Read 2202 times)

jonaspaulo

  • Newbie
  • *
  • Posts: 12
    • View Profile
Help needed in specific configuration
« on: March 15, 2010, 12:21:44 pm »
Hello, i have been talking in the IRC channel, and so I will copy here what I've said there. Hope someone can help. Thanks

Code: [Select]
[11:12:46]  <jonaspaulo_> lets say i have a 4 switch openwrt board with a sensor connected via spi or uart
[11:13:02]  <jonaspaulo_> how can i integrate the sensor with linuxMCE?
[11:13:23]  <jonaspaulo_> i mean i plug via ethernet the core to one ethernet port on the switch
[11:13:33]  <jonaspaulo_> but afterwards how do i access the sensor data
[11:14:02]  <jonaspaulo_> lets assume the processing of data is already passed through the spi to the ethernet port
[11:14:08]  <possy> jonaspaulo_, open up a thread in the forum. I am sure hari will have some information for you
[11:14:17]  <jonaspaulo_> kk
[11:14:19]  <jonaspaulo_> will do
[11:14:24]  <jonaspaulo_> cause my project
[11:14:37]  <jonaspaulo_> has sensors connected to various openwrt boards
[11:14:52]  <jonaspaulo_> like zigbee which i talked to TSCHAKeee2  about
[11:15:02]  <jonaspaulo_> possibly trying to do some drivers for it
[11:15:12]  <jonaspaulo_> like bluetooth with an ethernet bridge also
[11:15:16]  <jonaspaulo_> a vga cam
[11:15:20]  <jonaspaulo_> and some wireless sensors
[11:15:36]  <jonaspaulo_> but none has really and outgoing connection like usb or rs232
[11:15:45]  <jonaspaulo_> and instead are connected directly to the openwrt board
[11:16:13]  <jonaspaulo_> the goal was to integrate all this in linuxmce

jonaspaulo

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Help needed in specific configuration
« Reply #1 on: March 16, 2010, 03:06:01 pm »
I posted this entry in the wiki http://wiki.linuxmce.org/index.php/Startup_Info_For_Developers#.27.27.27First_Steps_in_making_your_own_device_driver.27.27.27__.28WIP.29  and today i was testing it to see if everything is ok. But before that i was trying to add a general usb cam to the system, and as i am doing that i got a warning of low harddrive free space left 0o. How is it possible? i haven't done almost nothing nor installed nothing. and my hard drive is 60 gb :S

jonaspaulo

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Help needed in specific configuration
« Reply #2 on: March 29, 2010, 10:42:00 pm »
Well I made a .pdf in order to present my linuxmce network config and expose some doubts. If someone can please read it and tell me something about it i would be very appreciated since my schedule to deliver the project is tighten up and I am not moving on :/

here is the link: http://filebin.ca/kwccfg


totallymaxed

  • LinuxMCE God
  • ****
  • Posts: 4458
  • Smart Home Consulting
    • View Profile
    • Dianemo - at home with technology
Re: Help needed in specific configuration
« Reply #3 on: March 30, 2010, 09:32:21 am »
Well I made a .pdf in order to present my linuxmce network config and expose some doubts. If someone can please read it and tell me something about it i would be very appreciated since my schedule to deliver the project is tighten up and I am not moving on :/

here is the link: http://filebin.ca/kwccfg



Hmmm... the 'Switches' you mention in the PDF are all network switches correct? ie they switch IP packets. Therefore assuming that is true you do not need to make DCE devices for these at all as S1, S2 & S3 are just passive parts of your LAN. Its the devices connected to the ports of the S1-3 switches that will need devices.

Andrew
Andy Herron,
Convergent Home Technologies Ltd

Read My Blog; http://ellipticalcurve.com

Contact me for Smart Home consulting advice here;
@herron on Twitter, inquiries@ellipticalcurve.com via email or PM me here.

Get a Dianemo License: http://forum.linuxmce.org/index.php?topic=8880.msg100221#msg100221
Follow us on Facebook: https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465

Sales & Info:
http://www.dianemo.co.uk

jonaspaulo

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Help needed in specific configuration
« Reply #4 on: March 30, 2010, 11:08:20 am »
yes IP based. But don't i need to add templates at least to SW 2 and 3 as interface devices to the sensors? Since i think all sensors must have an interface device? Thanks for looking into it

posde

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3013
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Help needed in specific configuration
« Reply #5 on: March 30, 2010, 12:02:58 pm »
Hmmm... the 'Switches' you mention in the PDF are all network switches correct?

No. They are devices like the GC-100 afaict

jonaspaulo

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Help needed in specific configuration
« Reply #6 on: March 30, 2010, 12:11:28 pm »
So as "possy" in the irc suggested,  i will present here the questions, nor the system though ( you can read it please in the pdf , its easier than post here).

The goal is to connect the sensors to LinuxMCE, they all provide their info via TCP/IP since they are connected to the switches and provide their info through the ethernet ports, i need to make the code in c++ on the end of LinuxMCE to receive that data.

Question 1 - I have three switches in the system, one to raise the number of lan ports (S1), and the other two which have sensors connected to them via SPI, rs2323, CAN. The S1 is connected to the core pc, and the other two are connected to this first one. Do i need to create a template device for any of the switches ( the main one and the sensor's ones) or letting the system know them in any way? (since they are just used to interconnect the system?)

Question 2 - For the sensors themselves should I mimic for example the motion sensor, the one you already have in the system? in terms of events, commands ,etc for the template? And what differs from yours is the real implementation c++ code?


THanks

« Last Edit: March 30, 2010, 12:17:07 pm by jonaspaulo »

sambuca

  • Guru
  • ****
  • Posts: 447
    • View Profile
Re: Help needed in specific configuration
« Reply #7 on: March 30, 2010, 12:34:57 pm »
Hi

I'll try to answer, but not knowing the details, it's hard to give any detailed answer  ;)

1. You are talking about switches. It is not clear from your post if some of these (S1?) are a plain ethernet switch. If it is, its not necessary to create any device template for it.
If they are different types of switches, I would recommend that you somehow make it clear what type each one is.

1 & 2. Device templates (DT). If you need special device templates for the sensors depends on how it is best to implement this device driver.
For instance the ZWave driver has a special ZWave DT for the USB controller itself, and uses generic DTs for any ZWave sensor and other ZWave device connected.
In that setup, all commands are sent to the ZWave DT/Device, which then sends the correct command to the sensor/device. Each sensor/device DT has a port/channel data which uniquely identifies the device within the ZWave network.
Using this approach you'd have to write one piece of code which is responsible for communication between LMCE and your switches and sensors.
In your PDF you are talking about selecting "writing c++ code" for the sensor DT. Is that really necessary?
I'd prefer to keep the number of code-requiring DTs as low as possible. Maybe some or all devices can use the same approach as ZWave, use generic DTs and a central ZWave driver/DT?

br,
sambuca


jonaspaulo

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Help needed in specific configuration
« Reply #8 on: March 30, 2010, 02:59:48 pm »
1. yes they are just ethernet switches, so there's no need to even add it somehow to linuxmce right? just plug

2. yes that approach would be the best one, i didn't know it was possible. so the ZWaveDT/Device equivalent in my scenario would be S2 and S3 which have the sensors connected to them. and yes i guess its easier to create code to act in the switches. So for the sensors i just mimic templates which similar functions to mine (like motion sensor, etc) and then control then via the "central driver" right?

Another thing how should i create that "central driver"? I have to associate it with some switch? (S2 and S3) , create the template and then implement the code?

Thanks a lot for the info

sambuca

  • Guru
  • ****
  • Posts: 447
    • View Profile
Re: Help needed in specific configuration
« Reply #9 on: March 30, 2010, 05:36:50 pm »
2.
Yes, if you don't have any reason not to, I would recommend writing one driver.
So basically, first you would add a device template with the switch (S2/S3) in mind and select "Write c++ code". There are LMCE utilities that will generate the C++ skeleton to write your code in. Real easy. This gives you a complete executable that will connect to the dcerouter and can communicate with LMCE.

In this template, you can specify commands and events for the device. You could see the ZWave and probably other existing DTs what could make sense to add. For instance: you will probably add a "Sensor tripped" event, as your sensors will fire this, and the device receive it and send the event to LMCE.

Is the S2 and S3 switches the same model, or present much the same functionality? If so, maybe you should create one driver (and one device template) for both. You could then add two devices in LMCE, one for each switch.

For the sensor templates, I would use the existing ones, if they suit your need. Basically, sensors will only emit events, and has only a few device data. If you need to store much data in the devices, maybe you could add new DTs for them.

regards,
sambuca

totallymaxed

  • LinuxMCE God
  • ****
  • Posts: 4458
  • Smart Home Consulting
    • View Profile
    • Dianemo - at home with technology
Re: Help needed in specific configuration
« Reply #10 on: March 30, 2010, 06:00:06 pm »
yes IP based. But don't i need to add templates at least to SW 2 and 3 as interface devices to the sensors? Since i think all sensors must have an interface device? Thanks for looking into it

So therefore you do not need any DT's for the S1-2 network switches at all...just think of these as part of the network cabling itself. The Sensors themselves are connected to an RJ45 socket on the S1-2 switches and it is these sensors that need DT's.

Andrew
Andy Herron,
Convergent Home Technologies Ltd

Read My Blog; http://ellipticalcurve.com

Contact me for Smart Home consulting advice here;
@herron on Twitter, inquiries@ellipticalcurve.com via email or PM me here.

Get a Dianemo License: http://forum.linuxmce.org/index.php?topic=8880.msg100221#msg100221
Follow us on Facebook: https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465

Sales & Info:
http://www.dianemo.co.uk

jonaspaulo

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Help needed in specific configuration
« Reply #11 on: March 30, 2010, 08:48:19 pm »
@sambuca thanks i am trying to code now the general control template to S2 and S3 switches (they are the same brand) , seeing the one for gc100 but it has code god knows what that does lol, but i am trying to do something by looking into it :/

@totallymaxed no, i mean the sensors themselves aren't connected directly to the switch via RJ45 socket but instead via SPI protocol, or CAN protocol, so i guess S1 doesn't need a DT and S2-S3 need as sambuca mentioned no?

posde

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3013
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Help needed in specific configuration
« Reply #12 on: March 31, 2010, 08:02:40 am »
jonaspaulo,

please clearify: The switches you talk about, are these network switches, where you can multiple PCs, network devices to, or are they boxes, which connect on one side to the network, and on the other side to sensors and devices?

i.e. is it something like this:
1 - http://en.wikipedia.org/wiki/Network_switch

or something like this:

2 - http://www.globalcache.com/products/gc-100/models1/



jonaspaulo

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Help needed in specific configuration
« Reply #13 on: March 31, 2010, 01:09:21 pm »
as i said they are all three normal network switches (http://en.wikipedia.org/wiki/Network_switch) running openwrt , but the uses are different :) the first one acts as a normal network switch and it allows me to just connect the other two. This other two, S2 and S3 connect to the "main" one and have connected via SPI or CAN some sensors. thanks

totallymaxed

  • LinuxMCE God
  • ****
  • Posts: 4458
  • Smart Home Consulting
    • View Profile
    • Dianemo - at home with technology
Re: Help needed in specific configuration
« Reply #14 on: March 31, 2010, 08:55:28 pm »
as i said they are all three normal network switches (http://en.wikipedia.org/wiki/Network_switch) running openwrt , but the uses are different :) the first one acts as a normal network switch and it allows me to just connect the other two. This other two, S2 and S3 connect to the "main" one and have connected via SPI or CAN some sensors. thanks

So what is the physical connection between the sensors and your S2 & S3 switches?
Andy Herron,
Convergent Home Technologies Ltd

Read My Blog; http://ellipticalcurve.com

Contact me for Smart Home consulting advice here;
@herron on Twitter, inquiries@ellipticalcurve.com via email or PM me here.

Get a Dianemo License: http://forum.linuxmce.org/index.php?topic=8880.msg100221#msg100221
Follow us on Facebook: https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465

Sales & Info:
http://www.dianemo.co.uk