Using myStrom WiFi-Buttons with HomeAssistant

Once upon a time when I started to realize that zigbee will have - at least for me - no future, it then took my a veeeeeery long-time to find equivalent WiFi devices: bulbs, sensors and so on. Although ESPhome did solve a lot of these challenges, above all there were no WiFi-buttons: nore ready-made nore diy-ones.

I do definitively NOT want to start again a Zigbee vs. WiFi-discussion about battery-life vs. connection issues as this has been done often here like I did myself here or here in the past.
:wink:

In any case: NOW I found the very cool WiFi-Buttons from myStrom, a IoT-manufacturer who is obviously very keen to open-source and local polling. I was BLOWN AWAY on the spot in the same way I was also SADDENED TO DEATH to see that its HA-integration does not work anymore as only unencrypted API commands are supported on the one hand side from myStrom but encryption is requested from HomeAssistant.

Although I can not solve the original problem making the integration work itself, I am VERY HAPPY I could find a workaround for those of you that stumble across this post and try to integrate these buttons.

:partying_face:

You can find additional information about:

The Following describes changing an API-POST-Command for Button 1 being pushed once (1x) resulting in turning a HA-entity on. You have of course to repeat the below step 6 for each other command.

  1. Flash the buttons with custom firmware from myStrom themself.
  2. Use the “myStrom Button Max Tool” to connect to the flashed button and configure the button.
  3. Upload the resulting json-File to the button again using the above tool.
  4. Download the json file from the button:
    curl -s -o configfile.json http://<BUTTON-IP-ADDRESS>/api/v1/config
  5. Edit this file adding the following header repeatedly for each button command:
    From:
 {
          "http": {
            "method": "POST",
            "payload": " {\"state\": \"on\"}",
            "url": "http://<HA-IP-ADDRESS>/api/states/<HA-ENTITY_ID>"
          },
          "scheme": "1x",
          "trigger": "btn1"
        },

To:

 {
          "http": {
            "headers":[
              "Authorization: Bearer <LOOOOOONGAPITOKEN>"
            ],
            "method": "POST",
            "payload": " {\"state\": \"on\"}",
            "url": "http://<HA-IP-ADDRESS>/api/states/<HA-ENTITY_ID>"
          },
          "scheme": "1x",
          "trigger": "btn1"
        },
  1. Upload the File again:
    curl -i -d @configfile.json http://<BUTTON-IP-ADDRESS>/api/v1/config
  2. This should be the buttons answer:
HTTP/1.1 200 OK
Content-Type: text/plain
Content-Length: 0
Connection: close
Pragma: no-cache
Cache-Control: no-store, no-cache
  1. You’re DONE :slight_smile: You can now remotely control HA-Entitys via myStroms WiFi-Button.
1 Like

Hi!

Thank you for your guide. How ever I had some issues when following it and I want to share my soulution - if there is anybody else having simular issues.

I had firmware 1.2.1 installed on my button and I could’nt install the custom firmware. After some tinkering I emailed myStrom and they were verry helpful.

Apperently you do not need a custom firmware to use the tool “myStrom Button Max Tool” when using the firmware 1.2.1. But you need to set the button to Tool mode. This is done with the following:

curl -i -d '{"mode":"tool"}' http://<your-button-ip>/api/v1/settings

Example:

curl -i -d '{"mode":"tool"}' http://192.168.1.139/api/v1/settings

So I replaced your step 1. with the above command and then the button appeared in “myStrom Button Max Tool” and I could follow the rest of your guide.