OK so I am back with Part2 - mqtt
Having issues with mqtt - I have other mqtt devices all working fine with core-mosquitto
For this integration I switched on the Create option for for sensors. The mqtt username and password is in the secrets file.
It starts and creates the sensors but they are all empty.
Sometimes after I restart the SBFspot I this error in the logs:
Error: Both topic and message must be supplied.
Sometimes I get this other error:
sh: HxoCzfjh4T7d: not found
No idea why sometimes it shows one error and other times the other error.
Rest of the log file is similar for both errors:
Reading events: 2023-May-01
Error: Both topic and message must be supplied.
mosquitto_pub is a simple mqtt client that will publish a message on a single topic and exit.
mosquitto_pub version 2.0.14 running on libmosquitto 2.0.14.
Usage: mosquitto_pub {[-h host] [--unix path] [-p port] [-u username] [-P password] -t topic | -L URL}
{-f file | -l | -n | -m message}
[-c] [-k keepalive] [-q qos] [-r] [--repeat N] [--repeat-delay time] [-x session-expiry]
[-A bind_address] [--nodelay] [-S]
[-i id] [-I id_prefix]
[-d] [--quiet]
[-M max_inflight]
[-u username [-P password]]
[--will-topic [--will-payload payload] [--will-qos qos] [--will-retain]]
[{--cafile file | --capath dir} [--cert file] [--key file]
[--ciphers ciphers] [--insecure]
[--tls-alpn protocol]
[--tls-engine engine] [--keyform keyform] [--tls-engine-kpass-sha1]]
[--tls-use-os-certs]
[--psk hex-key --psk-identity identity [--ciphers ciphers]]
[--proxy socks-url]
[--property command identifier value]
[-D command identifier value]
mosquitto_pub --help
-A : bind the outgoing socket to this host/ip address. Use to control which interface
the client communicates over.
-d : enable debug messages.
-c : disable clean session/enable persistent client mode
When this argument is used, the broker will be instructed not to clean existing sessions
for the same client id when the client connects, and sessions will never expire when the
client disconnects. MQTT v5 clients can change their session expiry interval with the -x
argument.
-D : Define MQTT v5 properties. See the documentation for more details.
-f : send the contents of a file as the message.
-h : mqtt host to connect to. Defaults to localhost.
-i : id to use for this client. Defaults to mosquitto_pub_ appended with the process id.
-I : define the client id as id_prefix appended with the process id. Useful for when the
broker is using the clientid_prefixes option.
-k : keep alive in seconds for this client. Defaults to 60.
-L : specify user, password, hostname, port and topic as a URL in the form:
mqtt(s)://[username[:password]@]host[:port]/topic
-l : read messages from stdin, sending a separate message for each line.
-m : message payload to send.
-M : the maximum inflight messages for QoS 1/2..
-n : send a null (zero length) message.
-p : network port to connect to. Defaults to 1883 for plain MQTT and 8883 for MQTT over TLS.
-P : provide a password
-q : quality of service level to use for all messages. Defaults to 0.
-r : message should be retained.
-s : read message from stdin, sending the entire input as a message.
-S : use SRV lookups to determine which host to connect to.
-t : mqtt topic to publish to.
-u : provide a username
-V : specify the version of the MQTT protocol to use when connecting.
Can be mqttv5, mqttv311 or mqttv31. Defaults to mqttv311.
-x : Set the session-expiry-interval property on the CONNECT packet. Applies to MQTT v5
clients only. Set to 0-4294967294 to specify the session will expire in that many
seconds after the client disconnects, or use -1, 4294967295, or ∞ for a session
that does not expire. Defaults to -1 if -c is also given, or 0 if -c not given.
--help : display this message.
--nodelay : disable Nagle's algorithm, to reduce socket sending latency at the possible
expense of more packets being sent.
--quiet : don't print error messages.
--repeat : if publish mode is -f, -m, or -s, then repeat the publish N times.
--repeat-delay : if using --repeat, wait time seconds between publishes. Defaults to 0.
--unix : connect to a broker through a unix domain socket instead of a TCP socket,
e.g. /tmp/mosquitto.sock
--will-payload : payload for the client Will, which is sent by the broker in case of
unexpected disconnection. If not given and will-topic is set, a zero
length message will be sent.
--will-qos : QoS level for the client Will.
--will-retain : if given, make the client Will retained.
--will-topic : the topic on which to publish the client Will.
--cafile : path to a file containing trusted CA certificates to enable encrypted
communication.
--capath : path to a directory containing trusted CA certificates to enable encrypted
communication.
--cert : client certificate for authentication, if required by server.
--key : client private key for authentication, if required by server.
--keyform : keyfile type, can be either "pem" or "engine".
--ciphers : openssl compatible list of TLS ciphers to support.
--tls-version : TLS protocol version, can be one of tlsv1.3 tlsv1.2 or tlsv1.1.
Defaults to tlsv1.2 if available.
--insecure : do not check that the server certificate hostname matches the remote
hostname. Using this option means that you cannot be sure that the
remote host is the server you wish to connect to and so is insecure.
Do not use this option in a production environment.
--tls-engine : If set, enables the use of a TLS engine device.
--tls-engine-kpass-sha1 : SHA1 of the key password to be used with the selected SSL engine.
--tls-use-os-certs : Load and trust OS provided CA certificates.
--psk : pre-shared-key in hexadecimal (no leading 0x) to enable TLS-PSK mode.
--psk-identity : client identity string for TLS-PSK mode.
--proxy : SOCKS5 proxy URL of the form:
socks5h://[username[:password]@]hostname[:port]
Only "none" and "username" authentication is supported.
See https://mosquitto.org/ for more information.
Sat May 6 17:37:26 2023: INFO: Done.
Running core-mosquitto 6.2.1
Its logs show:
2023-05-06 17:36:51: New connection from 172.30.32.1:60162 on port 1883.
2023-05-06 17:36:51: New client connected from 172.30.32.1:60162 as auto-6C70EFBE-D19C-79A7-5903-6EFEC0496E53 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:51: Client auto-6C70EFBE-D19C-79A7-5903-6EFEC0496E53 disconnected.
2023-05-06 17:36:51: New connection from 172.30.32.1:60172 on port 1883.
2023-05-06 17:36:51: New client connected from 172.30.32.1:60172 as auto-64724A0A-F06D-4E16-0638-E6BB4669C05D (p2, c1, k60, u'mqtt').
2023-05-06 17:36:51: Client auto-64724A0A-F06D-4E16-0638-E6BB4669C05D disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60178 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60178 as auto-19CE1051-148E-2593-6F5F-CBCB8F8DF3C3 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-19CE1051-148E-2593-6F5F-CBCB8F8DF3C3 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60192 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60192 as auto-4C5B9571-9926-AB57-7B40-75245C045489 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-4C5B9571-9926-AB57-7B40-75245C045489 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60196 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60196 as auto-83D9DE93-7A3C-1466-8757-1A470B671B64 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-83D9DE93-7A3C-1466-8757-1A470B671B64 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60206 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60206 as auto-E5536DAD-9BD0-5F17-EE65-ADFDB298E7CC (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-E5536DAD-9BD0-5F17-EE65-ADFDB298E7CC disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60222 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60222 as auto-E6E49E3C-A8E7-CB1A-D069-2C33AE990CAE (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-E6E49E3C-A8E7-CB1A-D069-2C33AE990CAE disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60232 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60232 as auto-07033EEA-5A32-6A83-2CB7-77D33B2A0734 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-07033EEA-5A32-6A83-2CB7-77D33B2A0734 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60240 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60240 as auto-034FB473-505F-336D-9AD7-37D3F17D87A9 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-034FB473-505F-336D-9AD7-37D3F17D87A9 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60244 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60244 as auto-239FA189-540A-1C45-C0B2-848F5B773DB4 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-239FA189-540A-1C45-C0B2-848F5B773DB4 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60250 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60250 as auto-24B5ACDC-837D-23DA-8318-E6B80C9D41D1 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-24B5ACDC-837D-23DA-8318-E6B80C9D41D1 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60266 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60266 as auto-D0319DA8-5134-F992-1617-A0AF761AB1F3 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-D0319DA8-5134-F992-1617-A0AF761AB1F3 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60282 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60282 as auto-86163684-1D40-04EA-6C8C-15082A594A08 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-86163684-1D40-04EA-6C8C-15082A594A08 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60296 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60296 as auto-4FD0B4D3-1E57-45AD-E9B4-4808B3724537 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-4FD0B4D3-1E57-45AD-E9B4-4808B3724537 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60306 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60306 as auto-17038259-8FFE-1A01-C7CD-106F47E02679 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-17038259-8FFE-1A01-C7CD-106F47E02679 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60318 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60318 as auto-6B9DF4BA-1BFC-233E-19F1-7AE0769B9814 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-6B9DF4BA-1BFC-233E-19F1-7AE0769B9814 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60334 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60334 as auto-F28C24E3-8247-6520-B979-B0467C45757D (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-F28C24E3-8247-6520-B979-B0467C45757D disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60336 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60336 as auto-83004B37-A2A9-A8AE-DD1B-620F1FF23C1E (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-83004B37-A2A9-A8AE-DD1B-620F1FF23C1E disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60342 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60342 as auto-F9526406-D96F-A6A1-F3D2-0BED33F8960B (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-F9526406-D96F-A6A1-F3D2-0BED33F8960B disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60348 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60348 as auto-EDAE9560-0F45-C49A-6A83-E2C14B5C914F (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-EDAE9560-0F45-C49A-6A83-E2C14B5C914F disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60364 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60364 as auto-9E3D4E56-C330-14D5-88AC-8001C94B6569 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-9E3D4E56-C330-14D5-88AC-8001C94B6569 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60374 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60374 as auto-320BCAA6-E8B1-EF04-E77D-578E7E6A3A59 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-320BCAA6-E8B1-EF04-E77D-578E7E6A3A59 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60384 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60384 as auto-A1CD7A25-D31D-4377-1346-CAA7A327D488 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-A1CD7A25-D31D-4377-1346-CAA7A327D488 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60388 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60388 as auto-3E8F2957-D0AB-C1C9-A11B-AFD94225108D (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-3E8F2957-D0AB-C1C9-A11B-AFD94225108D disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60396 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60396 as auto-8100837A-7626-E688-A0A5-2D23F3D071F1 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-8100837A-7626-E688-A0A5-2D23F3D071F1 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60404 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60404 as auto-E75D40C8-2F03-99E1-D252-ED2FE23E19D5 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-E75D40C8-2F03-99E1-D252-ED2FE23E19D5 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60416 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60416 as auto-8C713526-F13C-7BB6-5CE1-A99E49ECFB46 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-8C713526-F13C-7BB6-5CE1-A99E49ECFB46 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60432 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60432 as auto-2DA6D77F-4130-A543-BA92-24A10FB578F6 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-2DA6D77F-4130-A543-BA92-24A10FB578F6 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60448 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60448 as auto-D4A30F52-048D-C0AC-9F80-E66A50236516 (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-D4A30F52-048D-C0AC-9F80-E66A50236516 disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60458 on port 1883.
2023-05-06 17:36:52: New client connected from 172.30.32.1:60458 as auto-9411B98E-AA4D-480C-FF55-F08AA211715D (p2, c1, k60, u'mqtt').
2023-05-06 17:36:52: Client auto-9411B98E-AA4D-480C-FF55-F08AA211715D disconnected.
2023-05-06 17:36:52: New connection from 172.30.32.1:60472 on port 1883.
MQTT Explorer shows (under homeassistant>>sensor)
There is no other entry in MQTT Explorer for sbfspot in any of the other sections.
Removed the HAOS-SBFspot:
Reboot and added it back = same error.
Restart core-mosquitto doesnt fix anything.
Running out of ideas to try.