Page 10 of 16
Re: HS3 MQTT Plugin
Posted: Tue Dec 27, 2016 6:31 pm
by raymonvdm
Fischi wrote:Hi,
is it possible to use the MQTT plugin to send the RPi's CPU temperature to HomeSeerHS3 and how to do this in detail ?
Regards,
Fischi
temperature.sh is run using cron
Code: Select all
#!/bin/bash
cpuTemp=$(cat /sys/class/thermal/thermal_zone0/temp)
echo "scale=3;$cpuTemp/1000" | bc -l > temp.txt
output=$(cat temp.txt)
mosquitto_pub -h mqtt.broker.nl -d -t raspberry/woonkamer/temp -m "$output"
Re: HS3 MQTT Plugin
Posted: Tue Dec 27, 2016 6:40 pm
by noebl1
You can also eliminate the temp.txt file if you wanted to:
Code: Select all
#!/bin/bash
cpuTemp=$(cat /sys/class/thermal/thermal_zone0/temp)
scaledTemp=`echo "scale=3;$cpuTemp/1000" | bc -l`
mosquitto_pub -h mqtt.broker.nl -d -t raspberry/woonkamer/temp -m "$scaledTemp"
But getting into bash semantics at this point

Could also probably consolidate it to one line, but go too lazy. The nice thing about leaving out the temp file is less SD card wear.
Re: HS3 MQTT Plugin
Posted: Tue Jan 03, 2017 10:04 am
by terafin
Thank you so much for this awesome plugin. Is there a way to auto publish all devices to the MQTT broker? I'd love for HS and the MQTT broker to be entirely in sync if possible.
Thanks!
Re: HS3 MQTT Plugin
Posted: Wed Jan 04, 2017 9:11 am
by Eman
Hello Geert-jan,
I hope it would not offend you if I asked if create a new paid for plugin and call it say IOT manager for HomeSeer. And include all the options in the MQTT plugin but plus the option of the user to be able to scan all HomeSeer devices automatically and the options of unticking the ones you want omitted. This will help considerably new users and those who may find it difficult to understand the plugin. Please you can you have look at the ImperiHome plugin for HomeSeer and can even ask Spud how he does it.
Eman.
Re: HS3 MQTT Plugin
Posted: Sun Jan 08, 2017 1:03 pm
by Fischi
Hi Geert-Jan,
I have a problem:
I've created a node-red flow to get my current WAN IP address into MQTT.
After running the flow I get the HS3 .log message for example :
Jan-05 11:01:41 MQTT Info: Received MQTT topic: Node-Red/IP/WANIP payload: 93.213.184.28 .
But the sevicestring of the HS3 MQTT device shows only 9321318428 without the "."
I've tried everything to get the correct WANIP into my MQTT device but without success .
Where is the issue ?
Regards,
Fischi
Re: HS3 MQTT Plugin
Posted: Sun Jan 08, 2017 11:46 pm
by Eman
Hello Fischi,
The only way are goin to get the IP properly is to use the tried and tested way. Please go to this link:
http://flows.nodered.org/flow/9559f217b08913702c38 Copy the flow and import from clipboard into your Node-Red.
Once done double click the inject node and in TOPIC type in Node-Red/IP only and nothing else!. Now drop in an MQTT node and just ONLY add your mqtt broker IP and Port numbers and nothing else! When done go to your HomeSeer MQTT subs, if you intially added a main TOPIC of 'Node-Red/#' there will also be a TOPIC ==>Node-Red/IP===> Which you want. If you are using your own creation then it's Node-Red where you are going wrong! not MQTT. I have that flow working as it should be.
If you are using the same flow that I'm using then I must remind you that the author set the TOPIC as
ip So to put things in simple terms ====> anything you put infront of
IP will cause the flow to mulfunction.
I appreciate your understanding. I might not have been clear.
Regards.
Eman.
Re: HS3 MQTT Plugin
Posted: Mon Jan 09, 2017 8:08 pm
by geert-jan
Hi Fischi,
I am able to reproduce your issue; in your language settings probably the '.' is the 'digit grouping symbol'.
What is the effect; an IP address contains these '.' and in my input check routine the IP address is handled as a value and not as a string or IP address.
I will fix this issue as following:
- when in the device configuration 'update value' is checked I handle the received MQTT message as value (double, decimal), including offset and multiplication
- when 'update string' is checked and 'update value' is checked; handle as value
- when 'update string' is checked and 'update value' is not checked; the received MQTT message is just copied to the device string
I expect to have an update available this weekend.
Regard
Geert-jan
Re: HS3 MQTT Plugin
Posted: Sun Jan 15, 2017 4:46 am
by MarkHargrove
I have one issue and one feature request:
When sending a custom payload from an event, my message is getting truncated when I click 'save'. I'm setting the message to the string
none|sensor=bstairs-d|time=none
...and it's being truncated to
none|sensor
(that needs to be fixed)
My feature request is that I'd like to be able to put something like '$time' in the message string and get the current time plugged in. What I actually want is to to send the time in epoch format, so perhaps there could be a $time (for folks who just want to insert a regular time string) and $epoch_time (with the value in seconds).
Thanks!
-Mark
Re: HS3 MQTT Plugin
Posted: Sun Jan 15, 2017 11:59 am
by Daigaard
geert-jan wrote:Hi,
the MQTT plugin contains almost all the functionality you need. If you create a device, and enable that device at the MQTT Publish page the MQTT commands will be sent out when the device value/string changes. By adding the ON and OFF buttons to that device you can change the device state via the homeseer web interface or HSTouch.
The MQTT topic is default /homeseer/<device id>, and that is not what you need (e.g. home/openHAB/out/Samsung_mute/command). There is already a feature request to define an own topic instead of using the default topic.
A possible alternative is to use a script, and create the MQTT message yourself, just as in the MQTT control page. However, I checked the code and saw that I do not expose this interface yet.
Regards,
Geert-Jan
Hi All,
This is my first post on this forum. I have been reading the whole thread, and I think that my problem is related to the above quote, but I'm at and end where I cannot find the solution my self.
I have been playing with the MQTT plugin, and everything seems to be working. But I have one issue that I cannot figure out (Maybe its more a HS problem than related to the Plugin.

)
The setup:
HS3 PRO on Windows 10
Broker running on the same PC
Test device: ESP8266 (Sonoff reprogrammed to MQTT)
The problem:
A: I cannot assign On/Off buttons in the HS device list to this device. I have added them in the Status Graphics under the device but they do now show up. So I cannot control the device from Device management list. (2 status [On/Off] and 2 control lines [On/Off])
B: Then I tried to make a manual device and Publish it to the following Topic: "stat/Andreas-Lampe/POWER" I have checked the String and/or Value in the left colums, this is sending values to the broker, but I need "On" or "Off" but it's sending 100 or 0.
C: I then made an event that send "On" when device changes on(100), and send "Off" when device changes off(0) - This works, but I'll ikke to avoid to have to get extra devices and scrits for each MQTT device I have to control.
I hope this makes sense to you guys, let me know if you need more information in order to help me along.
/Steffen
Re: HS3 MQTT Plugin
Posted: Sun Jan 15, 2017 2:45 pm
by raymonvdm
Did you use espeasy on the sonoff?
I have a nodemcu running espeasy. I will try tot replicatie tour setup.
Re: HS3 MQTT Plugin
Posted: Sun Jan 15, 2017 2:48 pm
by esschenk
Hello,
See Post #39
https://forums.homeseer.com/showthread. ... 482&page=2
This is working perfect for me .
Ed
Re: HS3 MQTT Plugin
Posted: Mon Jan 16, 2017 9:48 am
by geert-jan
@MarkHargrove
thanks for the feature request, I added it to the ever-growing wish list.
Regarding the truncation; the '=' character is a special character, which I did not expect to appear in the payload. I will fix this, so that payload can contain reserved/special characters.
Regards,
Geert-Jan
Re: HS3 MQTT Plugin
Posted: Mon Jan 16, 2017 7:51 pm
by MarkHargrove
Thank you! The feature request is not high priority, nor is the ability to send an '=' symbol in the payload -- I have a workaround for both.
-M.
Re: HS3 MQTT Plugin
Posted: Mon Jan 16, 2017 7:54 pm
by MarkHargrove
Is there an existing mechanism that would allow me to publish a message on HS3 startup, and similarly, on HS3 shutdown? --or is that another feature request?
Using Startup.vb doesn't work, btw (or maybe I'm using it incorrectly). With the following line added to Startup.vb:
hs.PluginFunction("MQTT", "", "publish", {"joined", "HS3"})
These log entries appear:
Jan-16 11:37:10 Startup Running the startup script Startup.vb
Jan-16 11:37:15 Error Compiling script Startup.vb: The import 'System.Core' could not be found.
Jan-16 11:37:15 Error Compiling script Startup.vb:
http://mono-project.com/Bugs)
-M.
Re: HS3 MQTT Plugin
Posted: Mon Jan 16, 2017 10:37 pm
by Daigaard
raymonvdm wrote:Did you use espeasy on the sonoff?
I have a nodemcu running espeasy. I will try tot replicatie tour setup.
I have used this project for my Sonoff and it does not seem that I can change the On / Off command to a 1 /0 values. See attached picture.
https://github.com/arendst/Sonoff-MQTT-OTA
Please provide any advice on how to proceed, is there no way to have Homeseer change the value being send?