Calling embedded MQTT server from command line

Hi I’ve just started with home assistant and I’m trying to communicate with the embedded MQTT server from the command line. The documentation gives this command “mosquitto_pub -V mqttv311 -t “hello” -m world” however, the -V option is invalid.
Error: Unknown option ‘-V’.
Tried using it without the -V option and the message isn’t sent. I know that the home assistant MQTT broker is up and working since I can successfully publish to it from an ESP8266.
Thank you.

From memory the optijon is a a lower case v. for example mosquitto_pub -v mqttv311 -t "hello" -m world

If not, man mosquitto_sub will tell you the option to specify the protocol version.

Edit:
I just got to check and upper case is the correct option… Which version of mosquitto do you have? Try this command

dpkg --status mosquitto-clients

It’s Version: 1.3.4-2

That version is from August 2014, and does not have support for MQTT v3.1.1.

Try

$ sudo apt-get update
$ sudo apt-get upgrade mosquitto-dev

to get the latest version in the Raspberry repository.

If that doesn’t work, you can connect to the mosquitto repository to get the latest version using this link
http://mosquitto.org/2013/01/mosquitto-debian-repository/