johannrichard / homebridge-dingz

Emerging Homebridge Plugin for dingz & myStrom WiFi Switch Devices. Replaces the obsolete homebridge-mystrom plugin
https://github.com/johannrichard/homebridge-dingz/wiki
Apache License 2.0
12 stars 6 forks source link

[FEATURE] Add support for MyStrom Button+ 2 #540

Closed petter1 closed 1 year ago

petter1 commented 1 year ago

I recently bought the MyStrom button+ 2 unknowing, that it has no direct HomeKit support. Now I found this repo and recognised, that it is not in this plugin yet.

The button+ 2 is a device with 4 inputs and it can differentiate between press, double press and long press on each.

https://mystrom.ch/de/wifi-button-plus/ https://mystrom.ch/de/support/wifi-button-plus-2/

johannrichard commented 1 year ago

I'm already working on it ... expect an alpha/beta release soon (no ETA though)

petter1 commented 1 year ago

Awesome 😍 nice to hear! I would love to help in development if anyhow possible 😁

Btw, I live in Switzerland as well

petter1 commented 1 year ago

I started to Analyse the code in order to see what has to be changed I saw, that the dingz already has a four button layout like dingz

So we could go the same way with the variable module With 1,2,3,4 btn1,btn2,btn3,btn4

API to set WebHook for it is same as with the one button, just with definition which button after action: to POST v1/action/${module}/<generic|single|double|long>

I could not find, where you define the WebHook action or listen for it yet. I want to test, if the plugin works, if I hack in the webHook string manually using cURL

In my Fork, I added all the myStrom devices to the commonTypes.ts according the list on api.mystrom.ch

johannrichard commented 1 year ago

So we could go the same way with the variable module With 1,2,3,4 btn1,btn2,btn3,btn4

Yes that’s right. I’m close to release an alpha version, just waiting for a button to arrive on my doorstep to do some real-world testing before releasing it. If you give me a day or two I might be able to do so soon. ☺️

The webhook is handled by the platform code platform.ts.

petter1 commented 1 year ago

πŸ˜‚πŸ«£you are too fast I wanted to learn TS with this project

Maybe I can enhance device discovery or do a web view πŸ˜ƒ I guess that would be a nice addition.

If you want, i could do real world testing tonight 😁

johannrichard commented 1 year ago

Here we go: v3.3.0-alpha.1 should be available. Beware: It's really alpha, I have not yet tested it with a real Button+ and things will break!

PS: Of course, contributions are welcome. This has mostly been a "one trick pony" (a.k.a. me) story so far. It might thus take some time for me to get used to real collaborative development and to get some process & workflows agreed on that would make the best use of our collective effort.

johannrichard commented 1 year ago

Furthermore, I will not be very responsive the new few days. If you run into big problems, you might of course roll-back to the latest stable version.

petter1 commented 1 year ago

I could not connect with auto discovery: Unknown device: 118 This Log is created in platform.ts Row 1002 I could not find a case DeviceTypes.MYSTROM_BUTTON_PLUS_2G But all the other buttons, so I guess it needs to be there as well

image If I try it manually I get

[11/29/2022, 1:50:17 AM] [dingz and myStrom SmartHome platform] Add Device from config:  myStromButtonPlus -> dingz SmartHome Device
[11/29/2022, 1:50:17 AM] [dingz and myStrom SmartHome platform] Device type undefined is currently unsupported for manual addition. Will skip.
[11/29/2022, 1:50:17 AM] [dingz and myStrom SmartHome platform] Add Device from config:  undefined -> dingz SmartHome Device
[11/29/2022, 1:50:17 AM] [dingz and myStrom SmartHome platform] Device type undefined is currently unsupported. Will skip.
[11/29/2022, 1:50:17 AM] [dingz and myStrom SmartHome platform] Starting discovery

Will research further tomorrow πŸ˜ƒ

johannrichard commented 1 year ago

The perils of early commits. 🫣🀣 Missed that one with all the on-off coding over the last days.

This should be an easy one, if you are keen on contributing you could try a PR for that one too, besides #544 (if you do so, keep the two PRs separate).

petter1 commented 1 year ago

I did not find out how I can test the plugin (tied it with master) but was not able to install my fork into my homebridge. The way hombridge has described to test in vevelopment: npm link did not work, and I could not figure out how to do it with yarn... yet But I have build error now anyway, so no stress with that xD

johannrichard commented 1 year ago

The way hombridge has described to test in vevelopment: npm link did not work, and I could not figure out how to do it with yarn... yet

Since the modules are managed with yarn, you must have all the relevant commands be preceded by yarn. There's a run script called debug in package.json that will do all the necessary for you (except for linking with npm link):

$ yarn run debug

That should compile the plug-in, and then homebridge so that it's aware of the plug-in.

johannrichard commented 1 year ago

There's update documentation on how to add and configure the Button+ in the Wiki.

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 3.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: