Do you have any information in your mosquitto.log?
located in /var/log/mosquitto/mosquitto.log
-
Pimatic und MQTT
-
@Manfred
This is in the log file:1554363923: New connection from 127.0.0.1 on port 1883. 1554363933: New connection from 127.0.0.1 on port 1883. 1554363943: New connection from 127.0.0.1 on port 1883. 1554363953: New connection from 127.0.0.1 on port 1883. 1554363963: Client <unknown> has exceeded timeout, disconnecting. 1554363963: Socket error on client <unknown>, disconnecting. 1554363963: New connection from 127.0.0.1 on port 1883. 1554363973: Client <unknown> has exceeded timeout, disconnecting. 1554363973: Socket error on client <unknown>, disconnecting. 1554363973: New connection from 127.0.0.1 on port 1883. 1554353031: Saving in-memory database to /var/lib/mosquitto/mosquitto.db. 1554354832: Saving in-memory database to /var/lib/mosquitto/mosquitto.db. 1554356633: Saving in-memory database to /var/lib/mosquitto/mosquitto.db. 1554358434: Saving in-memory database to /var/lib/mosquitto/mosquitto.db. 1554360235: Saving in-memory database to /var/lib/mosquitto/mosquitto.db. 1554362036: Saving in-memory database to /var/lib/mosquitto/mosquitto.db. 1554363837: Saving in-memory database to /var/lib/mosquitto/mosquitto.db. 1554363866: Socket error on client pimatic_0cecf3cc, disconnecting. 1554363873: New connection from 127.0.0.1 on port 1883. 1554363883: New connection from 127.0.0.1 on port 1883. 1554363893: New connection from 127.0.0.1 on port 1883. 1554363903: New connection from 127.0.0.1 on port 1883.
-
As I just notice, when I stop mosquitto, it keeps running and I just uninstalled it with the command “sudo apt remove mosquitto”. So the log continues. Is that normal or do I have to uninstall mosquitto in a different way?
-
in my logfile I find the message
1554114044: mosquitto version 1.4.10 terminating 1554114062: mosquitto version 1.4.10 (build date Wed, 13 Feb 2019 00:45:38 +0000) starting 1554114062: Config loaded from /etc/mosquitto/mosquitto.conf. 1554114062: Opening ipv4 listen socket on port 1883. 1554114062: Opening ipv6 listen socket on port 1883. 1554114082: New connection from 192.168.178.116 on port 1883. 1554114082: New client connected from 192.168.178.116 as DVES_3B7769 (c1, k15, u'DVES_USER'). 1554114116: New connection from 127.0.0.1 on port 1883. 1554114116: New client connected from 127.0.0.1 as paho48699998613 (c1, k60). 1554115873: Saving in-memory database to /var/lib/mosquitto/mosquitto.db. 1554117674: Saving in-memory database to /var/lib/mosquitto/mosquitto.db. 1554119475: Saving in-memory database to /var/lib/mosquitto/mosquitto.db. 1554121276: Saving in-memory database to /var/lib/mosquitto/mosquitto.db. 1554123077: Saving in-memory database to /var/lib/mosquitto/mosquitto.db. 1554123361: New connection from 192.168.178.116 on port 1883. 1554123361: New client connected from 192.168.178.116 as DVES_3B7769 (c1, k15, u'DVES_USER'). 1554123695: New connection from 192.168.178.116 on port 1883.
the 192.168.178.116 is the ip adress of my Sonoff_Pow switch.
the 127.0.0.1 is the adress localhost.In my config I work with two server, one is the pimatic and the other one is openhab2.
Both config connect to the mosquitto and there to the Sonoff_Pow switch.In your logfile you can read the disconnecting
1554363963: New connection from 127.0.0.1 on port 1883. 1554363973: Client <unknown> has exceeded timeout, disconnecting. 1554363973: Socket error on client <unknown>, disconnecting.
so if you do not have additional mqtt clients in your enviroment than does it mean that there is something wrong with you pimatic-client.
Also this line says it to me.
1554363866: Socket error on client pimatic_0cecf3cc, disconnecting.
perhaps you change your config in pimatic in the way like mine config file.
“host”: “192.168.178.42”, -> here for you localhost
“port”: 1883,
“keepalive”: 180Is the only difference I can see.
LG Manfred
-
I guess that you will get no error messages when you start your pimatic, right?
did you configure a device?
Untill now I have no idea, what’s your goal with Mosquitto. So I describe what I’m doing with it. I have no idea, what will happen if you do not have a correct device definition.
as an excample my device entry:
This is only a switch to power on/off my pump.{ "class": "MqttSwitch", "id": "mqttsonoffPowswitch", "name": "Teichpumpe Sonoff", "topic": "cmnd/Sonoff_Pow/Power", "stateTopic": "stat/Sonoff_Pow/POWER", "onMessage": "ON", "offMessage": "OFF", "brokerId": "MQTTBroker-local" },
but this described just a switch from class MqttSwitch, with the free name “Teichpumpe Sonoff”.
The topics are the cmnd on and off that I send from pimatic to the switch, the stat is to see, which state has the switch, even if switched from my second system (openhab).
And important here is the Brokerid, named by my system: “MQTTBroker-local”there is nothing more to do
LG
Manfred -
@Manfred
I reinstalled mqtt and now it works.
Thank you.Manfred du oder jemand anderes weißt doch bestimmt wie ich jetzt die 2 pis miteinander sprechen lassen kann. Also an dem einem pi(1) habe ich ein Bewegungsmelder und an dem andren pi(2) habe ich eine Lampe die dann angehen soll, wenn der Bewegungsmelder ein Signal kriegt. Wie kann ich jetzt von dem einem pi(1) zu dem andren(pi2) senden das der Bewegungssensor “anwesend” ist. Habe mir schon ein paar Sachen durchgelesen aber habe es nicht so richtig verstanden.
Kann mir da jemand helfen?
LGManfred you or someone else know how I can now let the 2 pis speak to each other. So on one pi(1) have a motion detector and on other pi(2) have a lamp which should go on when the motion detector gets a signal. How can I now send from one pi(1) to the other pi(2) that the motion sensor is “present”? I’ve already read a few things but I didn’t really understand it.
Can someone help me?
LG -
Also ich glaube ich habe es jetzt verstanden aber wie kann ich mit pimatic ein Thema( -h IP -t “stat/Sonoff_Pow/Present” -m “absent”) veröffentlichen un die Nachricht?
Also wie kann ich ein Thema veröffentliceh mit pimatic. Benutzt man dafür shell script(falls ja wie dann) oder was anderes?So I think I understood it now but how can I use pimatic to publish a topic( -h IP -t “stat/Sonoff_Pow/Present” -m “absent”) and the message?
So how can I publish a topic with pimatic. Do you use shell script (if so how then) or something else? -
I got it.
Thank you Manfred for your help. -
same for me here - you just reinstalled the mqtt-plugin to solve the error?
sometimes pimatic is eating me up -
@daddycool
I uiinstalled the mqtt plugin and delete the mqtt folder in pimatic-app/node_modules/mqtt
then I reinstalled mqtt and it works.