Issue of the topic:
When reading DS18B20 Temperature sensors with Onewire (OWFS), the sensors return Celciuis readings. I would like to display their readings in Fahrenheit, if possible. I can read them in Fahrenheit but my rules don’t work properly. (The items listed below are configured for reading them in Fahrenheit.)
I have my locale in raspi-config set to EN_US.UTF-8 UTF-8.
What am I missing? Thanks!
Please post configurations (if applicable):
Items configuration related to the issue
// This is the items file
//Relays
Switch GPIO_LAMP "Pump Relay" { gpio="pin:18 force:yes" }
//OneWire
//Temperature sensor
Number.Temperature SP "Solar Panel [%.1f °F]" <temperature> { channel="onewire:basic:7da51992:SP:temperature" }
Number.Temperature HWT "Hot Water Temp [%.1f °F]" <temperature> { channel="onewire:basic:7da51992:HWT:temperature" }
Number.Temperature OT "Outside Temp [%.1f °F]" <temperature> { channel="onewire:basic:7da51992:OT:temperature" }
Sitemap configuration related to the issue
sitemap home label="Gill's Guide Control Center"
{
Frame label="Solar Panel UI"
{
// Switch item=channel1
Text item=SP
Text item=HWT
Text item=OT
Switch item=GPIO_LAMP
}
}
Rules code related to the issue
rule "Solar Panel Charged And Ready / Pump On"
when
Item SP changed
then
var SP_Temp = SP.state as Number
var HWT_Temp = HWT.state as Number
if (SP_Temp > (HWT_Temp + 10)) {
GPIO_LAMP.sendCommand(ON)}
else if (SP_Temp < 33)
GPIO_LAMP.sendCommand(OFF)
}End if
I picked at it again some tonight. I have gotten it further!
Below is the latest home.rules file I have. I’ll post the log file after that. I can’t figure out why it’s busting…
rule "Solar Panel Charged And Ready / Pump On"
when
Item SP changed
then
var SP_Temp = (SP.state as QuanityType<Number>).intValue
var HWT_Temp = (HWT.state as QuantityType<Number>).intValue
if (SP_Temp > (HWT_Temp + 10))
GPIO_LAMP.sendCommand(ON)
else if (SP_Temp < 33)
GPIO_LAMP.sendCommand(OFF)
end
Here is the openhab.log file…
2019-03-05 22:35:52.302 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Solar Panel Charged And Ready / Pump On': Could not cast 83.075 °F to void; line 5, column 18, length 31
What I’d really like to have it check is more like an OR statement. But this is working for now. Now it’s time to figure the rest of my solar panel project out. Seems as though the software end seems to be working.
Thanks again!
For those looking – Here is the final code. Cheers!
rule "Solar Panel Charged And Ready / Pump On"
when
Item SP changed
then
var SP_Temp = (SP.state as Number)
var HWT_Temp = (HWT.state as Number)
if (SP_Temp > (HWT_Temp + 10))
GPIO_LAMP.sendCommand(ON)
else if (SP_Temp < HWT_Temp)
GPIO_LAMP.sendCommand(OFF)
else if(SP_Temp < 33)
GPIO_LAMP.sendCommand(OFF)
end```