Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with MQTT messages - intermittent success #747

Closed
btkyoung opened this issue Sep 18, 2017 · 10 comments
Closed

Issue with MQTT messages - intermittent success #747

btkyoung opened this issue Sep 18, 2017 · 10 comments
Assignees
Milestone

Comments

@btkyoung
Copy link

Hi, having issues with MQTT message not always been sent to the broker even though I get the notification "Request Executed: success [{"success":{"/lights/1/state/on":false}".

I generated the MQTT message using form generator {"clientId":"Mosquitto","topic":"outlet/set/3","message":"1","qos":"0","retain":"true"}
but when I use the test buttons it may work once or twice and then it would not respond.

I have subscribed to outlet/set/3 using MQTTfx and it would not detect any thing being sent to the MQTT broker when it wasn't working but I do get the correct message when it does work so it leads me to believe this is an issue with HA-bridge.

I tried two different implementations of HA-bridge (RPi and Docker on UnRaid) and they both react the same.

Is there a configuration setting that I'm missing?

@bwssytems
Copy link
Owner

Are there any send or connection errors for the client connection in the log?

@btkyoung
Copy link
Author

I get the following the logs messages:

09-18-2017 18:59:05.604 | ERROR | Could not publish to MQTT client for name: Mosquitto and ip: 192.XXX.XXX.XXX:1883 with message: Client is not connected | com.bwssystems.HABridge.plugins.mqtt.MQTTHandler

but then I get

09-18-2017 19:11:44.916 | INFO | Link button pressed.... | com.bwssystems.HABridge.SystemControl
09-18-2017 19:12:14.916 | INFO | Link button time ended.... | com.bwssystems.HABridge.LinkButtonPressed

The IP of the MQTT broker is the same and I've used other MQTT clients to connect to that broker without any issues. Not using any username or password on broker.

@bwssytems
Copy link
Owner

Well ,that is the issue why it is not publishing. We'll have to turn debug on for the mqtt classes in the log tab and then do a re-init.

@btkyoung
Copy link
Author

btkyoung commented Sep 21, 2017 via email

@bwssytems
Copy link
Owner

@btkyoung
Copy link
Author

Ok I've set DEBUG for

DEBUG | com.bwssystems.HABridge.plugins.mqtt
DEBUG | com.bwssystems.HABridge.plugins.mqtt.MQTTHandler
DEBUG | com.bwssystems.HABridge.plugins.mqtt.MQTTHome

I get the following for the debug log:

Press button and it would work:
09-21-2017 21:35:17.243 | DEBUG | executing HUE api request to send message to MQTT broker: "{"clientId":"Mosquitto","topic":"/raw/esp8266/13966721/in","message":"open","qos":"0","retain":"true"}" | com.bwssystems.HABridge.plugins.mqtt.MQTTHome
09-21-2017 21:35:17.245 | DEBUG | publishing message: Mosquitto - /raw/esp8266/13966721/in - open - count: 0 | com.bwssystems.HABridge.plugins.mqtt.MQTTHome
09-21-2017 21:35:17.246 | DEBUG | Retrieved a MQTT hanlder for name: Mosquitto | com.bwssystems.HABridge.plugins.mqtt.MQTTHome

Tried again and I get an error.
09-21-2017 21:36:15.982 | DEBUG | executing HUE api request to send message to MQTT broker: "{"clientId":"Mosquitto","topic":"/raw/esp8266/13966721/in","message":"open","qos":"0","retain":"false"}" | com.bwssystems.HABridge.plugins.mqtt.MQTTHome
09-21-2017 21:36:15.984 | DEBUG | publishing message: Mosquitto - /raw/esp8266/13966721/in - open - count: 0 | com.bwssystems.HABridge.plugins.mqtt.MQTTHome
09-21-2017 21:36:15.985 | DEBUG | Retrieved a MQTT hanlder for name: Mosquitto | com.bwssystems.HABridge.plugins.mqtt.MQTTHome
09-21-2017 21:36:15.986 | ERROR | Could not publish to MQTT client for name: Mosquitto and ip: 192.168.55.10:1883 with message: Client is not connected

@bwssytems
Copy link
Owner

Actually, I need the beginning of the log as to see the connection errors.

@btkyoung
Copy link
Author

Sorry for the late reply.

Here is the beginning of the log. No errors that I see.

