I’m not sure on if this is a configuration error on my side or a bug.
Using OH3 3.0.0~S1983-1 on a RP3
When clicking on Location Tab on the Overview landing page I get the following error in the browser console - nothing happens on the Location page.
app.js:7 TypeError: Cannot read property 'item' of undefined
at i.parentLocationName (app.js:20)
at app.js:20
at i.yt [as _l] (app.js:7)
at i.<anonymous> (app.js:20)
at i.e._render (app.js:7)
at i.a (app.js:7)
at hn.get (app.js:7)
at new hn (app.js:7)
at app.js:7
at i.Sn.$mount (app.js:7)
Pretty printed app.js line numbers:
app.js:formatted:5961 TypeError: Cannot read property 'item' of undefined
at i.parentLocationName (app.js:formatted:67072)
at app.js:formatted:67093
at i.yt [as _l] (app.js:formatted:6210)
at i.<anonymous> (app.js:formatted:67084)
at i.e._render (app.js:formatted:7353)
at i.a (app.js:formatted:9033)
at hn.get (app.js:formatted:6834)
at hn.run (app.js:formatted:6888)
at pn (app.js:formatted:6773)
at Array.<anonymous> (app.js:formatted:6006)
I have tried to iterate over my items using RestAPI to identify any errors, but no success yet. Also I tried to set up a completely clean install of OH3 on another device and believe I still got this error.
Anyone pint me in the right direction, or should this be filed as a bug in GitHub?
Are there any elements/widgets used on the location-page?
I did not get these errors on that page, but haven´t placed any elements there yet. Some widgets (including the weather one, I posted earlier this week) could produce those errors, if any of the elements isn´t configured properly.
I don’t think I can add any elements to that page at all - to my understanding it should be autogenerated like the Equipment and Properties tabs from the Model/Semantics.
If you click on the page it just does not show anything but if you open the inspector you can see the console errors.
But my understanding is, that these locations gets generated by the locations set in the *.things file / or the UI. But doesn´t see anything there, even if I do so.
This looks like one of your Location items has a ‘isPartOf’ reference to a parent Location that doesn’t exist (anymore).
You probably can’t see it in the model because the hierarchy is likely broken. In the Items page, check your locations - you can search for Location - and in the details pages, look if you have a “isPartOf” under “Semantic Classification”, and if so, check that the referenced Group exists. One of them is probably missing.
Once you’ve fixed the problem the cards should appear in the Locations tab on the home page if you have at least a Equipment (with a specialized class, not just “Equipment”) with a least a Point, or a Point directly below the location.
This looks promising, actually I had a hard time wrapping my head around the use of points directly below a location.
There is not too much examples on this on the semantic topics around and I actually thought that would be bending the usage a bit. However this makes perfectly sense to me on a lot of the sensors that should be directly related to a location - like temperature and motion etc. This is much like how the iOS Home app presents those as well if I understand it correctly. Up until now I always had a group representing the sensor item.
However I have a hard time spotting the item breaking my config - I have about 200 items… I tried a few RestAPI queries to get the list out to avoid clicking through all of them.
Any pointers on how to query the item-endpoint to list out this? (GET /items). I tried isPartOf and HasLocation as metadata and looking at the GroupNames but no luck…
Yes you can click the first line on the stack trace of the error that you get. (with app.js pretty printed as you’ve already done).
Next you right click on the line number (67072), select “Conditional breakpoint” in the menu, and type !t
as the expression.
then hit Return, the line number should highlight in yellow.
Then go to another tab in the app and go back to Locations, it should pause at the breakpoint before the error occurs. Then in the console you just have to type e.name and there’s your culprit:
Don’t forget to remove the breakpoint afterwards to avoid headaches.
I got the cards on Locations back by disconnecting all 1. level sublocations from the top location. Adding one and one back it seems to fail on several of my “sublocations” when I add them one by one back in the hierarchy.
Given this model setup the Location tab works fine:
So Livingroom, Corridor and Outdoor seems to be failing.
Looking at livingroom separately I just don’t get how it is working as a “top level” location and not as a sublocation of another.
Having LivingRoom as a root node works fine, putting it below another node seems to be failing.
Here I used the restapi to query it while failing and below the Hasselbakken -> FirstFloor node.
(At the same time answering the RestAPI question for others, using metadata = semantics will show isPartOf)
Huh. TIL, I suppose!
(disclaimer: in my language “équipement” is a substantive and “équipements” is a perfectly valid form)
Thanks for reporting this in a less obnoxious way @ranielsen
The Locations tab will break if a part of the model is tagged directly with Location and not a subclass of Location. Switching it to e.g Indoor will fix it.
I built my model on the top level logic that Openhab would cover several locations - that was probably a bit ambitious and probably not valid either. But worth some input if anyone has any pointers.
Thinking that my “OpenHAB setup” should cover both our home and the cabin eventually I wanted a structure like this:
Home property
Main house
– Floor1
— Room1
— …
– Floor2
– …
Shed
Outdoor
Cabin property
Main cabin
– Floor1
— Room1
— …
– Floor2
Guest house
Outdoor
I thought then that according to the Brick Model that I could tag the properties with the Location class, but this probably won’t work.