Closed kevinjohncutler closed 4 years ago
There is no logic for dimmers currently in my code. I don't know what the protocol is at the moment. What you can do to help me add that logic is allow me to connect to your device and test it VIA wireshark. Alternatively you can use wireshark and some android emulator to tell me the protocol yourself.
With my help you can do it this way:
What to do next: In order for me to view your controller, I'll need you to complete the following steps:
1. Sign into my throwaway MagicHome account in your MagicHome "Pro" app
#### Username ``` magic.home.test@gmail.com ``` #### Password ``` testmagichome ```
2. Enable remote control for your device on that account
3. Change the color of my office light to red and then post here to let me know you're ready
4. Give me time to test your device
Sorry for the delay, had to go into work. I've followed the above steps. If you get a chance, I'd love to know briefly how I'd use wireshark, but I imagine it is along the lines of installing and signing into magic home on an emulated andoind device and grabbing the right logs from wireshark.
I noticed that after the "office light" was turned red it was turned off, so I'll play it safe and not keep toggling your light haha. Feel free to fiddle with it whenever, the device is just controlling some plant lighting right now. Thank you for your help.
@kevinjohncutler Hey, thanks for doing that. I can now see your light. Just as you predicted, I will use an android emulator and look for the packets sent to the magichome server.
It's great because it uses the same protocol regardless of using local intranet or internet.
I'll be re-installing bluestacks now as I removed it from my system as I don't really trust it. I'll let you know once I have the data I need. Once that's done you should sign out of my account. But not yet.
Should have results tonight.
@kevinjohncutler Okay so I've determined the protocol. Now I need a way of detecting its version. Can you please upload your homebridge.log. It should have the information I need. You said the device registers.
Actually I think I've got it. But correct me if I'm wrong. The "lightVersionModifier" is listed as '33' correct?
Looking for that now, will get it ASAP.
Sorry it is taking a while, I could not find that in the existing log, even after restarting homebridge, so I'm trying a reboot.
Yep, Version Modifier is 33!
Nailed it. Okay I think I'm nearly ready.
The code is complete, uploaded, and merged with the master branch. But npm refuses to let me publish it. I have no idea why.
Here is the error... too tired to troubleshoot it right now. I'm sorry.
npm ERR! code E404 npm ERR! 404 Not Found - PUT https://registry.npmjs.org/homebridge-magichome-dynamic-platform - Not found npm ERR! 404 npm ERR! 404 'homebridge-magichome-dynamic-platform@1.3.0' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
If you'd like, you can download and compile the code yourself. It's uploaded... Will work on it further tomorrow.
@kevinjohncutler scratch that. NPM decided I wasn't logged in anymore?
First delete your cached accessories if possible. Otherwise the dimmer will be of the wrong type. Then please update the plugin in config ui x, restart homebridge, and test it out. Let me know how it goes!
Thanks for working so late on this! I knocked out at 1 haha.
I didn't see your most recent comments, so I updated and restarted homebridge first, realized it wasn't working, then removed all cached devices and restarted. It wasn't finding all the devices (four bulbs and one of these LED wifi controllers), and so I uninstalled your plugin, restarted, then reinstalled+restarted. It now finds all 4 bulbs (though curiously only one is registered as RBGWW, others as RBGW... I guess that is 53 vs 68 in the logs? They should be identical.), but the LED controller no longer registers after it is found.
Here is the relevant part of the log. I imagine the error at the bottom will be useful.
[8/5/2020, 17:24:08] [homebridge-magichome-dynamic-platform] Found 5 devices.
[TuyaDiscovery] UDP from 192.168.1.20:6667 0x000055aa...0x0000aa55 [8/5/2020, 17:24:08] [TuyaLan] Discovered Entry Light (eb8d6215d6f7765a3bslfr) identified as SimpleLight (3.3) [TuyaAccessory] Changing ping gap for Entry Light to 9s HAP Warning: Characteristic 000000E3-0000-1000-8000-0026BB765291 not in required or optional characteristics for service 00000043-0000-1000-8000-0026BB765291. Adding anyway. [8/5/2020, 17:24:09] [homebridge-magichome-dynamic-platform] Registering new accessory 'RGBW Non-Simultanious' Model: 'AK001-ZJ200' Unique ID: '600194B374F1' IP-Address: '192.168.1.18' Version 8 Version Modifier: 68
[8/5/2020, 17:24:09] [TuyaLan] Connected to Entry Light [TuyaAccessory] Sending first query to Entry Light (3.3) HAP Warning: Characteristic 000000E3-0000-1000-8000-0026BB765291 not in required or optional characteristics for service 00000043-0000-1000-8000-0026BB765291. Adding anyway. [8/5/2020, 17:24:09] [homebridge-magichome-dynamic-platform] Registering new accessory 'RGBWW Non-Simultanious' Model: 'AK001-ZJ200' Unique ID: '600194B3B472' IP-Address: '192.168.1.16' Version 5 Version Modifier: 53
HAP Warning: Characteristic 000000E3-0000-1000-8000-0026BB765291 not in required or optional characteristics for service 00000043-0000-1000-8000-0026BB765291. Adding anyway. [8/5/2020, 17:24:09] [homebridge-magichome-dynamic-platform] Registering new accessory 'RGBW Non-Simultanious' Model: 'AK001-ZJ200' Unique ID: '600194B3BB90' IP-Address: '192.168.1.19' Version 8 Version Modifier: 68
[TuyaAccessory] Entry Light (3.3) didn't respond with its current state. [8/5/2020, 17:24:10] [TuyaLan] Ready to handle Entry Light (SimpleLight:3.3) with signature {} HAP Warning: Characteristic 000000E3-0000-1000-8000-0026BB765291 not in required or optional characteristics for service 00000043-0000-1000-8000-0026BB765291. Adding anyway. [8/5/2020, 17:24:10] [homebridge-magichome-dynamic-platform] Registering new accessory 'RGBW Non-Simultanious' Model: 'AK001-ZJ200' Unique ID: '600194B37558' IP-Address: '192.168.1.17' Version 8 Version Modifier: 68
[8/5/2020, 17:24:10] [homebridge-magichome-dynamic-platform] TypeError: accessoryType[updatedDevice.controller] is not a constructor at HomebridgeMagichomeDynamicPlatform.discoverDevices (/usr/lib/node_modules/homebridge-magichome-dynamic-platform/src/platform.ts:245:11) at processTicksAndRejections (internal/process/task_queues.js:97:5) [8/5/2020, 17:24:10] [homebridge-magichome-dynamic-platform] Registered 4 Magichome device(s). New devices: 4 Cached devices that were seen this restart: 0 Cached devices that were not seen this restart: 0
This log indicates it could be the second restart after deleting the accessories since I am missing some information.
Could you help me out by doing the following: rename your Homebridge.log to Homebridge.log.old > delete the accessories folder > restart Homebridge > upload that new log
Hopefully this will shed some more light, but it's as if it doesn't know what device type it is.
Edit* please upload your log or an edited version of your log instead of pasting directly into the text editor.
As for your RGBWW device, in the magichome app does the color wheel show warm white and cold white in the center for that device?
Interesting - now that I've done that, it has registered as a RGBWW device. Here is the log:
As to the RGBW vs RGBWW topic, the magichome app does indeed show warm white as well as cold white inside the color when for each of these (identical) bulbs. However, only the Three that hsow up as RGBW are behaving "as normal" - Which makes sense, because it turns out that these bulbs only have dedicated white LEDs for the warm white setting, and use the RGB array for the cool white. The one registered as RGBWW is unresponsive to homekit commands to change color.
The single-color LED controller that is showing up as RGBWW also only works for power and dimming when its 'color' in homekit is changed to red, I'm guessing because it is monochrome and the first channel.
[8/5/2020, 19:22:38] [homebridge-magichome-dynamic-platform] Registering cached accessory 'RGBWW Simultanious' Model: 'AK001-ZJ2101' Unique ID: 'D8F15BF6C69A' IP-Address: '192.168.1.67' Version 2 Version Modifier: 33
The version modifier is 33. There is logic to set the light type but it's as if it's skipping that part of the code.
Registered 5 Magichome device(s). New devices: 0 Cached devices that were seen this restart: 5 Cached devices that were not seen this restart: 0
This indicates that this is not the first restart since deleting the accessories as there are 0 new devices. Ensure that you are deleting the actual accessories folder instead of using ui x's built in UI.
I've updated the code with better logging and a slight change in the way the "lightType" is set. Updating may help shed some light.
enable debugging in config UI X > update homebridge-magichome-dynamic-platform > delete /rename log > delete accessories folder > restart homebridge
Hopefully this will have a better result. If not, please @Zacknetic in the Magichome development discord channel and we can coordinate a good time to work on this together.
Ok, so I removed the plugin, refreshed homebridge, deleted the accessories and renamed the log, re-installed the latest version of the plugin, and instead of restarting homebridge from the UI (it seems not to be able to create a new log file that way for some reason) I restarted the pi on which homebridge is running. Here is the resulting log when it all starts fresh. Evidently all five devices are found, but only two are registered.
Dimmer controller feature was completed by adding new logic and changing the base "platformAccessory" class to only include On/Off and Brightness characteristics. Closing issue as feature is complete. Thank you very much!
Hi, I decided to try out these single color wifi controllers and your plugin detects and adds them automatically, but does not seem to recognize that they are single color, essentially a dimmer. So in the Home app, I see options for choosing various colors like an RGB(W(W)) bulb, and the intensity slider has no effect. In Magic Home, there is a brightness annulus to adjust the intensity (idk why not a slider...). I imagine homekit must have a dimmer functionality built-in, and I just need to configure the right protocol for these devices. Any idea where I should start?