Rule item Invertermode changed from Battery (Solar) to Utility (Grid)

Please I need help on creating a rule for the below, I am sure I am missing something simple as all my other rules work fine but this one item crashes the notifications.rule file I have until I remove it

2020-02-24 13:21:10.202 [vent.ItemStateChangedEvent] - Invertermode changed from Battery (Solar) to Utility (Grid)

rule is as follows

rule “notify grid on”
when
Item Invertermode changed from Battery (Solar) to Utility (Grid)
then
sendBroadcastNotification(“Grid ON”)
end

Could you please post your items.

At the first glance the “from Battery (Solar)” looks a little bit uncommen. If intervertermode is a String then the value Battery (Solar) and Utility (Grid) should have some "

Hi here is the item for this

String Invertermode “InverterMode [%s]” (Power)
{ mqtt="<[broker:Inverter/InverterMode:state:default]" }

If if the item is themn a string your rule should be looking like this (untested)

rule “notify grid on”
when
Item Invertermode changed from "Battery (Solar)" to "Utility (Grid)"
then
sendBroadcastNotification(“Grid ON”)
end

Hi Dibbler42

I have tried that before and then I get this in the log file

2020-02-26 14:08:47.698 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘notifications.rules’ has errors, therefore ignoring it: [309,6]: no viable alternative at input ‘�’

You need to be careful about quote marks.
For example,

The first type here in rule line are the wrong kind for rules files.
Those in the when line are okay

Hi Dibbler not sure I understand

Can you post your version of the rule you don’t understand - in code fences, please.