[SOLVED] Rule to apply an offset to get an accurate temp reading

hey guys. I’m trying to use the hue motion sensors temperature sensor but they ant accurate at all I’ve got one that’s 3 degrees c out so im trying make a rule that will add or subtract and post the correct temp to a dummy item.

what ive got so far.
Items


Switch 			Lounge_Motion  			"Lounge Motion Sensor"     	(gMotion)     						{channel="hue:0107:00178829a0c5:44:presence"}
Number:Temperature  	Lounge_Hue_Temp 		"Temperature [%.1f °C]" 	<temperature>						{channel="hue:0302:00178829a0c5:43:temperature"}
Number:Temperature  	Lounge_Hue_Temp_Offset 		"Temperature [%.1f °C]" 							




Switch 			Rileys_Motion 			"Rileys Room Motion Sensor"     (gMotion)     						{channel="hue:0107:00178829a0c5:38:presence"}
Number:Temperature  	Rileys_Hue_Temp 		"Temperature [%.1f °C]" 	<temperature>						{channel="hue:0302:00178829a0c5:37:temperature"}
Number:Temperature  	Rileys_Hue_Temp_Offset 		"Temperature [%.1f °C]" 	<temperature>						

rule

rule "temperature update Lounge"
when
    	Item Lounge_Hue_Temp changed or
	Item Temp_Test changed
then
        Lounge_Hue_Temp_Offset.sendCommand(Lounge_Hue_Temp.state + 10|"°C")

end



rule "temperature update Rileys Room"
when
    	Item Rileys_Hue_Temp changed or
	Item Temp_Test changed
then
        Rileys_Hue_Temp_Offset.sendCommand(Rileys_Hue_Temp.state + 10|"°C")
end

error in the log

2018-12-27 22:26:46.448 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'Test.rules'
2018-12-27 22:26:48.467 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'Test.rules'
2018-12-27 22:26:55.941 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'temperature update Lounge': An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_plus(java.lang.Object,java.lang.String) on instance: null
2018-12-27 22:26:55.941 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'temperature update Rileys Room': An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_plus(java.lang.Object,java.lang.String) on instance: null
2018-12-27 22:26:56.158 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'temperature update Lounge': An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_plus(java.lang.Object,java.lang.String) on instance: null
2018-12-27 22:26:56.158 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'temperature update Rileys Room': An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_plus(java.lang.Object,java.lang.String) on instance: null

Use a profile:
See:


Number:Temperature  	Lounge_Hue_Temp 		"Temperature [%.1f °C]" 	<temperature>						{ channel="hue:0302:00178829a0c5:43:temperature" [profile="offset", offset="10"] }

No rules and proxy item needed!!

6 Likes

wow thats awesome and super easy!

You’re welcome,
Please mark the thread as solved, thanks

Please tick the solution mark under the relevant post, thanks

@joedirt as mentioned above please mark the post by @vzorglub (second post in this topic) as the solution.

Example:
image

I have edited your title to reflect solved.

In the forum we try our best to make finding a solution as quick and easy as possible.:wink: Clicking the square box, on the appropriate post, and editing the title is one way to help accomplish this.

Thank you for your help with this.