Hey All,
I raised OH5 Snapshots - Rules reporting error · Issue #4813 · openhab/openhab-core · GitHub but also posting here to see if anyone has any ideas.
I’ve tried both OH5 milestones and the latest snapshots, and all have problems with rules which contain rulesDSL code (Yes, I should migrate this code to something else, but what I have works with OH 4.x)
The error is:
2025-05-15 18:53:44.111 [ERROR] [e.automation.internal.RuleEngineImpl] - Failed to execute rule 'af4c760780': Failed to execute action: 7(Cannot invoke "com.google.inject.Injector.getInstance(java.lang.Class)" because the return value of "org.openhab.core.model.script.ScriptStandaloneSetup.getInjector()" is null) ```
Action: 7 code is:
actions:
-
inputs: {}
id: “7”
configuration:
type: application/vnd.openhab.dsl.rule
script: >
var Number requiredSolar = ((TeslaPowerwall_InstanteousHomePower.state
as Number)+(1 - (TeslaPowerwall_BatterySOE.state as
Number))20000)/5000100;if (requiredSolar > 100) requiredSolar = 100; if (EVChargingGroup.state == ON) requiredSolar = 100; if (NegativeFIT.state == OFF) requiredSolar = 100; if (NegativeGrid.state == ON) requiredSolar = 1; logInfo("curtailSolar", "required solar percent = {}, Current Inverter limit = {}", requiredSolar.intValue, SolarEdge__Modbus_Data__Active_Power_Limit__61441_Value_as_Number.state); if ((SolarEdge__Modbus_Data__Active_Power_Limit__61441_Value_as_Number.state as Number) != requiredSolar.intValue) { SolarEdge__Modbus_Data__Advanced_Power_Enable__61762_Value_as_Number.sendCommand(1); if ((TeslaPowerwall_BatterySOE.state as Number) > 0.97) { logInfo("curtailSolar", "current PW2 charge ({}) > 97%, curtail output",(TeslaPowerwall_BatterySOE.state)); SolarEdge__Modbus_Data__Active_Power_Limit__61441_Value_as_Number.sendCommand(requiredSolar.intValue); DaikinAirbaseACUnit_Zone4.sendCommand(ON); } else { logInfo("curtailSolar", "current PW2 charge ({}) < 97%, set full rate production",(TeslaPowerwall_BatterySOE.state)); SolarEdge__Modbus_Data__Active_Power_Limit__61441_Value_as_Number.sendCommand(100); } SolarEdge__Modbus_Data__Commit_Power_Control__61696_Value_as_Number.sendCommand(1); } else { logInfo("curtailSolar", "required solar matches current inverter limit, no change required."); }
type: script.ScriptAction
Any ideas what the error is telling me and what has changed between OH4 and OH5 to trigger this?