Announcement

Collapse
No announcement yet.

Hacking the Wink hub V1 to work with Homeseer via MSCMQTT

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Hacking the Wink hub V1 to work with Homeseer via MSCMQTT

    EDIT: The top of this post was written after finishing this project to serve as a guide for anyone googling 'use wink hub with homeseer'.

    The notes below and subsequent posts are part of the design, build, debug, etc process as I was finishing up this project.

    If you have a Wink hub V1 and are looking to make use of it with Homeseer then this guide is for you.

    Project difficulty: 8 out of 10
    Some hardware/software technical skill is required as well as basic soldering skills and basic command prompt skills. Knowledge of serial port use and putty terminal windows, command line editing, and homeseer plugin configuration as well.

    I take no responsibility if you brick your hub, break something beyond repair, burn yourself, or otherwise have a bad time with this project.

    By hacking your wink hub you will gain access to the device directly at its operating system level and be able to take control of the 4 built in radios in it and use them with homeseer to control devices.

    The wink hub will essentially become a radio transmitter capable of making use of its Zwave, Zigbee, Lutron, and Kidde radios on board.

    If your hub already had some of your devices paired to it internally then moving them over to homeseer is easier than if there are no devices in the hubs database.

    In my case I already had 3 Lutron Caseta dimmers paired to the hub and could just use them once I had the hub working with MQTT.

    How it works:

    The wink hub must be rooted. This requires physically opening the device and doing some hardware modifications. Basic soldering skills are probably required although it is possible to do it without soldering if your careful and lucky and get a good connection to the board without soldering a header on to the UART port.

    Click image for larger version

Name:	PXL_20210215_195211141_2.jpg
Views:	1735
Size:	171.0 KB
ID:	1456427

    Click image for larger version

