<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Set present value to int of hex values]]></title><description><![CDATA[<p dir="auto">Hi, I have this code:</p>
<pre><code>systemStatus1 = new BACnetObject(localDevice, localDevice.getNextInstanceObjectIdentifier(ObjectType.analogInput));
systemStatus1.setProperty(PropertyIdentifier.objectName, new CharacterString("System status group 1"));
systemStatus1.setProperty(PropertyIdentifier.units, EngineeringUnits.noUnits);
systemStatus1.setProperty(PropertyIdentifier.presentValue, new Real(65535));
localDevice.addObject(systemStatus1);
</code></pre>
<p dir="auto">As you can see, I'm inserting a <code>Real</code> with value 65535, which gets translated into 65535.00.<br />
Is there a way to set a integer value? I've tried with UnsignedInteger<br />
but I get<br />
com.serotonin.bacnet4j.exception.BACnetServiceException: class=Property, code=Invalid data type, message=expected class com.serotonin.bacnet4j.type.primitive.Real, received=class com.serotonin.bacnet4j.type.primitive.UnsignedInteger</p>
<p dir="auto">Thanks</p>
]]></description><link>https://forum.mango-os.com/topic/2787/set-present-value-to-int-of-hex-values</link><generator>RSS for Node</generator><lastBuildDate>Wed, 20 May 2026 12:39:52 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/2787.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 29 May 2017 15:27:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Set present value to int of hex values on Tue, 30 May 2017 15:12:49 GMT]]></title><description><![CDATA[<p dir="auto">Hi Michele,</p>
<p dir="auto">I am not an expect on the BACnet4J code, but I do try to dabble and help people a little when I can. But,</p>
<p dir="auto">I think you cannot have an UnsignedInteger for a object with the type of AnalogInput. Looking in <a href="https://github.com/infiniteautomation/BACnet4J/blob/952136ecaf9c74541b7bfc1994f4e7f64d3a9160/src/main/java/com/serotonin/bacnet4j/obj/ObjectProperties.java" rel="nofollow ugc">ObjectProperties</a> suggests the following support a presentValue property set to the UnsignedInteger type:</p>
<pre><code>ObjectType.
accumulator
command
multiStateInput
multiStateOutput
multiStateValue
positiveIntegerValue
</code></pre>
<p dir="auto">So it sounds to me like you may be looking for,</p>
<pre><code>systemStatus1 = new BACnetObject(localDevice, localDevice.getNextInstanceObjectIdentifier(ObjectType.positiveIntegerValue));
systemStatus1.setProperty(PropertyIdentifier.objectName, new CharacterString("System status group 1"));
systemStatus1.setProperty(PropertyIdentifier.units, EngineeringUnits.noUnits);
systemStatus1.setProperty(PropertyIdentifier.presentValue, new UnsignedInteger(65535));
localDevice.addObject(systemStatus1);
</code></pre>
]]></description><link>https://forum.mango-os.com/post/14555</link><guid isPermaLink="true">https://forum.mango-os.com/post/14555</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Tue, 30 May 2017 15:12:49 GMT</pubDate></item></channel></rss>