Files
arduino-home-assistant/docsrc/source/documents/library/mqtt-security.rst
T
Dawid Chyrzyński 77a356bb37 HAMqtt improvements (#224)
* added setBufferSize method to the HAMqtt class

* added getState method to the HAMqtt class

* update docs

* update changelog

* changelog

* update mocks

* change data type in the PubSubClientMock

* update docs and changelog

* add more callbacks to the HAMqtt class

* improve handling of the disconnected state

* minor fixes in state handling
2024-02-09 19:27:10 +01:00

34 lines
1.1 KiB
ReStructuredText

MQTT security
=============
The library enables you to utilize credentials to establish a TCP connection with the MQTT broker.
By default, you can employ the same credentials utilized for logging into the Home Assistant panel.
However, it's also possible to configure custom credentials within the Mosquitto broker.
.. DANGER::
This solution may not provide comprehensive security as the communication between Arduino and Home Assistant lacks encryption.
Consequently, username and password could be vulnerable to discovery through analysis of local network traffic.
However, this may not pose a significant risk if your local network is properly secured against unauthorized access.
::
#include <Ethernet.h>
#include <ArduinoHA.h>
byte mac[] = {0x00, 0x10, 0xFA, 0x6E, 0x38, 0x4A};
EthernetClient client;
HADevice device(mac, sizeof(mac));
HAMqtt mqtt(client, device);
void setup() {
// ...
// replace username and password with your credentials
mqtt.begin("192.168.1.50", "username", "password");
}
void loop() {
// ...
}