09-25-2017 03:05:51.549 INFO HA Bridge (v4.5.6) starting.... com.bwssystems.HABridge.HABridge
09-25-2017 03:05:51.600 INFO reading from config file: data/habridge.config com.bwssystems.HABridge.BridgeSettings
09-25-2017 03:05:53.997 INFO HA Bridge initializing.... com.bwssystems.HABridge.HABridge
09-25-2017 03:05:54.007 INFO System control service started.... com.bwssystems.HABridge.SystemControl
09-25-2017 03:05:54.040 INFO Initializing UDP response Socket... com.bwssystems.HABridge.util.UDPDatagramSender
09-25-2017 03:05:54.042 INFO UDP response Seocket initialized to: 50000 com.bwssystems.HABridge.util.UDPDatagramSender
09-25-2017 03:05:54.044 INFO Harmony Home created. No Harmony devices configured. com.bwssystems.HABridge.plugins.harmony.HarmonyHome
09-25-2017 03:05:54.046 INFO Nest Home created. No Nest configured. com.bwssystems.HABridge.plugins.NestBridge.NestHome
09-25-2017 03:05:54.047 INFO Hue passthru Home created. No Hue passtrhu systems configured. com.bwssystems.HABridge.plugins.hue.HueHome
09-25-2017 03:05:54.051 INFO HAL Home created. No HAL devices configured. com.bwssystems.HABridge.plugins.hal.HalHome
09-25-2017 03:05:54.052 INFO MQTT Home created. com.bwssystems.HABridge.plugins.mqtt.MQTTHome
09-25-2017 03:05:54.055 INFO Setting up handler for name: Mosquitto com.bwssystems.HABridge.plugins.mqtt.MQTTHandler
09-25-2017 03:05:54.169 INFO == Spark has ignited ... spark.webserver.JettySparkServer
09-25-2017 03:05:54.171 INFO >> Listening on 0.0.0.0:3080 spark.webserver.JettySparkServer
09-25-2017 03:05:54.202 INFO HomeAssistant Home created. No HomeAssistants configured. com.bwssystems.HABridge.plugins.hass.HassHome
09-25-2017 03:05:54.203 INFO Command Home for system program execution created. com.bwssystems.HABridge.plugins.exec.CommandHome
09-25-2017 03:05:54.545 INFO Http Home created. com.bwssystems.HABridge.plugins.http.HTTPHome
09-25-2017 03:05:54.548 INFO TCP Home created. com.bwssystems.HABridge.plugins.tcp.TCPHome
09-25-2017 03:05:54.549 INFO UDP Home created. com.bwssystems.HABridge.plugins.udp.UDPHome
09-25-2017 03:05:54.551 INFO Vera Home created. No Veras configured. com.bwssystems.HABridge.plugins.vera.VeraHome
09-25-2017 03:05:54.553 INFO Domoticz Home created. No Domoticz devices configured. com.bwssystems.HABridge.plugins.domoticz.DomoticzHome
09-25-2017 03:05:54.554 INFO Somfy Home created. No Somfys configured. com.bwssystems.HABridge.plugins.somfy.SomfyHome
09-25-2017 03:05:54.555 INFO LifxDevice Home created. No LifxDevices configured. com.bwssystems.HABridge.plugins.lifx.LifxHome
09-25-2017 03:05:54.568 INFO HABridge device management service started.... com.bwssystems.HABridge.devicemanagmeent.DeviceResource
09-25-2017 03:05:54.609 INFO Hue description service started.... com.bwssystems.HABridge.upnp.UpnpSettingsResource
09-25-2017 03:05:54.625 INFO Hue emulator service started.... com.bwssystems.HABridge.hue.HueMulator
09-25-2017 03:05:54.695 INFO UPNP Discovery Listener starting.... com.bwssystems.HABridge.upnp.UpnpListener
09-25-2017 03:05:54.696 INFO UPNP Discovery Listener running and ready.... com.bwssystems.HABridge.upnp.UpnpListener
09-26-2017 22:07:57.290 INFO Link button pressed.... com.bwssystems.HABridge.SystemControl
Logging Configuration

@bwssytems
Copy link
Owner

Ok, will need to research as the client connection in the setup shows no errors.

@bwssytems bwssytems self-assigned this Sep 28, 2017
@bwssytems
Copy link
Owner

I put in a check if the client is connected before the call, if not it will try to connect.

@bwssytems bwssytems added this to the V5.0.0 milestone Oct 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants