Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse SmartHome » Default value for channels(How to set the value of a channel)
Default value for channels [message #1777198] Sun, 26 November 2017 23:27 Go to next message
Gabriel Klein is currently offline Gabriel KleinFriend
Messages: 5
Registered: November 2017
Junior Member
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 07:40]

Report message to a moderator

Re: Default value for channels [message #1777234 is a reply to message #1777198] Mon, 27 November 2017 10:29 Go to previous messageGo to next message
Gabriel Klein is currently offline Gabriel KleinFriend
Messages: 5
Registered: November 2017
Junior Member
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 10:32]

Report message to a moderator

Re: Default value for channels [message #1777865 is a reply to message #1777234] Tue, 05 December 2017 13:12 Go to previous message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 648
Registered: December 2011
Senior Member
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: Wed Jun 20 05:41:13 GMT 2018

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

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

Back to the top