Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blank iOS Sitemap VIew - Due to metadata being decoded by iOS - keyNotFound "label" #844

Open
torrswanson opened this issue Oct 21, 2024 · 0 comments

Comments

@torrswanson
Copy link

New bug checklist

Describe the bug
While the iOS app is parsing the sitemap data, there is a missing "label" key in the JSON that is fetched that causes an iOS exception and the sitemap does not get fully decoded and therefore does not load for the user.

Bug Location

Bug Tracked to this exact spot on Line 376:

let sitemapPageCodingData = try data.decoded(as: OpenHABSitemapPage.CodingData.self)

iOS Log:
keyNotFound(CodingKeys(stringValue: "label", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "widgets", intValue: nil), _JSONKey(stringValue: "Index 1", intValue: 1), CodingKeys(stringValue: "widgets", intValue: nil), _JSONKey(stringValue: "Index 1", intValue: 1), CodingKeys(stringValue: "item", intValue: nil), CodingKeys(stringValue: "stateDescription", intValue: nil), CodingKeys(stringValue: "options", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0)], debugDescription: "No value associated with key CodingKeys(stringValue: "label", intValue: nil) ("label").", underlyingError: nil))

To Reproduce
Steps to reproduce the behavior:

  1. On web, add a new item, add "State Description Metadata", add a few key/value Options, say true=Open new line false=Closed
  2. Load up the Openhab Mobile app and receive the properly loaded sitemap.
  3. Go back to the web and edit the "OPtions" in your Items state description metadata. (I removed the options in my case)
  4. Go back to the iOS mobile app and the sitemap will not load anything due to this bug of not being able to parse the incoming JSON due to a missing "label" key.

Expected behavior
The mobile app should load the sitemap after editing the Item's state description metadata.

Screenshots
If applicable, add screenshots to help explain your problem.

App (please complete the following information):

  • Version: 2.4.60 (1580410538)

Smartphone (please complete the following information):

  • Device: Iphone SE Second Gen. Happens on all phones though

openHAB (please complete the following information):

  • Version 4.2.1

Workaround

  • Locate the Item you recently edited, and delete it's State Description Metadata field.
  • Re-add the State Description metadata.

Additional context
I would help fix, but I don't know whose fault this is, iOS not handling an optional "label" key or the Web side not providing the necessary valid JSON. My guess would be that this is a Web issue dealing with the removal of "Options" in an Item's State Decrioption metadata and erroneously still providing Option values in the JSON when it shouldn't be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant