Accessing service sensor readings using C# wrapper

  • 47 Views
  • Last Post 25 July 2013
Frankgr posted this 25 July 2013

Hi Ryan,

I'm trying to write a personalized HA application in C# that integrates my IR devices, some custom RF hardware I built, and Z-Wave. I found your Github managed wrapper (thanks!) and got all my setxxx functions working, but I don't see (or can't figure out) any methods for accessing sensor readings. Specifically I'd just like to request my CT100 thermostat room temperature readings. How would one do that with the wrapper? I assume there would be a data request that results in an asynchronous callback, kind of like with serial ports(?)

Also, is there any way to run the service without the GUI so that just my personalized GUI is running at the user level?

Thanks,
Frank

Ryan-Scott posted this 25 July 2013

Hi Ryan,

I'm trying to write a personalized HA application in C# that integrates my IR devices, some custom RF hardware I built, and Z-Wave. I found your Github managed wrapper (thanks!) and got all my setxxx functions working, but I don't see (or can't figure out) any methods for accessing sensor readings. Specifically I'd just like to request my CT100 thermostat room temperature readings. How would one do that with the wrapper? I assume there would be a data request that results in an asynchronous callback, kind of like with serial ports(?)

Also, is there any way to run the service without the GUI so that just my personalized GUI is running at the user level?

Thanks,
Frank


Hi Frank -

Nice to see you around these parts.

You should be able to access those readings using the getDevice method. It's not async though; if you want a model like that, I'm creating a real-time library that provides a websocket connection.

Here's some sample code to get you started:


var device = service.getDevice("password", "123123");

// the sr collection contains all the sensor readings for a device
foreach(var reading in device.sr) {
var label = reading.label;
var name = reading.name;
var value = reading.value;
}


By the way, I'd love to hear about your project sometime. Drop me a PM and tell me about it if you are feeling up to it.

Close