Giter Club home page Giter Club logo

Comments (8)

calimero-project avatar calimero-project commented on June 12, 2024

from calimero-core.

JourdanM avatar JourdanM commented on June 12, 2024

Hello,

I tried it and it worked fine but is it possible to get the value instead of the ASDU ? How can I convert it ?

Thanks a lot

from calimero-core.

calimero-project avatar calimero-project commented on June 12, 2024

Use a DPT translator from package tuwien.auto.calimero.dptxlator, you probably need DPTXlator2ByteFloat with the datapoint type (DPT) 9.001.

from calimero-core.

JourdanM avatar JourdanM commented on June 12, 2024

Okay I checked this class.
But my monitor class give me multiple different type of DPT, temperature, boolean etc.
How can I manage it ?

from calimero-core.

JourdanM avatar JourdanM commented on June 12, 2024

Do you have an example of translating from ASDU to DTP ?

from calimero-core.

calimero-project avatar calimero-project commented on June 12, 2024

Calimero cannot know the exact DPTs you want in your setup. Either, you distinguish based on the datapoint group address, and create the desired translator. Or, you configure your datapoints up front to automate translation, like this:

DatapointModel<StateDP> datapoints = new DatapointMap<>();
datapoints.add(new StateDP(..., "my temp", 0, DPTXlator2ByteFloat.DPT_TEMPERATURE.getID()));
// add your other datapoints
...
// now, you can request a translator for a specific datapoint
TranslatorTypes.createTranslator(0, datapoints.get(...).getDPT());

from calimero-core.

JourdanM avatar JourdanM commented on June 12, 2024

I tried something like this :

` private void print(final String svc, final ProcessEvent e) throws KNXFormatException
{
DatapointModel datapoints = new DatapointMap<>();

	try {
		datapoints.add(new StateDP(new GroupAddress("1/1/3"), "my temp", 0, DPTXlator2ByteFloat.DPT_TEMPERATURE.getID()));
		System.out.println(LocalTime.now() + " " + e.getSourceAddr() + "->" + e.getDestination() + " " + svc + ": "
				+ e.getASDU());

		System.out.println(TranslatorTypes.createTranslator(0, datapoints.get(new GroupAddress("1/1/3")).getDPT()));
		
	}
	catch (final RuntimeException ex) {
		System.err.println(ex);
	} catch (KNXException e1) {
		// TODO Auto-generated catch block
		e1.printStackTrace();
	}
}`

The result is this :

09:39:51.733 1.1.9->1/1/3 write.ind: [B@2c8e27f7
DPT 9.001 [0.0 °C]

So I'm able to get the correct datapoint but the value is still 0.0.
Am I doing something wrong to print my values ?

Thanks a lot for the help

from calimero-core.

calimero-project avatar calimero-project commented on June 12, 2024

You forgot to set the actual knx data you want to translate to a java type:

DPTXlator t = TranslatorTypes.createTranslator(...);
t.setData(e.getASDU());
System.out.println(t);

from calimero-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.