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.
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.
You can find additional information about:
- HomeAssistants REST-API: e.g. other possible API-Commands
- myStroms REST-API
- HomeAssistants Authentication Methods
- Generating an API-TOKEN
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.
- Flash the buttons with custom firmware from myStrom themself.
- Use the “myStrom Button Max Tool” to connect to the flashed button and configure the button.
- Upload the resulting json-File to the button again using the above tool.
- Download the json file from the button:
curl -s -o configfile.json http://<BUTTON-IP-ADDRESS>/api/v1/config
- 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"
},
- Upload the File again:
curl -i -d @configfile.json http://<BUTTON-IP-ADDRESS>/api/v1/config
- 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
- You’re DONE You can now remotely control HA-Entitys via myStroms WiFi-Button.