Skip to content

Instantly share code, notes, and snippets.

@7wells
Last active November 18, 2022 11:01
Show Gist options
  • Save 7wells/44009826a9c30a08c47abab7e59a18de to your computer and use it in GitHub Desktop.
Save 7wells/44009826a9c30a08c47abab7e59a18de to your computer and use it in GitHub Desktop.
FHEM - How to enable and set up MQTT2_CLIENT
# How to enable MQTT2_CLIENT:
#
define MyMQTT MQTT2_CLIENT <IP of MQTT server>:1883
# How to set MQTT user name:
#
Go to FHEM => MyMQTT => attr MyMQTT
Select 'username' from drop-down menu (under 'MQTT2_CLIENT' heading)
Enter username in empty field and hit [Return] key
# How to set MQTT user password:
#
Go to FHEM => MyMQTT => set MyMQTT
Select 'password' from drop-down menu
Enter password in empty field and hit [Return] key
# How to publish relevant MQTT topics:
#
Go to FHEM => MyMQTT => attr MyMQTT
Select 'rawEvents' from drop-down menu (under 'MQTT2_CLIENT' heading)
Enter 'fhem/set/.*' (without quotation marks) in empty field and hit [Return] key
# How to restrict subscription to a certain MQTT topic branch:
#
Go to FHEM => MyMQTT => attr MyMQTT
Select 'subscriptions' from drop-down menu (under 'MQTT2_CLIENT' heading)
Enter 'fhem/set/#' (without quotation marks) in empty field and hit [Return] key
Note that the syntax is here (fhem/set/#) different than above (fhem/set/.*).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment