Smarteon / loxone-java

Java implementation of the Loxone™ communication protocol (Web Socket)
BSD 3-Clause "New" or "Revised" License
15 stars 10 forks source link

[Documentation] How to send analog value? #209

Closed xavan83 closed 10 months ago

xavan83 commented 10 months ago

The documentation and example only mention sending pulse/on/off value to a control. How to send other kind of value like temperature, percentage,etc.

knotekt commented 10 months ago

Hi, you cant send values directly into any control. Pulse/on/off are examples of commands that a control supports. Some controls may supports commands that help you send values to them, you can find all supported command here. To be able to send any value to any block, you should create a Virtual text input (TextInput in the structure file), connect it to the desired input on a block and send values to the input.

xavan83 commented 10 months ago

This is what I do on the Loxone side but on the java side I only see this example (EXTRACT_HUMIDITY is the name of my Loxone control): Control ctrl = loxone.app().getControl("EXTRACT_HUMIDITY",Control.class); loxone.sendControlOn(ctrl);

Instead of sendControlOn I am looking for a method like sendControlValue(ctrl, "60%");

jimirocks commented 10 months ago

Hi thanks for reaching us, can you tell what kind of block it is in Loxone config, or possibly share the relevant part of the Loxone APP json? The library currently supports limited amount of controls. That's why there is such method you desire. This could result in extending the library or some workaround (depending on your use case)

xavan83 commented 10 months ago

I want to read my ventilation system data (temperature, humidity, speed, watt) for display so it can be text data. I don't know yet if some of these data will need to be converted to analog data type.

On the Loxone side I can select any kind of control (dimmer, virtual input,switch,...).

I already made "simple http get request" to get the value of KNX/EIB sensor like this http://loxoneurl/dev/sps/io/BOILER_TEMPERATURE_OUTPUT or http://loxoneurl/dev/sps/io/TAPO_POWER_FRIDGE/1234 (to set it)

jimirocks commented 10 months ago

so if I understand it well you can just leverage LoxoneHttp.get ? In that case I would close this issue...

xavan83 commented 10 months ago

I already made a java program to read and put some data from my loxone server. I am using Apache httpclient to made requests like the one I mention. I found your lib and I want to use websocket to avoid pooling the server to check the change of some data and to push some statistic data efficiently. I don't know what you mean by "LoxoneHttp.get"

jimirocks commented 10 months ago

Well in this library you can use websockets to listen and http for simple command like you need, check here: https://github.com/Smarteon/loxone-java/blob/master/src/main/java/cz/smarteon/loxone/LoxoneHttp.java#L54

also you can always make your instance of Command

However as you found the solution, closing the issue