Open PorschefanRoel opened 6 years ago
hmm... on first sight your config looks perfectly fine. Can you pls check if homekit2mqtt subscribes to stat/Sonoff_GarageBol/POWER
(should be logged as ... <debug> mqtt subscribe ...
right after start, before the QR code appears).
You could also try to delete and recreate the accessory and service via the Web UI. Another idea - just to make sure we don't run into a bug on the Switch service - try it with the service Lightbulb.
When looking at the logs, it does subscribe to the requested items
Also it connects to mqtt through the localhost (127.0.0.1) and MQTT.fx connects through the LAN (192.168.1.2) as MQTT.fx is running on a different laptop and homekit2mqtt is on the same device as mqtt,
running homekit2mqtt with parameter --url "mqtt://192.168.1.2"
didn't change anything
I also still have the default created items ("Fenster Hobbyraum", "Bewegungsmelder Keller", etc..) in my homekit2mqtt.
You can see the homekit2mqtt subscribe in the below logging at 2018-07-17 15:53:30.451:
0|homekit2 | 2018-07-17 15:53:23.646 <info> homekit2mqtt 0.9.9 starting
0|homekit2 | 2018-07-17 15:53:23.719 <info> mqtt trying to connect mqtt://127.0.0.1
0|homekit2 | 2018-07-17 15:53:29.440 <debug> adding service Lightbulb to accessory Licht Bad LED
0|homekit2 | 2018-07-17 15:53:29.450 <debug> mqtt subscribe hue/status/lights/Bad
0|homekit2 | 2018-07-17 15:53:29.458 <debug> mqtt subscribe hue/status/lights/Bad/hue
0|homekit2 | 2018-07-17 15:53:29.462 <debug> mqtt subscribe hue/status/lights/Bad/sat
0|homekit2 | 2018-07-17 15:53:29.486 <debug> addBridgedAccessory Licht Bad LED
0|homekit2 | 2018-07-17 15:53:29.493 <debug> creating new accessory "Rollladen Garten" "hm//Rollladen Garten" 15557977-746b-46ea-91b5-0a5a515e3a91
0|homekit2 | 2018-07-17 15:53:29.504 <debug> loading services/WindowCovering.js
0|homekit2 | 2018-07-17 15:53:29.544 <debug> adding service WindowCovering to accessory Rollladen Garten
0|homekit2 | 2018-07-17 15:53:29.630 <debug> mqtt subscribe hm/status/Rollladen Garten:1/LEVEL_NOTWORKING
0|homekit2 | 2018-07-17 15:53:29.647 <debug> mqtt subscribe hm/status/Rollladen Garten:1/DIRECTION
0|homekit2 | 2018-07-17 15:53:29.655 <debug> addBridgedAccessory Rollladen Garten
0|homekit2 | 2018-07-17 15:53:29.666 <debug> creating new accessory "Keymatic" "hm//Keymatic" a2dedfb2-74a0-46d7-8f68-5856cc45a4af
0|homekit2 | 2018-07-17 15:53:29.673 <debug> loading services/LockMechanism.js
0|homekit2 | 2018-07-17 15:53:29.710 <debug> adding service LockMechanism to accessory Keymatic
0|homekit2 | 2018-07-17 15:53:29.748 <debug> mqtt subscribe hm/status/Keymatic:1/STATE_NOTWORKING
0|homekit2 | 2018-07-17 15:53:29.771 <debug> addBridgedAccessory Keymatic
0|homekit2 | 2018-07-17 15:53:29.783 <debug> creating new accessory "Heizung Hobbyraum" "hm//Heizung Hobbyraum" f2ba96c1-9bee-4f85-a196-71bf8aa2c4f2
0|homekit2 | 2018-07-17 15:53:29.804 <debug> loading services/Thermostat.js
0|homekit2 | 2018-07-17 15:53:29.860 <debug> adding service Thermostat to accessory Heizung Hobbyraum
0|homekit2 | 2018-07-17 15:53:29.987 <debug> mqtt subscribe hm/status/Temperatur Hobbyraum Ist/TEMPERATURE
0|homekit2 | 2018-07-17 15:53:30.006 <debug> > hap set Heizung Hobbyraum CurrentHeatingCoolingState 1
0|homekit2 | 2018-07-17 15:53:30.084 <debug> > hap set Heizung Hobbyraum TargetHeatingCoolingState 1
0|homekit2 | 2018-07-17 15:53:30.099 <debug> mqtt subscribe hm/status/Temperatur Hobbyraum Soll/SETPOINT
0|homekit2 | 2018-07-17 15:53:30.103 <debug> mqtt subscribe hm/status/Temperatur Hobbyraum Ist/HUMIDITY
0|homekit2 | 2018-07-17 15:53:30.138 <debug> addBridgedAccessory Heizung Hobbyraum
0|homekit2 | 2018-07-17 15:53:30.149 <debug> creating new accessory "Sonoff TH16 Serre" "serre//Temperatuur" 9fefd5a6-52a5-41e2-9c03-57d138194c05
0|homekit2 | 2018-07-17 15:53:30.171 <debug> adding service TemperatureSensor to accessory Sonoff TH16 Serre
0|homekit2 | 2018-07-17 15:53:30.196 <debug> loading services/HumiditySensor.js
0|homekit2 | 2018-07-17 15:53:30.221 <debug> adding service HumiditySensor to accessory Sonoff TH16 Serre
0|homekit2 | 2018-07-17 15:53:30.242 <debug> loading services/Switch.js
0|homekit2 | 2018-07-17 15:53:30.268 <debug> adding service Switch to accessory Sonoff TH16 Serre
0|homekit2 | 2018-07-17 15:53:30.291 <debug> mqtt subscribe stat/Sonoff_Temperature/POWER
0|homekit2 | 2018-07-17 15:53:30.303 <debug> addBridgedAccessory Sonoff TH16 Serre
0|homekit2 | 2018-07-17 15:53:30.316 <debug> creating new accessory "Tuin Lampen" "tuin//Lampen" c264499b-4cfc-4c0f-89f0-d29c450fce20
0|homekit2 | 2018-07-17 15:53:30.346 <debug> adding service Switch to accessory Tuin Lampen
0|homekit2 | 2018-07-17 15:53:30.360 <debug> mqtt subscribe stat/Sonoff_GarageLamp1/POWER
0|homekit2 | 2018-07-17 15:53:30.377 <debug> adding service Switch to accessory Tuin Lampen
0|homekit2 | 2018-07-17 15:53:30.391 <debug> mqtt subscribe stat/Sonoff_GarageLamp2/POWER
0|homekit2 | 2018-07-17 15:53:30.404 <debug> addBridgedAccessory Tuin Lampen
0|homekit2 | 2018-07-17 15:53:30.407 <debug> creating new accessory "Tuin Bol" "tuin//bol" 90640226-43c3-4560-ad0a-d12774ec4851
0|homekit2 | 2018-07-17 15:53:30.437 <debug> adding service Switch to accessory Tuin Bol
0|homekit2 | 2018-07-17 15:53:30.451 <debug> mqtt subscribe stat/Sonoff_GarageBol/POWER
0|homekit2 | 2018-07-17 15:53:30.458 <debug> addBridgedAccessory Tuin Bol
0|homekit2 | 2018-07-17 15:53:30.460 <info> hap created 13 Accessories
0|homekit2 | 2018-07-17 15:53:30.756 <info> hap publishing bridge "MQTT Bridge" username=CC:22:3D:E3:CE:F6 port=51826 pincode=031-45-154 setupURI=X-HM://001408XXEJIO9
0|homekit2 | 2018-07-17 15:53:30.859 <debug> > mqtt homekit/connected 2
0|homekit2 | 2018-07-17 15:53:30.874 <info> hap Bridge listening on port 51826
0|homekit2 | Scan this code with your HomeKit app on your iOS device to pair with homekit2mqtt:
I've also ran the command mosquitto_sub -v -t 'stat/Sonoff_GarageBol/POWER'
on the mosquitto server and when changing the status with my iPhone it does get the statusses of the Sonoff_GarageBol
stat/Sonoff_GarageBol/POWER ON
stat/Sonoff_GarageBol/POWER OFF
Changing the Switch to a lightbulb didn't make any difference still only the cmnd messages are shown in the log.
0|homekit2 | 2018-07-17 16:12:18.824 <debug> < hap set Tuin Bol On false
0|homekit2 | 2018-07-17 16:12:18.836 <debug> > mqtt cmnd/Sonoff_GarageBol/power OFF
0|homekit2 | 2018-07-17 16:12:23.605 <debug> < hap set Tuin Bol Brightness 100
0|homekit2 | 2018-07-17 16:12:23.616 <debug> > mqtt hue/set/lights/Tuin Bol 25400
0|homekit2 | 2018-07-17 16:12:23.621 <debug> < hap set Tuin Bol On true
0|homekit2 | 2018-07-17 16:12:23.642 <debug> > mqtt cmnd/Sonoff_GarageBol/power ON
0|homekit2 | 2018-07-17 16:12:36.340 <debug> < hap set Tuin Bol On false
0|homekit2 | 2018-07-17 16:12:36.351 <debug> > mqtt cmnd/Sonoff_GarageBol/power OFF
The item configured as a Lightbulb:
"tuin//bol": {
"id": "tuin//bol",
"name": "Tuin Bol",
"manufacturer": "Roel",
"model": "Sonoff Basic",
"services": [
{
"name": "Tuin Bol",
"service": "Lightbulb",
"topic": {
"setOn": "cmnd/Sonoff_GarageBol/POWER",
"statusOn": "stat/Sonoff_GarageBol/POWER",
"setBrightness": "hue/set/lights/Tuin Bol",
"statusBrightness": "hue/status/lights/Tuin Bol",
"setHue": "",
"statusHue": "",
"setSaturation": "",
"statusSaturation": "",
"setColorTemperature": "",
"statusColorTemperature": "",
"statusRGB": "",
"setRGB": ""
},
"payload": {
"onTrue": "ON",
"onFalse": "OFF",
"brightnessFactor": 254,
"hueFactor": null,
"saturationFactor": null
},
"config": {},
"props": {}
}
],
"payload": {},
"config": {}
}
}
Is there maybe a way in homekit2mqtt to subscribe to verything? so that I can see if homekit2mqtt receives anything?
Like can I subscribe to '#' in homekit2mqtt?
I've also tried to subscribe the "statusOn" to "cmnd/Sonoff_GarageBol/POWER" so that when homekit2mqtt sends the command it directly handles that command as the status. But this also resulted in the same behaviour.
Hmm that's really strange. Have no clue why a topic that is subscribed doesn't receive the messages on that topic. Have to think about it. Subscribing to '#' can be achieved by commenting out this line: https://github.com/hobbyquaker/homekit2mqtt/blob/master/index.js#L437 Could be worth a try.
Another question, which MQTT broker are you using? Mosquitto?
I'm running Homekit2MQTT on a Raspberry Pi 1, running on Raspbian Stretch.
I've followed the following tutorial to install everything: https://www.studiopieters.nl/homebridge-homekit-2-mqtt/
This contains the following part, so I have installed Mosquitto if I'm right?:
Now, you need to add the Mosquitto repository. Enter the following commands.
sudo wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key
sudo apt-key add mosquitto-repo.gpg.key
sudo rm mosquitto-repo.gpg.key
Next, make the repository available to apt-get. First we need to change to the apt sources list directory.
cd /etc/apt/sources.list.d/
Now install the packages list for your version of Raspbian.
sudo wget http://repo.mosquitto.org/debian/mosquitto-stretch.list
Now update apt information and install Mosquitto.
sudo apt-get update
sudo apt-get install mosquitto mosquitto-clients
I haven't had time yet to try the subscribe to '#' yet, will do that soon and I will report what happens.
Looks like I am getting the same problem...
Settings
{
"name": "Room Light",
"service": "Lightbulb",
"topic": {
"setOn": "livingRoom/left/on/set",
"statusOn": "livingRoom/left/on",
"setBrightness": "",
"statusBrightness": "",
"setHue": "",
"statusHue": "",
"setSaturation": "",
"statusSaturation": "",
"setColorTemperature": "",
"statusColorTemperature": "",
"statusRGB": "",
"setRGB": ""
},
"payload": {
"onTrue": "true",
"onFalse": "false",
"brightnessFactor": null,
"hueFactor": null,
"saturationFactor": null
},
"config": {},
"props": {}
}
The light can be switched on and off by the app.
2018-08-14 15:51:32.166 <debug> < hap set Room Light On false
2018-08-14 15:51:32.166 <debug> > mqtt livingRoom/left/on/set false
2018-08-14 15:51:42.633 <debug> < hap set Room Light On true
2018-08-14 15:51:42.633 <debug> > mqtt livingRoom/left/on/set true
2018-08-14 15:51:44.817 <debug> < hap set Room Light On false
2018-08-14 15:51:44.817 <debug> > mqtt livingRoom/left/on/set false
The last action in the above switched off the light, and it actually did. But after Re-opening the Home App, the icon in the Home shown that the light is turned on, but actually the light wasn't on. Normally, it should look for the latest mqtt status of the status topic ("livingRoom/left/on") which was "false", but somehow the hap re_get returns "true" ...
2018-08-14 15:51:54.342 <debug> < hap get Room Light On
2018-08-14 15:51:54.342 <debug> > hap re_get Room Light On true
$mosquitto_sub -v -t "livingRoom/left/on" -t "livingRoom/left/on/set"
livingRoom/left/on/set false
livingRoom/left/on false
@david-yam try to configure the payloads as boolean, not as string (omit the quotes around true/false):
"payload": {
"onTrue": true,
"onFalse": false,
I have exactly the same problem. I also followed the following tutorial:
https://www.studiopieters.nl/homebridge-homekit-2-mqtt/
Any news about the problem?
How is this going? I'm having exactly the same problem and feel it must be a bug in homekit2mqtt as the status of the device is not correctly reflected. On opening the Home Kit app it always shows the switch as off and if the switch is manually operated the Home Kit app does not show this.
A bit of an update. The problems seems to stem from having the full path in the startup script in /etc/init.d/ I have set the cmd "DEBUG=* scriptname" All works fine now.
@DrewOFord can you pls give more detail; I am also having this issue without any luck fixing it and I am very much an amateur with this stuff.
I have a problem configuring The homekit2mqtt and hopefully it's a configuration mistake made by me. It is possible to control my accessories with the iphone (iOS11) thourgh homekit2mqtt. When I Turn on a device, it does turn on (cmnd/Sonoff_GarageBol/POWER ON) and off (cmnd/Sonoff_GarageBol/POWER OFF). But when I (re)open my home app it doesn't show the correct status. When looking at the log files, I indeed can only see the send commands, and the corresponding status commands are not received back.
So first I thought the MQTT statusses weren't sent, but I've checked this using MQTT.fx and subscribed to everything (using the "#" command) and the devices did sent there status messages ("stat/Sonoff_GarageBol/Power ON")
The client that handles the switch is a Sonoff Basic running on Tasmota.
This is the corresponding Log File:
And the configuration of my device: