OpenHAB setup help with text-based configuration


#1

Speaking of Text config: this is throwing an error: Unable to import openhab config; any ideas why? Thanks

{
“dashboards”: {
“home”: {
“columns”: 8,
“rows”: 6,
“pages”: [
{
“label”: “Lights”,
“icon”: “home”,
“widgets”: [
{
“type”: “switch”,
“position”: “0-0,1-1”,
“properties”: {
“label”: “All Lights”,
“icon”: “light”,
“state”: {
“binding”: “House Lights”
},
“reverse”: false
}
}
]
},
{
“label”: “Page #2”,
“icon”: “number-2”,
“widgets”: []
},
{
“label”: “Page #3”,
“icon”: “number-3”,
“widgets”: []
},
{
“label”: “Page #4”,
“icon”: “number-4”,
“widgets”: []
},
{
“label”: “Page #5”,
“icon”: “number-5”,
“widgets”: []
}
]
}
}
}


New Rotini - Confused vs Legacy
New Rotini - Confused vs Legacy
#2

@milty456 double quotes for all strings in JSON should be " characters, some editors replace it with and instead, which what seems like to be the case here.

Try this one:

{
  "dashboards": {
    "home": {
      "columns": 8,
      "rows": 6,
      "pages": [
        {
          "label": "Lights",
          "icon": "home",
          "widgets": [
            {
              "type": "switch",
              "position": "0-0,1-1",
              "properties": {
                "label": "All Lights",
                "icon": "light",
                "state": {
                  "binding": "House Lights"
                },
                "reverse": false
              }
            }
          ]
        },
        {
          "label": "Page #2",
          "icon": "number-2",
          "widgets": [
            
          ]
        },
        {
          "label": "Page #3",
          "icon": "number-3",
          "widgets": [
            
          ]
        },
        {
          "label": "Page #4",
          "icon": "number-4",
          "widgets": [
            
          ]
        },
        {
          "label": "Page #5",
          "icon": "number-5",
          "widgets": [
            
          ]
        }
      ]
    }
  }
}

#3

Good Catch, but i think that is this web page that did it; looking at it in NotePad++ it looks like it has the correct quotes:

image


#4

I think i found the issue:
It wasn’t clear when i was manually adding a widget what i was selecting for the binding.
Manually i select “House Lights” but the actual switch name is AllLightsEchoSwitch

Switch AllLightsEchoSwitch “House Lights” [ “Switchable” ]

Changing the text file to that it loads


#5

That’s great. Next release should have better errors when config import fails, instead of just blanket error message for everything.


#6

New question LOL
I tried to add a second switch, position just next to the other:
I changed it to 1-0, I’m assuming x moves over 1 and Y stays the same, and it should show up next to it, but nothing shows up; just the original one i did, not the new one.

	{
          "type": "switch",
          "position": "1-0,1-1",
          "properties": {
            "label": "Dining Room",
            "icon": "light",
            "state": {
              "binding": "DiningRoomLightEchoSwitch"
            },
            "reverse": false
          }
        }

#7

Yes, that should work like that (just checked). Make sure that you exit the app through back button, otherwise config will not be reloaded immediately.


#8

Yeah i completed exited the app. Still won’t load the second switch.
Tried clearing the app cache too in settings, still only loads the original switch, not the second:

{
  "dashboards": {
    "home": {
      "columns": 8,
      "rows": 6,
      "pages": [
        {
          "label": "Lights",
          "icon": "home",
          "widgets": [
            {
              "type": "switch",
              "position": "0-0,1-1",
              "properties": {
                "label": "All Lights",
                "icon": "light",
                "state": {
                  "binding": "AllLightsEchoSwitch"
                },
                "reverse": false
              }
            }
			
			{
              "type": "switch",
              "position": "1-0,1-1",
              "properties": {
                "label": "Dining Room",
                "icon": "light",
                "state": {
                  "binding": "DiningRoomLightEchoSwitch"
                },
                "reverse": false
              }
            }
		  ]
        },
        {
          "label": "Page #2",
          "icon": "number-2",
          "widgets": [
            
          ]
        },
        {
          "label": "Page #3",
          "icon": "number-3",
          "widgets": [
            
          ]
        },
        {
          "label": "Page #4",
          "icon": "number-4",
          "widgets": [
            
          ]
        },
        {
          "label": "Page #5",
          "icon": "number-5",
          "widgets": [
            
          ]
        }
      ]
    }
  }
}

#9

If that’s exact config you have, then after } in the first swift config there should be a , after.
Were you getting import config error in UI when loading this config?


#10

HA, i just saw that at the same time you replied…no there were no errors, it loaded just the first switch. Nothing alluding to the error. Loaded now.


#11

Previously i used to be able to put this into the txt file(legacy) to show my cameras:

Frame label="Kitchen {widget:image}" {
	Image url="http://172.16.1.242:8080/static/Kitchen.jpg" refresh=10000
}