Name:	PXL_20210215_195309152.jpg
Views:	1649
Size:	86.4 KB
ID:	1456428

    Once you have root you will change the root password and reconfigure it so that you can get root again without having to open the device. SSH can be configured but I wasn't personally able to get SSH enabled. I access the device over serial port when I need to which is almost never once the devices I wanted to control are setup it's hands off.

    You will need the following items to complete this project:

    1. FREE: The free mcsMQTT plugin
    2. $5-15: A TTL to USB serial adapter for your PC. I got mine on aliexpress for about $5. You can also get them on amazon for around $15 but arrive faster.
    3. $5: A cable to connect the TTL to USB adapter board to your PC. Probably a mini usb or micro usb. Mine was mini (the old, larger style)
    4. $1-5: A set of header wires to connect the serial adapter board to the UART port of the wink hub
    5. FREE: minicom software if on linux or mac OS, putty software if you are on windows 10.

    Total project cost is about $20 at most.

    Optional: a small 4 pin header you solder on the wink hub to make it easy to reconnect to the device later

    Information on rooting the winkhub is available at the following links:

    https://www.mattcarrier.com/post/hac...inkhub-part-1/
    https://forum.xda-developers.com/t/w...#post-64090433

    aprontest command reference (the binary inside wink that controls everything that mqtt will interface with)
    https://forum.xda-developers.com/t/w...#post-58352289

    The mqtt software that will run on wink once you root it. This is what brings the aprontest binary in wink together with mcsMQTT so that homeseer can control the hub and its devices.
    https://github.com/mikekap/wink-mqtt-rs

    The steps to complete the project:

    1. Root the hub. Follow the guides in the links above to gain root access, change the root password, and optionally gain SSH access. Make sure you do the part on gaining permanent root on reboot.

    2. Install wink-mqtt-rs on the wink hub. Follow the guide posted above on github for installing this software, its got a walkthrough for the step by step installer.

    3. Configure the MQTT topics with homeseer and setup the homeseeer devices. See some of the posts following this on how I setup my Lutron lights as Homeseer devices with mcsMQTT.

    Any device you want to control with the wink hub MUST be already paired with the hub and in its database. Once you have wink-mqtt-rs installed and running there will be a webserver running on the hub that you can open in your browser and run aprontest commands from to control devices that are paired with the hub to prototype before going through the mqtt setup to verify the devices are paired and that the hub can control them. You can add or pair devices from this web page with the aprontest command line. See the reference guide link above for aprontest commands to list the devices paired, add new ones, and control devices.

    Enjoy your locally controlled wink hub with no reliance on monthly subscriptions and external servers and services that could go down at anytime, bricking your home.

    Initial post that started the project off is preserved below here -----------------------------------------------------------------------------

    I've been working on getting my Wink Hub V1 rooted for a while to try to gain access to the lutron radio transmitter that is onboard the hub and I'm at the point where I'm trying to setup the right publish topic to control the devices attached to it.

    The Wink hub has built in radios for Lutron, Kidde, Zwave, and Zigbee, as well as bluetooth and wifi. Now that Wink is essentially dead, This project is to make use of the hubs radios locally through homeseer.

    I've rooted the hub, installed wink-mqtt-rs (https://github.com/mikekap/wink-mqtt-rs), and its up and running and I can from a command line turn my Lutron lights on and off so I know its working with the lights.

    The final step is setting up the mqtt publish route correctly.

    Every other device I've worked with uses a topic of the form x/y/z but the wink-mqtt-rs publish routes use a json payload in the form of x/y/z:data

    I'm not quite sure what should be my publish route given the following information
    Click image for larger version  Name:	wink-rs 2.PNG Views:	57 Size:	194.9 KB ID:	1455753

    device 3 is one of my lutron caeseta lights, which has value 0 for off and 255 for fully on and in between is the dimmable range. Valid values are 0 -> 255

    Info on wink-mqtt-rs says to receive messages (Ie send from homeseer TO wink hub to then pass to the lights internally,

    Click image for larger version  Name:	wink-rs.PNG Views:	37 Size:	40.9 KB ID:	1455754

    I'm not quite sure how to setup the device 371 above to work with this format or what the pub link should be

    I've tried

    /home/wink/3
    /home/wink/3/status
    /home/wink/3/status:Level

    And I've tried making the HS device have a button, slider, and number value. If I change the light to on or off manually at the wall I get 0 or 255 as the state of the device in homeseer but I cant publish out changes to the light from homeseer to the hub yet.

    #2
    The MQTT message that you have associated with HS device 371 is
    Code:
    subscription topic home/wink/3/status 
    subscription payload  {"level":255}
    To control the level you will use the following. Note the pub template can be specified on the Edit tab (click the 371 button from Association tab)
    Code:
    publication topic home/wink/3/set
    publication template {"level":$$VALUE:}
    With something having a range of values between 0 and 255 you can use a number text box or a slider as the Control/Status UI. This is also on the Edit tab. If you use the slider, then you will also need to use the Expression (also on Edit tab) because mcsMQTT slider is a percentage value between 0 and 100. If you use number then no additional changes are needed as the payload will go into HS device with range of 0 to 255.

    Code:
    expression $$PAYLOAD:/2.55
    publication template {"level":<<$$VALUE:*2.55>>}

    Comment


      #3
      Nice!

      Almost there. A couple notes:

      1. I had to use "Level" for the object attribute not "level" and then it would work with a number UI widget but slider would have the problem of not going above 100 (medium brightness. makes sense as 100 would be sent as the int for 100 % setting the brightness to 100 / 255, about 40% brightness)

      2. trying the code you posted to scale the 0-100% into a 0-255 value almost works but it gave me issues going up and down the scale. setting it to 40 might revert it to 10 and set brightness to 10. It was weird and then I realized the math to convert on the publish will probably be passing a float with a decimal right?

      Can I cast it to an int in the 'Publish Payload Template' box somehow? will it accept functions to cast to an int? which language is it using in this box? Javascript or c# or something?

      The aprontest binary inside the Wink hub that controls all the devices specifies in the database that stores the values of each devices attributes that the value is a UINT8 so its probably getting confused when I'm sending it a float via json. When I use a number field and send it any proper int in the text entry from 0 to 255 it works fine and if I send it a 256 it overflows the 8 bit integer and stores a 0 which probably means whatever a float of 45.298376 ends up casting to in storage for a UINT8 after overflows is what is saved.

      the incoming expression ''$$PAYLOAD:/2.55" works fine for converting a range of 0-255 into a 0-100 for the percentage and displaying on the UI.

      it's just publishing a change that needs to be an integer.

      Click image for larger version  Name:	wink-rs 3.PNG Views:	0 Size:	58.2 KB ID:	1455875

      Comment


        #4
        another clue it has to be an int. i just used the number 2 instead of 2.55 to scale the slider from 0-200 and guarantee a int as its just doubling and halfing values sending and receiving and it works i just dont get full real brightness.

        So if i can cast to int on the publish it should work perfect

        Comment


          #5
          There is a table in the mcsMQTT.pdf document that shows all available expression functions. To remove the fractional part use ROUND(x,0) where x is the prior expression that has the float value.

          Expressions are implemented as an interpreter because it is done at run time rather than compile time. The interpreter was written in vb.net.

          Comment


            #6
            Got it!

            took some fiddling with the order of the brackets and the function.

            first i tried
            Code:
            {"Level":Round(<<$$VALUE:*2.55>>,0)}
            and it didnt work so i tried the function inside the << >> and it works

            This works (for other viewers):
            Code:
            {"Level":<<Round($$VALUE:*2.55,0)>>}
            Click image for larger version

Name:	wink-rs 4.PNG
Views:	1576
Size:	15.7 KB
ID:	1456017

            Is it possible to have an OFF and ON button as well as the slider to make it easy to quickly turn the light fully on or fully off and a simmer slider as a choice for dimming?

            Comment


              #7
              Take a look at Section 4.1.30 of the mcsMQTT manual to see if it does what you want. If it does not then we will figure out what needs to be done to accomplish your objective.

              The << and >> are used to designate an inline expression so all expression elements needs to be contained within these "escape" markers.

              Comment


                #8
                I read through that section and I see the parallel to a dimmer with 0 off, 100 on, and 0 -> 100 the dimmer range.

                I got lost a bit with the VSP part but I realized all i have to do is in the device settings under status is setup 2 more buttons with values of 0 for off and 100 for on each.

                There is already a slider for 0-100 range so it will not let me create a single value of 0 for the off button but i can create a single value of 100 for the on button
                so i changed the slider range from 1 to 100 and created a 0 for off and 100 for on and then set the row and col accordingly to arrange them

                Click image for larger version

Name:	wink-rs 5.PNG
Views:	1652
Size:	17.6 KB
ID:	1456238
                Click image for larger version

Name:	wink-rs 6.PNG
Views:	1562
Size:	121.7 KB
ID:	1456239
                When I clicked on or off the first couple times it didnt seem to register but them I refreshed the devices page and clicked on then off and it then started updating the slider to match the state. I can now click anywhere on teh slider to dim or tap off or on to go full on or off.

                A minor bug is that sliding the slider all the way to the left is actually a value of 1 or 2.55% light level, not actually off. theres also no light icon in the tile for on or off and I'm not sure if this will work with google home voice commands either yet.

                But so far this is really great to have been able to completely reuse the Wink hub as a local lan control lutron/zwave/zigbee/kidde radio transmitter. I already have zwave and zigbee on my HS server but having lutron now and kidde is nice. In theory I could add more lutron lights although it would be tricky to add them into the wink hub database to control them, it is possible once rooted with wink-rs-mqtt installed.

                Going to finish this project up, get the hub reassembled back in its box, and go back to working on the sonoff plugs again.

                Comment


                  #9
                  I believe it is important that mcsMQTT is aware of the VSP definition with the On and Off topic being a Toggle type and the dimmer being a Slider type. If it is working as it is now for you then great. If not then revisit the Edit tab definition of the topic that drives the On and Off states of the device.

                  Comment


                    #10
                    the VSP feature itself isnt really clear to me. is it some kind of mapping of what values coming in on the topic equal what values for the device. like if a device needs 0 for off and 1 for on but the topic sends a string "on" or "off" the VSP would convert it to 0 and 1 for the HS device status/graphics part?

                    Comment


                      #11
                      Yes it is a text to number mapping so you can trigger events based upon the number while still showing status that is the text. mcsMQTT Control/Status UI of List, Button and Toggle use the VSP mappings when bridging MQTT to HS.

                      Comment


                        #12
                        Ah I see. That explains why I can only edit the VSP when the device UI type is set to button, etc. So far it's working well for me.

                        I now have all 3 Lutron lights setup as devices, they work on homeseer mobile perfectly, they update when i use the physical buttons on the wall for the switches, and Google Home works with the devices and loads them in. Voice commands also work.

                        Coincidentally I found a Homeseer/MQTT bug where if 2 lights are named different but have the same name for the feature and you add them to google home only 1 device will show up and the other is missing. Renaming the feature, and then asking google home to 'sync my devices' added the second light and I could then rename it, and put it in the proper room.

                        Click image for larger version  Name:	Screenshot_20210215-130640.png Views:	0 Size:	210.2 KB ID:	1456399

                        Click image for larger version  Name:	wink-rs 7.PNG Views:	0 Size:	75.9 KB ID:	1456400

                        Comment


                          #13
                          I've now rewritten the original post as a guide to completing this project and the steps it entails for people who stumble upon here in the future.

                          Comment


                            #14
                            Noticed these are selling on Ebay:

                            Wink PRLAY-WHO1 - wall-mounted/controller Ebay Item # 193746420969

                            Wrote to seller and he said these are WInk Relay V2. Will these work?

                            Well purchased it anyways and will give it a try.
                            - Pete

                            Auto mator
                            Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
                            Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
                            HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

                            HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
                            HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

                            X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

                            Comment

                            Working...
                            X