My Livingroom Thermostat wil set to 100/10+5=15 degrees C, and it will return a json-file containing info from the boiler. This works. I do not intend to do anything with the returned file yet. But I have been trying to do this from a rule all week. I hoped to finally get something done without your help, but I need your input again.
This is my rule:
rule "Update Livingroom Thermostat real setpoint"
when
Item WK_SP_virtual changed
then
// construct setpoint for setting thermostat
val Twish = WK_SP_virtual.state as Number
val setp = (Twish - 5 ) * 10
logInfo("Update Thermostat", setp)
sendHttpGetRequest("http://192.168.0.6/data.json?heater=0&setpoint="+setp+"&thermostat=0%C3%97")
logInfo("Update Thermostat", "new setpoint sent" )
end
When changing the item ‘WK_SP_virtual’ I never get any logging. Not even from the calculation of the setpoint. When I comment out the logging, the thermostat does not get updated. What am I doing wrong?
UPDATE: I do not get any logging from the rule I meant. Of course the item change is logged:
2018-02-04 22:43:33.086 [ome.event.ItemCommandEvent] - Item 'T_WK_SP_virtual' received command 15.0
2018-02-04 22:43:33.102 [vent.ItemStateChangedEvent] - T_WK_SP_virtual changed from 14.0 to 15.0
I probably don’t get your point. But I can explain this: I have item ‘WK_SP_real’ that is updated by the real thermostat info that I get through the http-binding in another rule. This works well and shows me the changes one does at the real thermostat.
I also have item ‘WK_SP_virtual’ that I try to use here to set the thermostat from the sitemap.
In the end I would like both rules to act on the same item ‘WK_SP’. But for debugging reasons I decided to do that later and now focus on setting and receiving in seperate items and separte rules.
@namraccr is pointing out the following:
In your rule, the item name is: WK_SP_virtual
In your log, the item name is: T_WK_SP_virtual
maybe your are missing the T_ part in your rule? (you can post your .items)
OMG if it is that simple I really waisted a week doing nothing. So glad you guys spot that. I will check and repair as soon as I get home this evening.
If this is it, this leaves me with the delemma whether I should post my problems sooner, so you can correct what I keep missing, or later so I don’t bother you with these small details!
Anyway: thanks for your input!
I am using VS, but it didn’t. And I am very sure I do not have an item difined called WK_SP_virtual. VS only starts complaining when I take away the ‘WK’.
Anyway, I still cannot set the temperature of the thermostat. But fortunately now I do get an error in the log file:
==> /var/log/openhab2/openhab.log <==
2018-02-05 22:11:32.398 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Update Livingroom Thermostat real setpoint': An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.LogAction.logInfo(java.lang.String,java.lang.String,java.lang.Object[]) on instance: null
That is a very long method-name! What is instance null?
That is the last bit I needed to get this working! The item was incorrect as @namracrr immediately saw, and the ‘.toString’ should have been there. I am positive I would never have found this, so I will be posting my problems a bit earlier I think. At least untill I get more experienced with programming. Thank you for being patient!
I already tried combining the two action of setting and receiving thermosat setpoint in one setpint, but openhab gets set to the old temperature sooner than the thermostat gets set to the new. I thought a postUpdate of the thermostat data to the OH-setpoint would prevent that, but no. So I will pull the thermostat data less frequently and maybe built in a wait period to except new values after changing the setpoint from openhab. Or do you think there is a smarter way of preventing a too early feed back from the thermostat?