Now, in the new format, they don’t show up and there is no error:

        {
          "label": "Cameras",
          "icon": "number-2",
          "widgets": [
			{
              "type": "switch",
              "position": "0-0,2-2",
              "properties": {
                "label": "Refresh Pics",
                "icon": "refresh",
                "state": {
                  "binding": "CameraSnaps"
                },
                "reverse": false
              }
            },
			{
				"type": "camera",
				"position": "0-2,2-2",
				"properties": {
					"snapshot": {
						"binding": Image url="http://172.16.1.242:8080/static/Kitchen.jpg" refresh=10000
						},
					"scaling": "crop",
					"rotation": 0
				 }
			}

#12

binding only accepts OH item names, so you would need to assign that URL as a state of an item.
There is an example in this post: OpenHab Camera as an Item?


#13

How can you clear out the page?

I tried somethings on page 2 and it didn’t work, i edited it and it won’t change back.
I completely removed all the widgets from page 2 and it’s still showing up with remnants of the last things I tried; I expect it to refresh to blank.
Tried restarting the app
Tried clearing the cache of the app
These got to be something I’m missing here.

  "dashboards": {
    "home": {
      "columns": 8,
      "rows": 6,
      "pages": [
        {
          "label": "Lights",
          "icon": "home",
          "widgets": [
            {
              "type": "switch",
              "position": "0-0,2-2",
              "properties": {
                "label": "All Lights",
                "icon": "light",
                "state": {
                  "binding": "AllLightsEchoSwitch"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "2-0,2-2",
              "properties": {
                "label": "Dining Room",
                "icon": "light",
                "state": {
                  "binding": "DiningRoom_Light"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "4-0,2-2",
              "properties": {
                "label": "Kitchen",
                "icon": "light",
                "state": {
                  "binding": "KitchenColorHueSW"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "6-0,2-2",
              "properties": {
                "label": "Hall",
                "icon": "light",
                "state": {
                  "binding": "HallLight1"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "0-2,2-2",
              "properties": {
                "label": "Porch",
                "icon": "light",
                "state": {
                  "binding": "PorchDualSwitch"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "2-2,2-2",
              "properties": {
                "label": "BedroomRich",
                "icon": "light",
                "state": {
                  "binding": "BedRoomLight"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "4-2,2-2",
              "properties": {
                "label": "LivingRoom Front",
                "icon": "light",
                "state": {
                  "binding": "LivingRoomFrontBulb"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "6-2,2-2",
              "properties": {
                "label": "LivingRoom Back",
                "icon": "light",
                "state": {
                  "binding": "LivingRoom_PowerStrip"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "0-4,2-2",
              "properties": {
                "label": "Guest Room",
                "icon": "light",
                "state": {
                  "binding": "GuestRoom_PowerStrip"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "2-4,2-2",
              "properties": {
                "label": "Rich Office",
                "icon": "light",
                "state": {
                  "binding": "OfficeHueSwitch"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "4-4,2-2",
              "properties": {
                "label": "Bedroom Erika",
                "icon": "light",
                "state": {
                  "binding": "ErikaBedLampDimmer"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "6-4,2-2",
              "properties": {
                "label": "Living Room Hue",
                "icon": "light",
                "state": {
                  "binding": "KitchenColorHueSW"
                },
                "reverse": false
              }
            }
		  ]
        },
        {
          "label": "Cameras",
          "icon": "number-2",
          "widgets": [
				          
          ]
        },
        {
          "label": "Page #3",
          "icon": "number-3",
          "widgets": [
            
          ]
        },
        {
          "label": "Page #4",
          "icon": "number-4",
          "widgets": [
            
          ]
        },
        {
          "label": "Page #5",
          "icon": "number-5",
          "widgets": [
            
          ]
        }
      ]
    }
  }
}

#14

I can’t even delete the platform.
I removed the json file deleted the app and reisntalled.
Still comes up with the old dashboard.
I tried to delete the platform, it stays there.

Very confused at this juncture.


#15

Cleared out cache.
Cleared out data.
Uninstalled
Reinstalled
Still, the settings show up, the old dashboards are there. Can’t get them to change; the json file is wiped.
No idea how it’s still getting old dashboards that are no longer in the json file after doing all of this.


#16

So finally i got something to change after doing all of that, however i can’t load more than 3 web widgets now:
Once i put a 4th web widget in, it says unable to load the file

 },
        {
          "label": "Page #2",
          "icon": "number-2",
          "widgets": [
			{
			  "type": "web",
			  "position": "0-0,2-2",
			  "properties": {
				"uri":"http://admin:pw@172.16.1.181:45681/image/jpeg.cgi",
				"js": false,
				"storage": false,
				"refresh-interval": 10
			  }
			},			
 			{
			  "type": "web",
			  "position": "0-2,2-2",
			  "properties": {
				"uri":"http://admin:pw@172.16.1.186:45686/image/jpeg.cgi",
				"js": false,
				"storage": false,
				"refresh-interval": 10
			  }
			},			
 			{
			  "type": "web",
			  "position": "0-4,2-2",
			  "properties": {
				"uri":"http://admin:pw@172.16.1.160:45660/image/jpeg.cgi",
				"js": false,
				"storage": false,
				"refresh-interval": 10
			  }
			},			
 			{
			  "type": "web",
			  "position": "0-6,2-2",
			  "properties": {
				"uri":"http://admin:pw@172.16.1.159:45659/image/jpeg.cgi",
				"js": false,
				"storage": false,
				"refresh-interval": 10
			  }
			}           
			
          ]
        },
        {
          "label": "Page #3",
          "icon": "number-3",
          "widgets": [

#17

This is very weird. When you cleared the data, the platform was deleted after that, right?
Might be a backend cache issue.


#18

No, i’ve cleared cache and app data a few times; seems to keep things around. even after i do that and uninstall, reinstall and wipe out the json file, it still shows up with settings and old stuff.
FInally i got it to load new stuff, and now am having the new issue above.


#19

How many rows and columns you have on a page? Try adjusting position of last widget.

Better error messages are coming in the next release, which would make this setup much easier.


#20

8 columns and 6 rows…should be enough

{
  "dashboards": {
    "home": {
      "columns": 8,
      "rows": 6,
      "pages": [
        {
          "label": "Lights",
          "icon": "home",
          "widgets": [
            {
              "type": "switch",
              "position": "0-0,2-2",
              "properties": {
                "label": "All Lights",
                "icon": "light",
                "state": {
                  "binding": "AllLightsEchoSwitch"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "2-0,2-2",
              "properties": {
                "label": "Dining Room",
                "icon": "light",
                "state": {
                  "binding": "DiningRoom_Light"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "4-0,2-2",
              "properties": {
                "label": "Kitchen",
                "icon": "light",
                "state": {
                  "binding": "KitchenHueDimmer"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "6-0,2-2",
              "properties": {
                "label": "Hall",
                "icon": "light",
                "state": {
                  "binding": "HallLight1"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "0-2,2-2",
              "properties": {
                "label": "Porch",
                "icon": "light",
                "state": {
                  "binding": "PorchDualSwitch"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "2-2,2-2",
              "properties": {
                "label": "BedroomRich",
                "icon": "light",
                "state": {
                  "binding": "BedRoomLight"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "4-2,2-2",
              "properties": {
                "label": "LivingRoom Front",
                "icon": "light",
                "state": {
                  "binding": "LivingRoomFrontBulb"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "6-2,2-2",
              "properties": {
                "label": "LivingRoom Back",
                "icon": "light",
                "state": {
                  "binding": "LivingRoom_PowerStrip"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "0-4,2-2",
              "properties": {
                "label": "Guest Room",
                "icon": "light",
                "state": {
                  "binding": "GuestRoom_PowerStrip"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "2-4,2-2",
              "properties": {
                "label": "Rich Office",
                "icon": "light",
                "state": {
                  "binding": "OfficeHueSwitch"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "4-4,2-2",
              "properties": {
                "label": "Bedroom Erika",
                "icon": "light",
                "state": {
                  "binding": "ErikaBedLampDimmer"
                },
                "reverse": false
              }
            },
			{
              "type": "switch",
              "position": "6-4,2-2",
              "properties": {
                "label": "Living Room Hue",
                "icon": "light",
                "state": {
                  "binding": "KitchenColorHueSW"
                },
                "reverse": false
              }
            }
		  ]
        },
        {
          "label": "Page #2",
          "icon": "number-2",
          "widgets": [
			{
			  "type": "web",
			  "position": "0-0,2-2",
			  "properties": {
				"uri":"http://admin:pw@172.16.1.181:45681/image/jpeg.cgi",
				"js": false,
				"storage": false,
				"refresh-interval": 10
			  }
			},			
 			{
			  "type": "web",
			  "position": "0-2,2-2",
			  "properties": {
				"uri":"http://admin:pw@172.16.1.186:45686/image/jpeg.cgi",
				"js": false,
				"storage": false,
				"refresh-interval": 10
			  }
			},			
 			{
			  "type": "web",
			  "position": "0-4,2-2",
			  "properties": {
				"uri":"http://admin:pw@172.16.1.160:45660/image/jpeg.cgi",
				"js": false,
				"storage": false,
				"refresh-interval": 10
			  }
			},			
 			{
			  "type": "web",
			  "position": "0-6,2-2",
			  "properties": {
				"uri":"http://admin:pw@172.16.1.159:45659/image/jpeg.cgi",
				"js": false,
				"storage": false,
				"refresh-interval": 10
			  }
			}           
			
          ]
        },
        {
          "label": "Page #3",
          "icon": "number-3",
          "widgets": [
            
          ]
        },
        {
          "label": "Page #4",
          "icon": "number-4",
          "widgets": [
            
          ]
        },
        {
          "label": "Page #5",
          "icon": "number-5",
          "widgets": [
            
          ]
        }
      ]
    }
  }
}