OH3, rules file not loaded

Hello,
being new on OH I’ struggling since days on the rules subject. Following I have done:
a) created two rules files using VS (testrule.rules & VitoViessmannDataV1.rules)
b) copied both files to /etc/openhab/rules

OH3.0.1 recognizes only the file “testrule.rules”.

Here are my two rule files.
testrule.rules

//test rule

rule "React on AC Power (FroniusSymoInverter_ACPower) change/update"
when
    Item FroniusSymoInverter_ACPower changed from 2809.0
then
    // your logic here
    logInfo("testrule", "changed value F_ACPower")
end

VitoViessmannDataV1.rules

// Updates heating related Items with data exposed by the vitoConnect/Viessmann-PHP API :
rule "GetViessmannData"
when
    Time cron "0 0/5 * * * ?" //called every five  minutes
    logInfo("GetViessmannData", "execute rule")
then
    var jsonVitoData = executeCommandLine("/etc/openhab/scripts/ViessmannGetJSON.php")
    logInfo("GetViessmannData", "php script executed")
    try {
        // Parse the output and post Updates :
	//OutsideTemperature.postUpdate(transformRaw("JsonPath", "$.OutsideTemperature", jsonVitoData)
	//OutsideTemperature.postUpdate(JsonPath.read(jsonVitoData, "$.OutsideTemperture")
	
	//BoilerTemperature.postUpdate(JsonPath.read(jsonVitoData, "$.isHeatingBurnerActive")
	//HeatingBurnerModulation.postUpdate(Heating, transformRaw("JSONPATH","$.HeatingBurnerModulation"))
	//evetns.postUpdate(HeatingBurnerModulation, transformRaw("JSONPATH","$.HeatingBurnerModulation"))

	//HeatingBurnerHours.postUpdate(JsonPath.read(jsonVitoData, "$.HeatingBurnerHours")
	//HeatingBurnerStarts.postUpdate(JsonPath.read(jsonVitoData, "$.HeatingBurnerStarts")
    //SupplyTemperature.postUpdate(JsonPath.read(jsonVitoData, "$.SupplyTemperature")
	//HotWaterStorageTemperature.postUpdate(JsonPath.read(jsonVitoData, "$.HotWaterStorageTemperature")
	//SolarSensorTemperatureCollector.postUpdate(JsonPath.read(jsonVitoData, "$.SolarSensorTemperatureCollector")
	//SolarSensorTemperatureHW.postUpdate(JsonPath.read(jsonVitoData, "$.SolarSensorTemperatureHW")
	//HotWaterTemperature.postUpdate(JsonPath.read(jsonVitoData, "$.HotWaterTemperature")
	//CirculationPumpStatusHK1.postUpdate(JsonPath.read(jsonVitoData, "$.CirculationPumpStatusHK1")
	//CirculationPumpStatusHK2.postUpdate(JsonPath.read(jsonVitoData, "$.CirculationPumpStatusHK2")
	//CirculationPumpStatusHK3.postUpdate(JsonPath.read(jsonVitoData, "$.CirculationPumpStatusHK3")
	//HWPumpsCirulation.postUpdate(JsonPath.read(jsonVitoData, "$.HWPumpsCirulation")
	//HWPumpsPrimary.postUpdate(JsonPath.read(jsonVitoData, "$.HWPumpsPrimary")

        logDebug("GetViessmannData","vitoconnet data updated !")
    }  catch(TransformationException e) {
        logError("GetViessmannData", "Unable to extract valid data from script result : " + e.getMessage)
    }
end

I would highly appreciate any hints and any good question to think about.

Bernhard

I would expect that the second rule must raise an error message in the logfile as the logInfo statement is not allowed between when and then.

1 Like

Removing the “logInfo”-statment between when - then resolved the issue.
Thanks for this great hint.
Bernhard

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.