[SOLVED] OH2.3 Mqtt Tasmota setup issues

mqtt
tasmota
Tags: #<Tag:0x00007fe05d979128> #<Tag:0x00007fe05d978cf0>

(BigCol) #5

Topic = TheHouse
Full Topic = %prefix%/%topic%/


(Vincent Regaud) #6
Switch SonoffLamp “Sonoff Lamp [%s]” (gGFDiningLights) {mqtt=">[mosquitto:cmnd/TheHouse/power:command:*:default]"}

Please read: https://github.com/arendst/Sonoff-Tasmota/wiki/openHAB


(BigCol) #7

Thanks Vincent, i’ll take a read.

Your suggestion worked when i added a ‘[’

Thanks very much


(BigCol) #8

My MQTT seems to have stopped working…i hvent made any changes to the config that i can see.

item:
Switch SonoffLamp “Sonoff Lamp [%s]” (gGFDiningLights) {mqtt=">[mosquitto:cmnd/TheHouse/power:command:*:default],
<[mosquitto:stat/TheHouse/POWER:state:default],"}

openhab.log:

2018-11-15 18:41:34.034 [DEBUG] [inding.mqtt.internal.MqttItemBinding] - Publishing command OFF to cmnd/TheHouse/power
2018-11-15 18:41:37.607 [DEBUG] [inding.mqtt.internal.MqttItemBinding] - Publishing command ON to cmnd/TheHouse/power
2018-11-15 18:43:38.157 [DEBUG] [inding.mqtt.internal.MqttItemBinding] - Publishing command OFF to cmnd/TheHouse/power
2018-11-15 18:43:40.255 [DEBUG] [inding.mqtt.internal.MqttItemBinding] - Publishing command ON to cmnd/TheHouse/power

any suggestions on how I go about debugging please?

thanks


(Angelos) #9

what broker do you use?
Is it “alive”?


(BigCol) #10

i’m using mossquito.

I can connect to the broker using MQTT.fx, but i don’t see any messages from OH in the log/when i subscribe #


(Angelos) #11

restart the OH2 service and check logs (both OH and Mosquitto) to see if there are any errors in establishing the connection between OH2 MQTTv1 binding and the Mosquitto Broker.

In openhab.log you should see:

2018-11-12 11:00:37.576 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2018-11-12 11:00:37.577 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'mosquitto'

Ps: Use Code Fences to post configs. See here how: How to use code fences


(BigCol) #12

Where do i find the Mossquito log please?


(Angelos) #13

I assume that you are on Linux, so:
/var/log/mosquitto.log by default (if I remember well).
You can change the destination in /etc/mosquitto/mosquitto.conf
Set connection_messages true in mosquitto.conf and restart the broker


(BigCol) #14

Sorry using windows, should have said


(Angelos) #15

well… then you need to enable it (it’s disabled by default on Win)

set in your C:\Program Files\mosquitto\mosquitto.conf (or wherever you installed the Broker)
If you used Program Files subdir, you need to run the exe as Admin to be able to write in that folder

log_dest file C:\Program Files\mosquitto\mosquitto.log
connection_messages true

(BigCol) #16

here’s some of the mosquitto log

1542314314: mosquitto version 1.5.3 starting
1542314314: Config loaded from C:\Program Files (x86)\mosquitto/mosquitto.conf.
1542314314: Opening ipv6 listen socket on port 1883.
1542314314: Opening ipv4 listen socket on port 1883.
1542314327: New connection from 192.168.1.14 on port 1883.
1542314334: New client connected from 192.168.1.14 as DiningLight1 (c1, k15, u’sonoff’).
1542314334: Will message specified (7 bytes) (r1, q1).
1542314334: tele/TheHouse/LWT
1542314334: Sending CONNACK to DiningLight1 (0, 0)
1542314334: Received PUBLISH from DiningLight1 (d0, q0, r1, m0, ‘tele/TheHouse/LWT’, … (6 bytes))
1542314334: Received PUBLISH from DiningLight1 (d0, q0, r0, m0, ‘cmnd/TheHouse/POWER’, … (0 bytes))
1542314357: Client DiningLight1 has exceeded timeout, disconnecting.
1542314357: Socket error on client DiningLight1, disconnecting.
1542314392: New connection from 192.168.1.14 on port 1883.
1542314392: New client connected from 192.168.1.14 as DiningLight1 (c1, k15, u’sonoff’).
1542314392: Will message specified (7 bytes) (r1, q1).
1542314392: tele/TheHouse/LWT
1542314392: Sending CONNACK to DiningLight1 (0, 0)
1542314415: Client DiningLight1 has exceeded timeout, disconnecting.
1542314415: Socket error on client DiningLight1, disconnecting.
1542314524: New connection from 192.168.1.14 on port 1883.
1542314524: Socket error on client , disconnecting.
1542314540: New connection from 192.168.1.14 on port 1883.
1542314540: New client connected from 192.168.1.14 as DiningLight1 (c1, k15, u’sonoff’).
1542314540: Will message specified (7 bytes) (r1, q1).


(Angelos) #17

so this covers the health check of your broker (he is alive and kicking)

check openhab.log now to see if there are any errors in there.


(BigCol) #18

cant see any errors…

2018-11-15 20:58:29.455 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2018-11-15 20:58:29.455 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection ‘mosquitto’
2018-11-15 20:58:30.424 [INFO ] [b.core.service.AbstractActiveService] - Expire Refresh Service has been started
2018-11-15 20:58:30.487 [INFO ] [ulation.internal.HueEmulationServlet] - Started Hue Emulation service at /api
2018-11-15 20:58:30.487 [DEBUG] [org.openhab.binding.mqtt ] - BundleEvent STARTING - org.openhab.binding.mqtt
2018-11-15 20:58:30.487 [DEBUG] [.binding.mqtt.internal.MqttActivator] - MQTT binding has been started.
2018-11-15 20:58:30.487 [DEBUG] [org.openhab.binding.mqtt ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler}={service.id=383, service.bundleid=224, service.scope=bundle, event.topics=openhab/, component.name=org.openhab.binding.mqtt.MqttItemBinding, component.id=250} - org.openhab.binding.mqtt
2018-11-15 20:58:30.487 [DEBUG] [org.openhab.binding.mqtt ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.mqtt.MqttBindingProvider}={service.id=382, service.bundleid=224, service.scope=bundle, component.name=org.openhab.binding.mqtt.genericbindingprovider, component.id=251} - org.openhab.binding.mqtt
2018-11-15 20:58:30.487 [TRACE] [.internal.MqttGenericBindingProvider] - Starting to load MQTT config for item SonoffLamp
2018-11-15 20:58:30.502 [DEBUG] [binding.mqtt.internal.MqttItemConfig] - Loaded MQTT config for item ‘SonoffLamp’ : 1 subscribers, 1 publishers
2018-11-15 20:58:30.518 [DEBUG] [ng.mqtt.internal.MqttEventBusBinding] - MQTT: Activating event bus binding.
2018-11-15 20:58:30.533 [DEBUG] [org.openhab.binding.mqtt ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService}={service.id=385, service.bundleid=224, service.scope=bundle, event.topics=openhab/
, service.pid=org.openhab.mqtt-eventbus, component.name=org.openhab.binding.mqtt.eventbus, component.id=252} - org.openhab.binding.mqtt
2018-11-15 20:58:30.533 [DEBUG] [org.openhab.binding.mqtt ] - BundleEvent STARTED - org.openhab.binding.mqtt
2018-11-15 20:58:30.533 [TRACE] [ng.mqtt.internal.MqttEventBusBinding] - No mqtt-eventbus properties configured.


(Angelos) #19

Logs look clean…

hmm… do you have the MQTT Action Addon installed also?

post your mqtt.cfg and Items using Code Fences (```) please


(BigCol) #20

This is really strange.

before i enable mosquito logging i couldn’t see any of my on/off commands in MQTT.fx, but after i made the changes i could.

then i realised my sonoff switch was connected to a wifi AP the other end of the house. Sonoff is now connected to the correct AP, and now all is working again.

Last night the wired connection to my powermax alarm stopped working…but after a couple or server reboots that started working again, with no change…

Last night windows did an update, not sure if its related :frowning:

Thanks so much for your help tonight :slight_smile:


(Angelos) #21

I doubt it…

this was installed yesterday: https://support.microsoft.com/en-us/help/4467702/windows-10-update-kb4467702 (generic microsoft crap)


(BigCol) #22

Hmmm ok. I guess I need to monitor for a few days. I’m glad we didn’t find that my tinkering had caused a problem :grinning:.


(BigCol) #23

My mosquito hasn’t been working for a while again. I think I figured out what’s happening, but no idea why.

When I stop and then try to start the mosquito service, it wont start.

If I stop the service, delete the log file, then start the service, it starts fine.

I can’t open the logfile as the permissions are set by default that the owner is SYSTEM and no other account has access. I can change ownership and then apply the permissions I need.

I feels like the problem is around permissions of the logfile.


(Udo Hartmann) #24

Well… Windoze…

SCNR :wink: