lifeemotions / knx.net

KNX.net provides a KNX API for .NET
MIT License
101 stars 47 forks source link

Get status #54

Closed Pikkufighter closed 5 years ago

Pikkufighter commented 5 years ago

Godday

I've been using this since it's by far the simplest KNX library to get your head around. Though I wonder if there is possible to get the status from a group address and save it in a bool. I would like to change a few visual stuff depending on if the bus is active or not.

I've tried calling functions or setting variables from Event/Status but that does not work.

any help would be appriciated.

Edit: "Although you can implement a wrapper function that would lock until the value expected is received" Found this comment in a closed thread but I can't seem to make such a function. and I'm unsure of what I'm missing.

A call like this: string state = connection.RequestStatus(address); Is what I would like to end up with

FalcoGer commented 5 years ago

You can request the status of a device with connection.RequestStatus(address); This will prompt a status message to be sent over the knx bus by all devices in the group if they support that feature that will in turn fire the status delegate. However this only works with certain devices. What I do is I use the event/status delegates. I have an object for each GA that I want to monitor and set the timestamp and data for it when the delegate fires, as well as write those things to a database for graphical display later.

Pikkufighter commented 5 years ago

That worked, thanks! unfortunately I don't have access to the code anymore since the work ended a few months ago and I forgot to post here. my bad