mystrom: temporary fallback for v1 switches without 'type' (legacy firmware)#150845
Closed
elsi06 wants to merge 2 commits intohome-assistant:devfrom
Closed
mystrom: temporary fallback for v1 switches without 'type' (legacy firmware)#150845elsi06 wants to merge 2 commits intohome-assistant:devfrom
elsi06 wants to merge 2 commits intohome-assistant:devfrom
Conversation
…patibility until python-mystrom fix releases
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
|
Hey there @fabaff, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
joostlek
requested changes
Aug 19, 2025
Member
joostlek
left a comment
There was a problem hiding this comment.
Okay so 2 things
- We don't allow integrations to do requests themselves, that should happen in the library. I know you have the PR open, but my teacher used to say "nothing is as definitive as a temporary solution". So I don't want to merge this as is.
- You mention that it doesn't work in 2025.8.0 anymore because of a keyerror because it is missing
type, but on line 54, we use.setdefaultto settypeto a value, so I am not sure why this would be ommitted now
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Older myStrom v1 switches (e.g., firmware 2.x) can omit the
typekey in their info endpoints. The library then raises aKeyErrorduringget_state, which prevents the integration from setting up in 2025.8.x.This PR adds a minimal, temporary fallback in the myStrom integration to handle that case until the upstream fix in python‑mystrom is released.
Problem
KeyError: 'type'originating from python‑mystrom when parsing device infoWhat this PR changes
KeyErrorduring initial switch setup/report(power/Ws/relay/temperature)/relayKeyErrorpath onlyWhy this is safe
KeyErrorfor missingtypeFiles touched
homeassistant/components/mystrom/__init__.py— fallback hook onKeyErroronlyhomeassistant/components/mystrom/legacy.py— NEW; temporary v1 helpertests/components/mystrom/test_legacy_v1.py— NEW; covers fallback pathTesting
KeyErrorpath and verifies:Follow-up plan
typeis published:manifest.jsonlegacy.pyand the fallback branchRelated links
Reviewer checklist
KeyErrorpath