Why are some entries green in my Items file

Why has the switch keyword gone green.

It happened when I added
,<[broker:stat/sonoff-12/power:state:default] to DownstairsToilet , but the syntax looks OK

Just found this error, but every example i have looked at seems to have the same amount of parameters , maybe i have been looking at it too long

Please paste your code into the postings and use code fences:

code goes here

It is really hard to review screen-shots, not to mention lines get cut off, and impossible to do so when reviewing from a phone’s screen.


in nano Switch Light Amy and Switch kitchenStrip are in Green , not purple and grey

Switch KitchenLEDS "Kitchen LEDs" <light> [ "Switchable" ] {mqtt=">[broker:cmnd/sonoff-8/power:command:OFF:0],>[broker:cmnd/sonoff-8/power:command:ON:1]"}
Switch KitchenLEDSFlash "Flash Kitchen LEDs" <light> [ "Switchable" ] {mqtt=">[broker:cmnd/sonoff-8/power:command:OFF:0],>[broker:cmnd/sonoff-8/power:command:ON:3]"}
Switch Magnifier "Garage Magnifier"   <light> [ "Switchable" ] {mqtt=">[broker:cmnd/sonoff-7/power:command:OFF:0],>[broker:cmnd/sonoff-7/power:command:ON:1]"}
Switch GarageTV "Garage TV" <soundvolume> [ "Switchable" ] {mqtt=">[broker:cmnd/sonoff-15/power:command:OFF:0],>[broker:cmnd/sonoff-15/power:command:ON:1]"}
Switch BedroomLightSteve "Steves Light"  <light> [ "Switchable" ]  {mqtt=">[broker:cmnd/sonoff-2/power:command:OFF:0],>[broker:cmnd/sonoff-2/power:command:ON:1]"}
Switch BedroomLightHelen  "Helens Light"  <light> [ "Switchable" ] {mqtt=">[broker:cmnd/sonoff-17/power:command:OFF:0],>[broker:cmnd/sonoff-17/power:command:ON:1]"}
Switch DownstairsToilet  "Downstairs Toilet"  <light> [ "Switchable" ] {mqtt=">[broker:cmnd/sonoff-12/power:command:OFF:0],>[broker:cmnd/sonoff-12/power:command:ON:1],<[broker:stat/sonoff-12/POWER:state:default]"}
Switch LightAmy "Amys Light" <light> [ "Switchable" ] {mqtt=">[broker:cmnd/sonoff-14/power:command:OFF:0],>[broker:cmnd/sonoff-14/power:command:ON:1]"}
Switch MKSonoffPowerStripChannel1 "Kitchen TV" <soundvolume> [ "Switchable" ] {mqtt=">[broker:MK-SmartHouse/utilities/MK-SonoffPowerStrip1:command:ON:C1ON],>[broker:MK-SmartHouse/utilities/MK-SonoffPowerStrip1:command:OFF:C1OFF]"}
Switch MKSonoffPowerStripChannel2 "Kitchen Lamp" <light> [ "Switchable" ] {mqtt=">[broker:MK-SmartHouse/utilities/MK-SonoffPowerStrip1:command:ON:C2ON],>[broker:MK-SmartHouse/utilities/MK-SonoffPowerStrip1:command:OFF:C2OFF]"}
Switch GarageLEDS  "Garage LEDs" <light> [ "Switchable" ]      {mqtt=">[broker:cmnd/sonoff-18/power:command:ON:1],>[broker:cmnd/sonoff-18/power:command:OFF:0],<[broker:stat/sonoff-18/power:state:default]"}
Switch KitchenStrip "Kitchen Strip Light" <light> [ "Switchable" ] {mqtt=">[broker:cmnd/sonoff-23/POWER1:command:OFF:0],>[broker:cmnd/sonoff-23/POWER1:command:ON:1]"}
Switch KitchenSpots "Kitchen Spot Lights" <light> [ "Switchable" ] {mqtt=">[broker:cmnd/sonoff-23/POWER2:command:OFF:0],>[broker:cmnd/sonoff-23/POWER2:command:ON:1]"}


Well, since Nano isn’t really OH Items file aware I’m not sure what conclusions one can draw for the color highlighting. Vscode with the openHAB extension would be much more capable in actually detecting and providing informative information about syntax errors. Even the old ESH Designer would be more useful in this context.

The fact that the color is changing in Nano implies there is a missmatched ",’, [, <, or the like. I don’t think it is smart enough to do anything more than that.

I have noticed if i take the < out it reverts to proper colours, I give VSCODE a try , can i presume it is sudo apt-get install vscode

You will probably want to add their repo so you get the latest versions. Then see



for how to install and configure the openHAB plug-in.

It’s because I had the wrong order for the icon colours in the .nanorc file.

The repo has been fixed, you can get the updated openhab.nanorc file from the repo

For openhabian, a simple:

sudo wget -O /usr/share/nano/openhab.nanorc https://raw.githubusercontent.com/airix1/openhabnano/master/openhab.nanorc

will fix it

1 Like