Closed lawrence-jeff closed 6 years ago
Ah, interesting. Thanks for investigating. I wonder if a firmware update on my devices will update the service. I'll see about incorporating it into the code so that both versions are supported.
Do all the functions (status, toggle, battery-level) work once you change the service in the code?
I'm going to give that a try later today and I will let you know how I make out.
On Sat, Sep 15, 2018, 12:32 AM Brian Peiris notifications@github.com wrote:
Ah, interesting. Thanks for investigating. I wonder if a firmware update on my devices will update the service. I'll see about incorporating it into the code so that both versions are supported.
Do all the functions (status, toggle, battery-level) work once you change the service in the code?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/brianpeiris/switchmate/issues/13#issuecomment-421530034, or mute the thread https://github.com/notifications/unsubscribe-auth/AkOsJoYJ-COm-Ks5mk1gdhRV9aZ_pHGAks5ubILmgaJpZM4WqLih .
Yes - I went back and tested all the functions and they work correctly. I figured I would grab the debug output while I had it in case it helps.
pi@raspberrypi:~/switchmate $ sudo python switchmate.py e2:4e:9a:7a:ca:a6 debug Retrieving debug info... uuid common name handle properties value
00002a00-0000-1000-8000-00805f9b34fb Device Name 3 READ WRITE beacon 00002a01-0000-1000-8000-00805f9b34fb Appearance 5 READ 0000 00002a04-0000-1000-8000-00805f9b34fb Peripheral Preferred Connection Parameters 7 READ 5000a00000009001 00002a05-0000-1000-8000-00805f9b34fb Service Changed a INDICATE 5000a00000009001 00002a19-0000-1000-8000-00805f9b34fb Battery Level e NOTIFY READ d 00002a29-0000-1000-8000-00805f9b34fb Manufacturer Name String 12 READ Switchmate 00002a24-0000-1000-8000-00805f9b34fb Model Number String 14 READ Original 00002a27-0000-1000-8000-00805f9b34fb Hardware Revision String 16 READ 2.0 00002a26-0000-1000-8000-00805f9b34fb Firmware Revision String 18 READ 2.99.18 00002a23-0000-1000-8000-00805f9b34fb System ID 1a READ 55aa55aa55eebbee a22b0010-ebdd-49ac-b2e7-40eb55f5d0ab a22b0010-ebdd-49ac-b2e7-40eb55f5d0ab 1d READ WRITE 0c392c05 a22b0020-ebdd-49ac-b2e7-40eb55f5d0ab a22b0020-ebdd-49ac-b2e7-40eb55f5d0ab 1f READ WRITE 0004001c0000 a22b0030-ebdd-49ac-b2e7-40eb55f5d0ab a22b0030-ebdd-49ac-b2e7-40eb55f5d0ab 21 READ WRITE 0004001c0000 a22b0040-ebdd-49ac-b2e7-40eb55f5d0ab a22b0040-ebdd-49ac-b2e7-40eb55f5d0ab 23 READ WRITE 000000000000 a22b0050-ebdd-49ac-b2e7-40eb55f5d0ab a22b0050-ebdd-49ac-b2e7-40eb55f5d0ab 25 READ WRITE 0000000000000000000000000000000000 a22b0060-ebdd-49ac-b2e7-40eb55f5d0ab a22b0060-ebdd-49ac-b2e7-40eb55f5d0ab 27 READ WRITE 00 a22b0070-ebdd-49ac-b2e7-40eb55f5d0ab a22b0070-ebdd-49ac-b2e7-40eb55f5d0ab 29 NOTIFY READ 00000000 a22b0080-ebdd-49ac-b2e7-40eb55f5d0ab a22b0080-ebdd-49ac-b2e7-40eb55f5d0ab 2c READ WRITE 00 a22b0090-ebdd-49ac-b2e7-40eb55f5d0ab a22b0090-ebdd-49ac-b2e7-40eb55f5d0ab 2e READ WRITE 00 a22b0200-ebdd-49ac-b2e7-40eb55f5d0ab a22b0200-ebdd-49ac-b2e7-40eb55f5d0ab 30 READ a6ca7a9a4ee2 a22b0210-ebdd-49ac-b2e7-40eb55f5d0ab a22b0210-ebdd-49ac-b2e7-40eb55f5d0ab 32 READ da6773eb27b8 a22b0220-ebdd-49ac-b2e7-40eb55f5d0ab a22b0220-ebdd-49ac-b2e7-40eb55f5d0ab 34 READ af0e22110040be39429f0c4f9cceab7b a22b0230-ebdd-49ac-b2e7-40eb55f5d0ab a22b0230-ebdd-49ac-b2e7-40eb55f5d0ab 36 READ WRITE 00000000000000000000000000000000 00001532-1212-efde-1523-785feabcd123 00001532-1212-efde-1523-785feabcd123 39 WRITE NO RESPONSE 00000000000000000000000000000000 00001531-1212-efde-1523-785feabcd123 00001531-1212-efde-1523-785feabcd123 3b NOTIFY WRITE 00000000000000000000000000000000 00001534-1212-efde-1523-785feabcd123 00001534-1212-efde-1523-785feabcd123 3e READ 0100
oh, heh, I just realized that those are technically the same service id. They are just two different representations, where the second is just reversed byte order. It's very strange that one would work and not the other. Something else may be going on here.
ab d0 f5 55 eb 40 e7 b2 ac 49 dd eb 83 d3 2b a2 a2 2b d3 83 eb dd 49 ac b2 e7 40 eb 55 f5 d0 ab
Is it possibly because I am using the latest bluepy - and not the older one in your dependencies file?
@lawrence-jeff Yup, bluepy 1.2.0 returns a reversed uuid now. (This is the correct order, according to the related issue in their repo). Is there a reason you decided to use a newer version of bluepy?
Actually, I think I'm just going to update the bluepy dependency. I suspect it's going to fix @rotcop4u2's issue in #12 as well.
For reference, here's some investigation I did while I was at it:
I have a Switchmate Bright device and a Switchmate Original (a.k.a "Light") device. I've tested in both python 2 and python 3
I had an update available for the Bright device. It took it from firmware version 2.9.15 to version 3.1.1. There was no update available for the Original device, it is still at firmware version 2.99.18.
After upgrading bluepy from 1.0.5 to 1.2.0 and fixing the service UUID order, all script functions work, even with the new Bright firmware.
Tested the new version -working great! Thanks for your work on this!
You will probably get a lot more interest on this repo with Lowes clearance'ing these out. Have you ever investigated talking to the outlet over wifi - it can then relay cmds to the switches over bluetooth allowing you to access everything via wifi. Getting that working would make these a much more open system and you wouldn't need to worry about a pi in bluetooth range for every switch
@lawrence-jeff Yup, bluepy 1.2.0 returns a reversed uuid now. (This is the correct order, according to the related issue in their repo). Is there a reason you decided to use a newer version of bluepy?
Slightly embarrassing but I didn't know you could point pip to a file like that until I saw the other issue, I just opened the file saw the components and 'pip'd' them by name and in that process got the latest versions
That is the setup I have now.. I bough the outlet and 2 light switch kits because of the Lowe's discount as a tryout so I don't have to open up and modify my switches to use with the sonoffs.. but the sonoffs use wifi and can communicate via mqtt (which in turn) is alot faster of a response. Have anyone been having the issue of the switchmate turning themselves back on/off after commanding them via Google Assistant commands?
On Sat, Sep 15, 2018, 10:29 PM lawrence-jeff notifications@github.com wrote:
Tested the new version -working great! Thanks for your work on this!
You will probably get a lot more interest on this repo with Lowes clearance'ing these out. Have you ever investigated talking to the outlet over wifi - it can then relay cmds to the switches over bluetooth allowing you to access everything via wifi. Getting that working would make these a much more open system and you wouldn't need to worry about a pi in bluetooth range for every switch
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/brianpeiris/switchmate/issues/13#issuecomment-421675241, or mute the thread https://github.com/notifications/unsubscribe-auth/AkOsJmbNwUTvYngURi6fyr8bjK5q8Fh-ks5ubbdvgaJpZM4WqLih .
@lawrence-jeff Glad to hear it works now. I didn't know that the outlet device connects over wifi, interesting. I don't have much use for an outlet device, personally, but we'll see if there's more demand for that capability. Of course, pull requests are always welcome :)
@rotcop4u2 Not sure what's going on there. If you think it could be a problem with this script, please open a new issue.
I'm going to call this one closed. Thanks!
To save anyone else some time it appears the outlet makes an outgoing secure MQTT connection to an amazon web server.. it doesn't appear to run a server that accepts local requests from the home network. The app must make a connection to the same broker to control the outlets... I guess this means if the company goes out of business and that server goes down the wifi functions will no longer work ... I hate crap like this.
With my brand new switchmates - i had to change the service identifier in the code. This works for my devices (upgraded to the latest bluetooth firmware) (I guess it could be a difference in how the value is pulled from bluepy or something - I have the latest version of all dependencies installed)
Didn't work
SWITCHMATE_SERVICE = 'abd0f555eb40e7b2ac49ddeb83d32ba2'
Works SWITCHMATE_SERVICE = 'a22bd383-ebdd-49ac-b2e7-40eb55f5d0ab'