Created
April 6, 2018 09:27
-
-
Save jtuttas/3fdfef30d094947308504305ffd61a8a to your computer and use it in GitHub Desktop.
MQTT mit der Powershell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type -Path 'C:\Users\jtutt\OneDrive\bin\NuGet\M2Mqtt.4.3.0.0\lib\net45\M2Mqtt.Net.dll' | |
$MqttClient = [uPLibrary.Networking.M2Mqtt.MqttClient]("service.joerg-tuttas.de") | |
# | |
# Verbinden | |
$mqttclient.Connect([guid]::NewGuid()) | |
Register-ObjectEvent -inputObject $MqttClient -EventName MqttMsgPublishReceived -Action {Write-host "Event Found Topic: $($args[1].topic) Message $([System.Text.Encoding]::ASCII.GetString($args[1].Message))"} | |
$mqttClient.Subscribe("esp32/temp",0) | |
$MqttClient.Publish("esp32/temp", [System.Text.Encoding]::UTF8.GetBytes("{temp:17}")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Die dll ist zu installieren über