Skip to main content



      Home
Home » Archived » Eclipse SmartHome » Default value for channels(How to set the value of a channel)
Default value for channels [message #1777198] Sun, 26 November 2017 18:27 Go to next message
Eclipse UserFriend
Hello,

I'm writing the implementation of my te923 weather station.

To update one channel, I do:
updateState(new ChannelUID(getThing().getUID(), c.getMappingName()),
new DecimalType(d[c.getPositionInResponse()]));

One of my issue is that data may not come directly to the weather station.

If the data is not available yet, I don't call updateState for this channel. As an example one of my temperature sensor may not send some data (due to intermittent connectivity issues).

My issue is on the control tab.

By default, the value is set to 0.

Example
Temperature Internal Channel: 21.4 °C
Humidity Internal Channel: 51 %
Temperature Channel 1: 0.0 °C
Humidity Channel 1: 0 %

I'm expecting something like
Temperature Internal Channel: 21.4 °C
Humidity Internal Channel: 51 %
Temperature Channel 1: - (Not available yet)
Humidity Channel 1: - (Not available yet)

If I try to set
updateState(new ChannelUID(getThing().getUID(), c.getMappingName()),
new DecimalType(Double.NaN));
I get the following error : Character N is neither a decimal digit number, decimal point, nor "e" notation exponential mark. (probably the first letter of NaN)

Do I do something wrong? Could I notify openHab or smarthome that my data is not (yet) available for a specific channel?

[Updated on: Mon, 27 November 2017 02:40] by Moderator

Re: Default value for channels [message #1777234 is a reply to message #1777198] Mon, 27 November 2017 05:29 Go to previous messageGo to next message
Eclipse UserFriend
It may be an inconstancy in the PaperUI ui.

If I do a "F5" (refresh browser) I get

https://i.imgur.com/IOw9ekr.png

If I "click" on the "control" menu, I get

https://i.imgur.com/3ni9jxP.png

[Updated on: Mon, 27 November 2017 05:32] by Moderator

Re: Default value for channels [message #1777865 is a reply to message #1777234] Tue, 05 December 2017 08:12 Go to previous message
Eclipse UserFriend
Hi Gabriel,

By default, if a binding hasn't send any state update, the UI should simply show a "-" as a value and the item state is NULL.

> By default, the value is set to 0.

Could you analyse why this is the case? I assume that you unknowingly set this through your binding as the framework doesn't do it for sure.

Regards,
Kai
Previous Topic:Support for Channels in DiscoveryResultBuilder and/or DiscoveryResult
Next Topic:USB and Binding
Goto Forum:
  


Current Time: Sun May 18 17:07:15 EDT 2025

Powered by FUDForum. Page generated in 0.02853 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top