Page 1 of 1

Mosquitto - MQTT

Posted: Thu Oct 11, 2018 2:26 pm
by pete
Just curious if anyone is playing with Mosquitto (MQTT)?

An MQTT system consists of clients communicating with a server, often called a "broker". A client may be either a publisher of information or a subscriber. Each client can connect to the broker.

Information is organized in a hierarchy of topics. When a publisher has a new item of data to distribute, it sends a control message with the data to the connected broker. The broker then distributes the information to any clients that have subscribed to that topic. The publisher does not need to have any data on the number or locations of subscribers, and subscribers in turn do not have to be configured with any data about the publishers.

If a broker receives a topic for which there are no current subscribers, it will discard the topic unless the publisher indicates that the topic is to be retained. This allows new subscribers to a topic to receive the most current value rather than waiting for the next update from a publisher.

When a publishing client first connects to the broker, it can set up a default message to be sent to subscribers if the broker detects that the publishing client has unexpectedly disconnected from the broker.

Clients only interact with a broker, but a system may contain several broker servers that exchange data based on their current subscribers' topics.

A minimal MQTT control message can be as little as two bytes of data. A control message can carry nearly 256 megabytes of data if needed. There are fourteen defined message types used to connect and disconnect a client from a broker, to publish data, to acknowledge receipt of data, and to supervise the connection between client and server.

MQTT relies on the TCP protocol for data transmission. A variant, MQTT-SN, is used over other transports such as Bluetooth.

MQTT sends connection credentials in plain text format and does not include any measures for security or authentication. This can be provided by the underlying TCP transport using measures to protect the integrity of transferred information from interception or duplication.

Re: Mosquitto - MQTT

Posted: Thu Oct 11, 2018 3:56 pm
by Paul Webster
It is being used in one of the Squeezebox Alexa integration tools.
Not Joggler related but code is available to look at on GitHub ... can't remember link and am on way out.

Re: Mosquitto - MQTT

Posted: Fri Oct 12, 2018 1:56 pm
by pete
Here slowly (baby steps) utilizing MQTT for automation. It is a bit similiar to using xAP or xPL from years ago.

Historically not one to automate using WiFi. With Mosquitto and WiFi and updatable ESPXXX devices you can do all sorts of stuff.

Here is an example.

My current garage door automation is hardwired to the security panel. IE: PIR, Open door, close door and button.

A test here is using an el cheapo SonOff Wifi Basic module modified for use with Mosquitto. Multifunctional and a $4.00 USD device which:

1 - reads the temperature and or humidity in the garage - talking Mosquitto
2 - has wired open and closed door reed sensors (2)
3 - has momentary button to open or close garage door
4 - you can add more sensors to it if you want.

Re: Mosquitto - MQTT

Posted: Fri Oct 12, 2018 4:49 pm
by Paul Webster
Here is the one that I was referring to
Squeezebox integration for Amazon Alexa

See the "transport" folder for that chunk of MQTT integration.

Re: Mosquitto - MQTT

Posted: Fri Oct 12, 2018 8:35 pm
by pete
Thank you Paul.

Re: Mosquitto - MQTT

Posted: Tue Oct 16, 2018 11:31 am
by pete
Installed HA yesterday and it automagically saw my Squeezebox server and Joggler players (have more than two running today).

Re: Mosquitto - MQTT

Posted: Tue Oct 16, 2018 12:30 pm
by Paul Webster
I don’t think HASS LMS tool does full auto discovery like LMS player so my guess is that it found it on port 9000 on one of the HASS known servers ... perhaps on same system as HASS itself.

Re: Mosquitto - MQTT

Posted: Tue Oct 16, 2018 3:12 pm
by pete
Thank you Paul.

Yeah just starting to play with HA here.

Mostly utilize Homeseer for Automation (well now some 20 years). Installed a Mosquitto plugin to Homeseer.

Homeseer currently speaks X10, Insteon, UPB, Zigbee, Wifi, Mosquitto and ZWave.

That said now tinkering with WiFi devices upgrading them with Tasmota or ESP Easy firmware which talks Mosquitto and to HA built in.

Installed HA it on a separate box running Ubuntu 18.04 64 bit (overkill spare shuttle netop computer) along with Node Red.

The Squeezebox server is running on the MythTV box here and getting it's music from a configured NAS.

Have 3 NAS boxes here. 2 are 5 drive older NAS boxes with propietary embedded Linux and one is a FreeNAS (now XIGMA NAS) box with 8 drives in it.

I have a few Jogglers (powered on demand) connected main Squeezebox server.

The above HA stuff just came up by itself before installation of any plugins so then it must see the currently running Squeezebox server and two Jogglers running Squeezeplayer that were on.