I think I may have found a problem with the Publish method in MqttClientHelper.cs, in
this forum message is a description of the problem.
Basically the Payload/Message looks like it's adding a string terminator to the beginning of the string, which doesn't play well with the MySensor nodes.
I downloaded the HomeGenie source and added an extra overload for
MqttClientHelper Publish in
HomeGenie/Automation/Scripting/MqttClientHelper.cs.
/// <summary>
/// Publish a message to the specified topic.
/// </summary>
/// <param name="topic">Topic name.</param>
/// <param name="message">Message text as byte array.</param>
public MqttClientHelper Publish(string topic, byte[] message)
{
lock (mqttSyncLock)
{
mqttClient.PublishMessage(topic, message);
}
return this;
}
Calling it from HomeGenie with the following code works
and the Payload is arriving at the MySensor node.
MqttClient.Publish("MyMQTT/21/1/V_LIGHT", Encoding.ASCII.GetBytes("1"));
Would it be possible to add this overload to MqttClientHelper? I'm not sure how to go about it in GitHub.