core: Mystrom integration is broken in 0.108

The problem

I just updated from 0.107.7 to 0.108.0 and all my mystrom switches are no longer available. Homeassistant complains about a key error.

Environment

  • Home Assistant Core release with the issue: 0.108.0
  • Last working Home Assistant Core release (if known): 0.107.7
  • Operating environment (Home Assistant/Supervised/Docker/venv): Not sure, it is running on a Ubuntu 18.04 server edition, but there the supervised version is installed which uses docker…
  • Integration causing this issue: mystrom
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/mystrom/

Problem-relevant configuration.yaml

switch:
    - platform: mystrom
      host: 192.168.4.20
      name: Fernseher Schlafzimmer
    - platform: mystrom
      host: 192.168.4.21
      name: MyStrom Sonos Kueche
    - platform: mystrom
      host: 192.168.4.22
      name: MyStrom Sonos Schlafzimmer
    - platform: mystrom
      host: 192.168.4.23
      name: MyStrom Sonos Buero
    - platform: mystrom
      host: 192.168.4.24
      name: MyStrom Sonos One Wohnzimmer
    - platform: mystrom
      host: 192.168.4.25
      name: MyStrom Sonos Beam Wohnzimmer
    - platform: mystrom
      host: 192.168.4.26
      name: MyStrom Phone Charger
    - platform: mystrom
      host: 192.168.4.27
      name: MyStrom Aquarium Licht
    - platform: mystrom
      host: 192.168.4.28
      name: MyStrom Aquarium Heizung
    - platform: mystrom
      host: 192.168.4.29
      name: MyStrom Aquarium Filter
    - platform: mystrom
      host: 192.168.4.30
      name: MyStrom Aquarium Luftpumpe
    - platform: mystrom
      host: 192.168.4.31
      name: MyStrom Aquarium Ventilator

Traceback/Error logs

2020-04-08 20:51:04 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 295, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 447, in _async_add_entity
    await entity.async_update_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 284, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state
    state = self.state
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 612, in state
    return STATE_ON if self.is_on else STATE_OFF
  File "/usr/src/homeassistant/homeassistant/components/mystrom/switch.py", line 60, in is_on
    return bool(self.data["relay"])
KeyError: 'relay'

Additional information

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 6
  • Comments: 32 (3 by maintainers)

Most upvoted comments

109.4 has landed. MyStrom fix is not in the release notes.

I’m aware of the changelog and have been reading each one carefully since 108 broke MyStrom. No sign of it so far. As you say, if it has been included in the latest pull request then perhaps we will see it soon. I’ll be sitting on my hands until then.

My solution to fix the mystrom issue for the meantime is, to create a command_line switch.

  - platform: command_line
    switches:
      tv_command_line:
        command_on: "curl -X GET 'http://192.168.1.40/relay?state=1'"
        command_off: "curl -X GET 'http://192.168.1.40/relay?state=0'"
        command_state: "curl -X GET 'http://192.168.1.40/report'"
        value_template: '{{ value_json.relay == true }}'
        friendly_name: TV

My mystrom switch works all fine again with this solution in 0.108.1

That’s so weird that I missed it. I opened the release notes and searched in Chrome.
Oh well, I’m far too happy to be bothered! My electric radiators now work and it’s 27 degrees outside. Yay!

Hello, I have the same problem with my myStrom switches (v1 and v2). The Temperature Sensors (of v2) seem to work, but not the Power Consumption. I’m running Home Assistant 108.3 with HassOS 3.12 on a Raspberry Pi

Sorry, I wasn’t aware that’s a no no. Point taken and I apologise.