Sort of looks like my problem, though I am not dealing with VPN and everything is on a local network.
Am surprised that it works for you and not for others and hence the questions about config etc.
I’m also surprised - makes me wonder if there’s something elsewhere in the rooting/config of the relay that’s at issue rather than wink-mqtt. Did you totally disable all Wink services on the device? I did, except for edisonwink.
I believe I have disabled all Wink services. One thing though, I have kingroot running wondering if that makes a difference.
I also have kingroot running. I am wondering though if there’s something on your relay preventing a reconnection…
Looking at logs but not seeing anything specific to MQTT, do you know if the handler program writes any logs? Also, its been a while since I programmed, but what tools do I need to install to make the wink-handler tool? Just the NDK? thanks
It looks like the repo was updated with direct/local switch control, which at least makes it usable when the connection fails/drops. Does anyone have a compiled binary of the latest?
EDIT: Nevermind, the author is published it also.
Sorry to high jack the thread, but I’m curious why people lose control of the physical switches on the relay without the mqtt relay. Are you using a different method than the “home screen hack” where you escape to the home screen by covering the pir and pressing the bottom switch? I did that and retained access without any issues. If your using another method, why?
Hello @marthocoo and @Woodsmith Im hoping one of you two can help me out here.
I finally started my migration from Smartthings to HASS. Running on Hass.io right now.
In truth reading this post is what finally made me pull the plug on it, as the Wink Relay has been a pain in my ass for far too long.
I ran the instructions posted by the original author of the MQTT Wink Relay Handler Github.
Noticed a message early on in my logs indicating that it detected the wink, but I cant get a damn thing to work here in HASS.
Relevant bits of my mqtt.ini sitting on the wink.
host=192.168.86.10
port=1883
user=myusername
password=mypass
clientid=wink_foyer
topic_prefix=foyer
screen_timeout=10
switch_toggle=true
send_switch=true
I started with Woodsmith’s approach, let me know if you see anything wrong.
The switches of course show up in the HASS UI, but they dont do anything.
Same goes for the Sensors.
mqtt:
broker: core-mosquitto
username: myusername
password: mypass
switch:
- platform: mqtt
name: "Front Porch Light"
state_topic: "wink_foyer/relays/upper_state"
command_topic: "wink_foyer/relays/upper"
payload_on: "ON"
payload_off: "OFF"
- platform: mqtt
name: "Foyer Light"
state_topic: "wink_foyer/relays/lower_state"
command_topic: "wink_foyer/relays/lower"
payload_on: "ON"
payload_off: "OFF"
sensor:
- platform: mqtt
state_topic: "wink_foyer/sensors/temperature"
name: "Foyer Temperature"
expire_after: 1200
value_template: '{{(float(value) * 9 / 5 + 32) | round(1)}}'
unit_of_measurement: "°F"
- platform: mqtt
state_topic: "wink_foyer/sensors/humidity"
name: "Foyer Humidity"
expire_after: 1200
value_template: '{{value | round(0) | int}}'
unit_of_measurement: "%"
binary_sensor:
- platform: mqtt
name: "Foyer Upper Button"
state_topic: "wink_foyer/switches/upper"
expire_after: 12
payload_on: 'on'
- platform: mqtt
name: "Foyer Lower Button"
state_topic: "wink_foyer/switches/lower"
expire_after: 12
payload_on: 'on'
First step in debugging is to check that the Wink Relay is actually sending messages. You’ll need a separate mqtt client on another computer to test this. If you have a Linux machine handy, you can install the package mosquitto-clients (at least you can on Debian variants).
This will give you access to mosquitto_sub, which you can run like this to subscribe to all topics:
mosquitto_sub -h 192.168.86.10 -u myusername -P mypassword -t “#” -v
That will print out any message that the broker receives while you’re connected. So now press WR buttons etc and see if you are getting output to the terminal. If so, then you can see the exact topic and payload being published. Do the same with your toggle switches in HA. If the WR is really connected, you’ll also start getting temp and humidity readings coming in.
That’s the first step. It will verify that your broker is working properly and that your devices are connected to it.
Hey @marthocoo , thanks for the reply.
I dont have a box running Linux at the moment.
I could always throw together a VM, but figured Id ask if you know of an equivalent I can run from my Android phone?
Edit: Gave MQTT Snooper at try.
It shows Im connected to 192.168.86.10:1883, but I dont see anything when I click the buttons on the WR or the switches in the HASS UI.
I can see in the Mosquitto Broker plugin logs that the snooper is connecting and the WR.
I just dont see any activity past that.
You’ve probably not subscribed to any topics? Try subscribing to “#”.
Tried subscribing to # as well, still not seeing anything.
Any other thoughts
Seems to me that you aren’t subscribed to the broker properly on your client. Also do the broker logs show Home assistant connecting to Mosquitto? That’s obviously an important step. But if the WR is connecting you should still see messages coming in.
Sorry still working my way through all of this.
I had an instance of HASS running on my Unraid machine as a docker.
Unraid had another MQTT docker running as the broker and then the Smartthings bridge running as yet another docker in unraid. This was all working fine back when I was using it.
This was the entry in the configuration.yaml for that other version of HASS. IVe been trying to compaire the two to see if I can work this out.
mqtt: broker: 192.168.86.2 port: 1883 client_id: home-assistant-1 discovery: true discovery_prefix: smartthings
I am now running HASS.IO on a raspberry PI, so Mosquito is being installed as a docker (plugin) inside of HASS.IO.
As noted above the entry in my HASS.IO configuration.yaml file is as follows.
mqtt:
broker: core-mosquitto
username: myusername
password: mypass
Should I be adding a discovery entry or the like?
I have a feeling I am overlooking something simple that I will feel foolish about.
What are the MQTT username and password settings in the Mosquitto addon? Do they match myusername and mypass in configuration.yaml? Try not using a username and password and see if HA will connect to the broker? Let’s work our way up here lol.
SUCCESS!!!
Im pretty sure the issue was that I didn’t have the discovery and discovery_prefix setup correctly under the mqtt entry in the configuration.yaml file, and I was using the wrong entry name in the topics.
Im going to leave my settings in here just in case anyone else has any questions about the setup.
**#Broker Options for the Hass.io Mosquitto Plugin**
{
"plain": true,
"ssl": false,
"anonymous": false,
"logins": [
{"username": "myusername", "password": "mypass"}
],
"customize": {
"active": false,
"folder": "mosquitto"
},
"certfile": "fullchain.pem",
"keyfile": "privkey.pem"
}
**#Mqtt.ini**
host=192.168.86.10
port=1883
user=myusername
password=mypass
clientid=wink_foyer
topic_prefix=foyer
screen_timeout=10
switch_toggle=true
send_switch=true
**#Configuration.yaml Broker Entry**
mqtt:
broker: core-mosquitto
username: myusername
password: mypass
discovery: true
discovery_prefix: foyer
**#Configuration.yaml Sensory and Switch entries**
sensor:
- platform: mqtt
state_topic: "foyer/sensors/temperature"
name: "Foyer Temperature"
expire_after: 1200
value_template: '{{(float(value) * 9 / 5 + 32) | round(1)}}'
unit_of_measurement: "°F"
- platform: mqtt
state_topic: "foyer/sensors/humidity"
name: "Foyer Humidity"
expire_after: 1200
value_template: '{{value | round(0) | int}}'
unit_of_measurement: "%"
binary_sensor:
- platform: mqtt
name: "Foyer Upper Button"
state_topic: "foyer/switches/upper"
expire_after: 12
payload_on: 'on'
- platform: mqtt
name: "Foyer Lower Button"
state_topic: "foyer/switches/lower"
expire_after: 12
payload_on: 'on'
switch:
- platform: mqtt
name: "Front Porch Light"
state_topic: "foyer/relays/upper_state"
command_topic: "foyer/relays/upper"
payload_on: "ON"
payload_off: "OFF"
- platform: mqtt
name: "Foyer Light"
state_topic: "foyer/relays/lower_state"
command_topic: "foyer/relays/lower"
payload_on: "ON"
payload_off: "OFF"
Thanks for your help @marthocoo
Sorry I’m just now able to chime in, and glad to hear you have it working @Bill_Surowiecki. Early on, MQTT may seem like an unnecessary platform that is a pain to configure, but you’ll soon recognize it’s value. Any system that you want to connect with HA, mqtt is the way to go. For example, by running EventGhost on my windows computer, mqtt can tell HA when it’s idle or busy and even publish commands to shut it down.
Also, @marthocoo - have you seen this??
Brilliant app that is exactly what the Wink Relay needs! Between your work and axzae’s, the relay can finally run software that allows it to realize the potential in it’s hardware. I’ve noticed that the stability of my MQTT connection is even worse though when the app is left running. If others are able to test, please share your results.
@Woodsmith Crikey that looks nice. I’ll have to try it out.
Forgot to mention to you that I’ve added a function to my branch of wink-relay-handler that allows an MQTT message to turn the Wink screen on (essentially publishing “ON” to winkrelay/screen). This has solved my prox sensor issue since I no longer rely on it to turn the screen on - motion in the hallway the Relay is in does it (using an HA automation to publish that payload when Motion is detected). I must say I still haven’t been having the MQTT problems you and others have but this could help to solve it since any time there’s motion in the room/hall the Relay gets pounded with messages, keeping the MQTT connection alive. Haven’t gotten around to raising a PR on the author’s repo yet though by the activity I don’t think it’s a high priority for him.
Hey Woodsmith,
Funny enough I was just going to start playing with Eventghost for my windows pc.
Wanted to send display wake commands to my PC when motion is triggered in my office.
Do you of anything like Eventghost for Macs. Id like to have some similar functionality for the iMac in my bedroom.