home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.17k stars 29.85k forks source link

Unsupported myStrom device type: 105 #95959

Closed jhartlep closed 1 year ago

jhartlep commented 1 year ago

The problem

The new myStrom integration is great! But unfortunally, the myStrom strip is not supported. In the log I get "Unsupported myStrom device type: 105".

When I call curl http://[IP_ADDRESS]/api/v1/device/[MAC_ADDRESS], I get this answer:

{
    "[MAC_ADDRESS]": {
        "type": "strip",
        "battery": false,
        "reachable": true,
        "meshroot": true,
        "on": false,
        "color": "11;97",
        "mode": "mono",
        "ramp": 100,
        "power": 0,
        "fw_version": "4.0.4",
        "connectionStatus": {
            "ntp": true,
            "dns": true,
            "connection": true,
            "handshake": true,
            "login": true
        }
    }
}

It would be great, if this integration would support this too.

What version of Home Assistant Core has the issue?

core-2023.7.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

myStrom

Link to integration documentation on our website

https://www.home-assistant.io/integrations/mystrom

Diagnostics information

Logger: homeassistant.components.mystrom Source: components/mystrom/init.py:51 Integration: myStrom (documentation, issues) First occurred: 07:28:39 (1 occurrences) Last logged: 07:28:39

Unsupported myStrom device type: 105

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @fabaff, mind taking a look at this issue as it has been labeled with an integration (mystrom) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `mystrom` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign mystrom` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


mystrom documentation mystrom source (message by IssueLinks)

joostlek commented 1 year ago

Can you do a request to both http://{host}/api/v1/info and http://{host}/info.json?

jhartlep commented 1 year ago

Sure: http://{host}/api/v1/info

{
    "version": "4.0.4",
    "mac": "[MAC_ADDRESS]",
    "ssid": "[SSID]",
    "ip": "[IP_ADDRESS]",
    "mask": "255.255.240.0",
    "gw": "192.168.1.1",
    "dns": "192.168.1.252",
    "static": false,
    "connected": true,
    "type": 105,
    "connectionStatus": {
        "ntp": true,
        "dns": true,
        "connection": true,
        "handshake": true,
        "login": true
    }
}

http://{host}/info.json

{
    "version": "4.0.4",
    "mac": "[MAC_ADDRESS]",
    "ssid": "[SSID]",
    "ip": "[IP_ADDRESS]",
    "mask": "255.255.240.0",
    "gw": "192.168.1.1",
    "dns": "192.168.1.252",
    "static": false,
    "connected": true,
    "type": "WRS",
    "name": "WiFi RGB Strip",
    "connectionStatus": {
        "ntp": true,
        "dns": true,
        "connection": true,
        "handshake": true,
        "login": true
    }
}
joostlek commented 1 year ago

~And http://{host}/api/v1/device/{mac}?~

nvm, you already sent that

joostlek commented 1 year ago

Right, I made this PR with a change I think should work but I need you to verify it (since I don't have MyStrom devices).

Are you able to pull the core project from github and then copy homeassistant/components/mystrom to your HA instance at /config/custom_components/mystrom. Then go into /config/custom_components/mystrom/manifest.json and add

{
  ...
  "version": "0.0.0"
}

Then apply the code change I did in this PR. And restart HA.

HA will then run the modified component over the core one, enabling you to verify the fix.

jhartlep commented 1 year ago

First,

Ok, I did clone the homeassistant core into the /tmp folder (branch dev), copied the homeassistant/component/mystrom folder from this checkout into /config/custom_components/mystrom. And I changed the manifest.json from the copied folder and applied your PR.

image image image

But after a restart of HA, i still get Unsupported myStrom device type: 105 From the log I see, that HA does not use the modified version of this integration: Source: components/mystrom/init.py:51

Why does HA not use the modified version?

joostlek commented 1 year ago

Ooh, you forgot the comma after "requirements": [...],

jhartlep commented 1 year ago

Facepalm...

Ok, now I get this error: "Device [IP_ADDRESS] ([MAC_ADDRESS]) is not a myStrom bulb nor myStrom LED Strip" (Source: custom_components/mystrom/init.py:44)

joostlek commented 1 year ago

Right, then we end up with the same problem as in https://github.com/home-assistant/core/issues/95995. I am currently working on a fix for that aswell. It looks like it's checking support but before it actually requested the variables to check support with.

joostlek commented 1 year ago

I think I have a fix. Made some unit tests for it and I am confident that this will at least solve these 2 issues. (And hopefully doesn't bring us to another). The fix is now in branch #96004 (wanted to have a separate PR for each bug, but now both are having the same bug). The fix is now a bit bigger, maybe doing a wget on https://raw.githubusercontent.com/home-assistant/core/ef8494b4a9a1d10272c1e5903822ad716835d797/homeassistant/components/mystrom/__init__.py to replace the __init__.py in the component would be easier

jhartlep commented 1 year ago

Great, it works! No errors in the protocol and I can switch the light on and of:

image

Many thanks!

joostlek commented 1 year ago

The PR for this fix is now merged. I am putting it on the 7.2 milestone, so then the fix will be in the official release. After updating to 7.2 (whenever that's released), don't forget to remove the custom component :).

Fixed by #96004.

dukes4 commented 1 year ago

Device Type 103 is also not jet supported

myStrom WiFi Button Plus, supports: "single": "", "double": "", "long": "", "touch": "", "generic"

Home Assistant 2023.7.3 Logs: Unsupported myStrom device type: 103

curl http://{host}/api/v1/device/[MAC] { "[MAC]": { "type": "wheel", "battery": true, "reachable": true, "meshroot": false, "charge": false, "voltage": 4.71, "fw_version": "2.74.38", "single": "[ID of the button]", "double": "[ID of the button]", "long": "[ID of the button]", "touch": "[ID of the button]", "generic": "[ID of the button]", "connectionStatus": { "ntp": true, "dns": false, "connection": false, "handshake": false, "login": false}, "name": ""} }

curl http://{host}/api/v1/info
{ "version": "2.74.38", "mac": "[MAC]", "type": 103, "ssid": "[SSID]", "ip": "[IP]", "mask": "[MASK]", "gw": "[GW]", "dns": "[DNS]", "static": false, "connected": true, "signal": 66 }

joostlek commented 1 year ago

Please create a new issue