Mosquitto - MQTT

Non Joggler related discussion.
Post Reply
User avatar
pete
Posts: 2950
Joined: Mon Aug 01, 2011 6:33 am
Location: Time Traveler

Mosquitto - MQTT

Post 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.
- Pete
O2 Jogglers running EFI Ubuntu / Squeezeplayer
OpenPeak Voip Telephony / Zigbee tabletops hardware modded with Seabios / RTC / Ethernet ROM edits / SSD drives running XPe for automation screens

Auto mater
Paul Webster
Posts: 155
Joined: Mon Jul 18, 2011 7:56 am

Re: Mosquitto - MQTT

Post 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.
User avatar
pete
Posts: 2950
Joined: Mon Aug 01, 2011 6:33 am
Location: Time Traveler

Re: Mosquitto - MQTT

Post 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.
ssonoff.jpg
- Pete
O2 Jogglers running EFI Ubuntu / Squeezeplayer
OpenPeak Voip Telephony / Zigbee tabletops hardware modded with Seabios / RTC / Ethernet ROM edits / SSD drives running XPe for automation screens

Auto mater
Paul Webster
Posts: 155
Joined: Mon Jul 18, 2011 7:56 am

Re: Mosquitto - MQTT

Post by Paul Webster »

Here is the one that I was referring to
Squeezebox integration for Amazon Alexa
https://github.com/declension/squeeze-alexa

See the "transport" folder for that chunk of MQTT integration.
User avatar
pete
Posts: 2950
Joined: Mon Aug 01, 2011 6:33 am
Location: Time Traveler

Re: Mosquitto - MQTT

Post by pete »

Thank you Paul.
- Pete
O2 Jogglers running EFI Ubuntu / Squeezeplayer
OpenPeak Voip Telephony / Zigbee tabletops hardware modded with Seabios / RTC / Ethernet ROM edits / SSD drives running XPe for automation screens

Auto mater
User avatar
pete
Posts: 2950
Joined: Mon Aug 01, 2011 6:33 am
Location: Time Traveler

Re: Mosquitto - MQTT

Post by pete »

Installed HA yesterday and it automagically saw my Squeezebox server and Joggler players (have more than two running today).
HA.jpg
- Pete
O2 Jogglers running EFI Ubuntu / Squeezeplayer
OpenPeak Voip Telephony / Zigbee tabletops hardware modded with Seabios / RTC / Ethernet ROM edits / SSD drives running XPe for automation screens

Auto mater
Paul Webster
Posts: 155
Joined: Mon Jul 18, 2011 7:56 am

Re: Mosquitto - MQTT

Post 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.
User avatar
pete
Posts: 2950
Joined: Mon Aug 01, 2011 6:33 am
Location: Time Traveler

Re: Mosquitto - MQTT

Post 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.
- Pete
O2 Jogglers running EFI Ubuntu / Squeezeplayer
OpenPeak Voip Telephony / Zigbee tabletops hardware modded with Seabios / RTC / Ethernet ROM edits / SSD drives running XPe for automation screens

Auto mater
User avatar
pete
Posts: 2950
Joined: Mon Aug 01, 2011 6:33 am
Location: Time Traveler

Re: Mosquitto - MQTT

Post by pete »

Update 06th of April, 2022

Still tinkering with Home Assistant and MQTT here.

Been updating many ESP based devices over to Tasmota which works well these days.

1 - switched my legacy 1-Wire network over to a hub and spoke temperature / humidity sensors network
2 - installed combo light / fan switches (TreatLife) modded with Tasmota
3 - installed new generation dimmer switches (with Tasmota).

Note way back here started to tinker with Node Red then switched over to using Home Assistant running in Ubuntu 20.XX on a Jetway microPC.
- Pete
O2 Jogglers running EFI Ubuntu / Squeezeplayer
OpenPeak Voip Telephony / Zigbee tabletops hardware modded with Seabios / RTC / Ethernet ROM edits / SSD drives running XPe for automation screens

Auto mater
User avatar
pete
Posts: 2950
Joined: Mon Aug 01, 2011 6:33 am
Location: Time Traveler

Re: Mosquitto - MQTT

Post by pete »

Initially was using Espurna and Tasmota (early versions) on ESP based iOT devices.

Now have gone to only using Tasmota for all of the devices. Very impressive.

Integration to Home Assistant is easy. That said the Tasmota devices have built in timers for programming automation based on sunrise / sunset times that you program in to the device.

Many new iOT devices use ESP and Tuya MCU CPUs these days. Many are using custom CPUs.
- Pete
O2 Jogglers running EFI Ubuntu / Squeezeplayer
OpenPeak Voip Telephony / Zigbee tabletops hardware modded with Seabios / RTC / Ethernet ROM edits / SSD drives running XPe for automation screens

Auto mater
Post Reply