Barometer plugin, can I do it this way?

Hello

I’m hoping for some pointers for coding a barometer plugin.

I have a serialattached barometer that I can read thru my pc’s com port by sending some simple commands.

I have previosly managed to alter the somfy plugin to control a simple relay board that is also serially attached, so I have gained some (very little) understanding of LUA, but now I want to try to make a plugin for this serial attached barometer.

I have manually created a barometer device in vera3lite by pointing to the file D_BarometerSensor1.xml that came with the RFXcom plugin ( ithink)

Now I wonder, is it all possible to just create a device like this and then use some code to read from the serialport and update the barometer device, or is this device ‘married’ into the RFXCom plugin in such a way that this is not possible?

Here is a snippet of the code I’m trying to use to set the pressure on the newly created device.

  <serviceId>urn:upnp-org:serviceId:BarometerSensor1</serviceId>
        <name>SetTarget</name>
       
       <run>
  		luup.variable_set("urn:upnp-org:serviceId:BarometerSensor1", "CurrentPressure", {newTargetValue = "1000"}, lul_device)
      </run>
</action>

What happens is that I cannot get any values to show in the device tab.

Also, do I need to create a new parent device for the baromenter device, or can it be ‘on its own’?

The first picture is my ‘dummy’ parent device, the second is the barometer device I would like to update with data from the serialport.

Hope anyone can understand any of my ramblings :slight_smile:

TommyE

You will need to start here:

[url=http://wiki.micasaverde.com/index.php/Luup_Plugins_ByHand]http://wiki.micasaverde.com/index.php/Luup_Plugins_ByHand[/url]

Then there is a lot of other reading on the Wiki and looking at the implementation of other plugins to master the art. I have written quite a few plugins and I am still learning!

Try to start with a plugin that is similar to what you are doing … install it on your Vera … then look at all the files and then read about what each of the pieces in the file is about and used for.

This will give you an index of other development topics on the Wiki:
[url=http://wiki.micasaverde.com/index.php/Category:Development]http://wiki.micasaverde.com/index.php/Category:Development[/url]

[quote=“RichardTSchaefer, post:2, topic:174035”]You will need to start here:

[url=http://wiki.micasaverde.com/index.php/Luup_Plugins_ByHand]http://wiki.micasaverde.com/index.php/Luup_Plugins_ByHand[/url]

Then there is a lot of other reading on the Wiki and looking at the implementation of other plugins to master the art. I have written quite a few plugins and I am still learning!

Try to start with a plugin that is similar to what you are doing … install it on your Vera … then look at all the files and then read about what each of the pieces in the file is about and used for.

This will give you an index of other development topics on the Wiki:
[url=http://wiki.micasaverde.com/index.php/Category:Development]http://wiki.micasaverde.com/index.php/Category:Development[/url][/quote]

Thanks for the pointers, I was aware of one of them, and I I have now read thru it more thorougly and I feel I understand abir more now.

Hope I’ll manage to get a barometer for my device up and running :slight_smile:

TommyE