HS3 MQTT Plugin

Alles m.b.t. de Homeseer MQTT Broker Plugin van Willem Eradus (Dutch Forum)

Moderator: Willem4ever

raymonvdm
Senior Member
Senior Member
Posts: 1153
Joined: Sun Dec 18, 2011 1:23 am

Re: HS3 MQTT Plugin

Post 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"
Running HS3PRO on PC with Z-Wave / OpenTherm / Plugwise / RFXcom / MQTT / XAP400 / Logitech Media Server and Squeezelite on PI`s
noebl1
Starting Member
Starting Member
Posts: 12
Joined: Mon Apr 04, 2016 4:51 pm

Re: HS3 MQTT Plugin

Post 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.
terafin
Starting Member
Starting Member
Posts: 1
Joined: Tue Jan 03, 2017 10:02 am

Re: HS3 MQTT Plugin

Post 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!
Eman
Starting Member
Starting Member
Posts: 6
Joined: Tue Nov 29, 2016 10:41 am

Re: HS3 MQTT Plugin

Post 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.
Fischi
Member
Member
Posts: 76
Joined: Sun Mar 25, 2012 1:06 am

Re: HS3 MQTT Plugin

Post 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
Eman
Starting Member
Starting Member
Posts: 6
Joined: Tue Nov 29, 2016 10:41 am

Re: HS3 MQTT Plugin

Post 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.
geert-jan
Member
Member
Posts: 126
Joined: Sat Nov 27, 2010 7:23 pm

Re: HS3 MQTT Plugin

Post 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
MarkHargrove
Starting Member
Starting Member
Posts: 3
Joined: Sun Jan 15, 2017 4:38 am

Re: HS3 MQTT Plugin

Post 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
Daigaard
Starting Member
Starting Member
Posts: 3
Joined: Sun Jan 15, 2017 11:31 am

Re: HS3 MQTT Plugin

Post 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. :roll: )

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
raymonvdm
Senior Member
Senior Member
Posts: 1153
Joined: Sun Dec 18, 2011 1:23 am

Re: HS3 MQTT Plugin

Post by raymonvdm »

Did you use espeasy on the sonoff?

I have a nodemcu running espeasy. I will try tot replicatie tour setup.
Running HS3PRO on PC with Z-Wave / OpenTherm / Plugwise / RFXcom / MQTT / XAP400 / Logitech Media Server and Squeezelite on PI`s
User avatar
esschenk
Member
Member
Posts: 426
Joined: Sun Feb 17, 2008 10:34 pm
Location: Netherlands
Contact:

Re: HS3 MQTT Plugin

Post by esschenk »

Hello,

See Post #39

https://forums.homeseer.com/showthread. ... 482&page=2

This is working perfect for me .

Ed
geert-jan
Member
Member
Posts: 126
Joined: Sat Nov 27, 2010 7:23 pm

Re: HS3 MQTT Plugin

Post 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
MarkHargrove
Starting Member
Starting Member
Posts: 3
Joined: Sun Jan 15, 2017 4:38 am

Re: HS3 MQTT Plugin

Post 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.
MarkHargrove
Starting Member
Starting Member
Posts: 3
Joined: Sun Jan 15, 2017 4:38 am

Re: HS3 MQTT Plugin

Post 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.
Last edited by MarkHargrove on Tue Jan 17, 2017 1:36 am, edited 1 time in total.
Daigaard
Starting Member
Starting Member
Posts: 3
Joined: Sun Jan 15, 2017 11:31 am

Re: HS3 MQTT Plugin

Post 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?
Attachments
Sonoff configuration options.
Sonoff configuration options.
Forum Sonoff.jpg (145.41 KiB) Viewed 10538 times
Post Reply

Return to “Homeseer MQTT Plugin Forum”