HomeGenie Forum
Development => Bug reporting => Topic started by: mvdarend on August 20, 2015, 08:36:54 PM
-
I think I may have found a problem with the Publish method in MqttClientHelper.cs, in this forum message (http://www.homegenie.it/forum/index.php?topic=758.msg6253#msg6253) 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.
-
login to github and click the following link:
https://github.com/genielabs/HomeGenie/edit/master/HomeGenie/Automation/Scripting/MqttClientHelper.cs
there you can edit and publish the modified file. I'm just telling for future reference. If it's too much bother to create an account on github, I will do it for you.
g.
-
Thanks Gene, I was playing around with GitHub a while back as I'd like to help more, so I already had an account.
I'll give the GitHub documents a better readthrough today, as I still don't completely understand all the terms used (forking, pull request etc.)