Comments (4)
This is an updated example:
import java.net.InetSocketAddress;
import tuwien.auto.calimero.GroupAddress;
import tuwien.auto.calimero.KNXException;
import tuwien.auto.calimero.link.KNXNetworkLink;
import tuwien.auto.calimero.link.KNXNetworkLinkIP;
import tuwien.auto.calimero.link.medium.TPSettings;
import tuwien.auto.calimero.process.ProcessCommunicator;
import tuwien.auto.calimero.process.ProcessCommunicatorImpl;
/**
* Example of Calimero process communication, we read and write a boolean datapoint in the KNX network. By default, this
* example will not change any datapoint value in the network.
*/
public class ProcessCommunication
{
// Address of your KNXnet/IP server. Replace the IP host or address as necessary.
private static final String remoteHost = "myKnxServer.myHome.com";
/**
* We will read a boolean from this KNX datapoint group address, replace the address string with one of yours. Make
* sure this datapoint exists, otherwise you will get a read timeout!
*/
private static final String group = "1/1/1";
public static void main(final String[] args)
{
// Create our network link, and pass it to a process communicator
try (KNXNetworkLink knxLink = KNXNetworkLinkIP.newTunnelingLink(null, new InetSocketAddress(remoteHost, 3671), false, TPSettings.TP1);
ProcessCommunicator pc = new ProcessCommunicatorImpl(knxLink)) {
System.out.println("read a boolean from datapoint " + group);
// this is a blocking method to read a boolean from a KNX datapoint
final boolean value = pc.readBool(new GroupAddress(group));
System.out.println("datapoint " + group + " value: " + value);
// Uncomment the next line, if you want to write back the same value to the KNX network
// pc.write(group, value);
}
catch (KNXException | InterruptedException e) {
System.out.println("Error reading KNX datapoint: " + e.getMessage());
}
}
}
from calimero-core.
Thanks a lot, it works fine, I'm now able to collect data from differents groups !
When I tried do run my app from the school (directly connected by Wi-Fi on the network), I have a timeout, impossible to connect to the group.
But when I tried from home (connected by VPN), it works fine.
Do you have an idea why ?
from calimero-core.
The example probably defaults to the wrong local IP address.
In the method call newTunnelingLink(null, ...
, replace the null with new InetSocketAddress("my.local.ip.address", 0)
, and insert your local IP address of the wifi network.
from calimero-core.
Works well :)
Thank you very much for the help !
from calimero-core.
Related Issues (20)
- Does not work with tpuart ic HOT 24
- [Feature Request] Add support for security proxy
- Datapoint type discovery HOT 1
- DPT8 missing in README.md HOT 1
- Mangamementclient no basic restart anymore with v2.5? HOT 3
- [Feature Request] "protected" for some fields and methods of ManagementClientImpl HOT 6
- Warnings from Calimero HOT 13
- Receiving a GroupValueResponse with DPT 1.001 fails due to missing data in the asdu HOT 2
- DPT 251.600 format should be consistent across platforms and locales HOT 3
- readBool maxASDULen should be ‘1’ ?,now is ‘0’ HOT 1
- Android project runtime FATAL EXCEPTION. HOT 5
- GO Diagnostics: Improve selection of surrogate HOT 10
- DPT 10.001 is wrongly parsed when "no day" is present HOT 2
- Throws Exception when EventListener catch one HOT 2
- KNXNetworkLinkFT12: detect status, CEMI setting.... HOT 2
- Implement Transport Layer Connection-Oriented State Machine Style 3 HOT 2
- Throws `KNXTimeoutException` due to missing confirmation although the confirmation was received HOT 2
- Calimero GUI and KNX Virtual HOT 2
- Data Secure - Read Group Request management HOT 2
- Not able to connect to KNX USB RF module HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from calimero-core.