www.homeseer.com    
 

Go Back   HomeSeer Message Board > 3rd Party Plug-Ins/Scripts > Plug-ins by Author > Click Here for List of Author Forums > MCS Plug-Ins and Scripts > mcsMQTT (3P)

mcsMQTT (3P) Discussion of mcsMQTT plug-in

Reply
 
Thread Tools Display Modes
  #61  
Old January 4th, 2018, 12:00 AM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,784
I had protected the payload, but had not considered the topic with quotes. Should be fixed in 3.0.4.2.
Reply With Quote
  #62  
Old January 4th, 2018, 12:38 AM
petez69's Avatar
petez69 petez69 is offline
Seer Master
 
Join Date: Oct 2005
Location: Alice Springs, Australia
Posts: 882
Quote:
Originally Posted by qwiksilver96 View Post
The IP I referred to is for the plugin connection to the HS3 instance upon plugin startup. Once that connection is live, then the plugin connects to the MQTT Broker.

Best,
Frank
No problems Frank. I've not seen this, I grabbed Michael's zip file and moved the files to the directory and then started the plugin....

Must say after getting this working I'm hooked on mqtt devices....

Pete
Reply With Quote
  #63  
Old January 7th, 2018, 12:44 PM
doppiaemme doppiaemme is offline
Seer
 
Join Date: Nov 2014
Location: Como
Posts: 57
Hi,

i've been following this thread and finally tried this plugin...
I have to say that it's becoming very powerful! Kudos to the author!


When I added a Sonoff temperature sensor I have the same parsing issue someone else had in this thread:



is there a way to remove the bracket?
The original message is:
Code:
Info: Received MQTT topic: tele/sonoff_caldaia/SENSOR payload: {"Time":"2018-01-07T17:38:49","Switch2":"ON","DS18B20":{"Temperature":45.3},"TempUnit":"C"}
I'm running 3.0.4.2

And also, the decimal point is shown as ".", any idea of an easy way to change it to "," ?
Using the other MQTT plugin, I made a script that read the whole string, trims out the XX.X and transform to XX,X.
Not the best way to do it but it worked.
Reply With Quote
  #64  
Old January 7th, 2018, 02:22 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,784
In other plugins I tried to determine regional settings for comma vs period to handle things properly. I will look to see what I implemented for mcsMQTT. If I have the provisions then I will need you help with some test code to properly detect and handle it.

I thought I had the parsing working fine with the latest, but will look into it for the following. The prior problem with an actual parsing error and in this case it looks to be the closing } is included as JSON content.

Code:
{"Time":"2018-01-07T17:38:49","Switch2":"ON","DS18B20":{"Temperature":45.3},"TempUnit":"C"}
Reply With Quote
  #65  
Old January 7th, 2018, 03:58 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,784
Parsing corrected again in 3.0.4.3. Still working with HST to get the plugin in the updater. The original is there now, but these updates are not yet showing up. http://mcsSprinklers.com/mcsMQTT_3_0_4_3.zip

For the comma vs. period we need to look at what is happening as DeviceValue is being updated. In the example with the parsing error the item was not numeric so it was stored in DeviceString. With the updated version look at Device Management page and see what is actually stored in the Value and see how HS3 converts it to Status for display.
Reply With Quote
  #66  
Old January 7th, 2018, 07:35 PM
petez69's Avatar
petez69 petez69 is offline
Seer Master
 
Join Date: Oct 2005
Location: Alice Springs, Australia
Posts: 882
Quote:
Originally Posted by doppiaemme View Post
Hi,

i've been following this thread and finally tried this plugin...
I have to say that it's becoming very powerful! Kudos to the author!


When I added a Sonoff temperature sensor I have the same parsing issue someone else had in this thread:



is there a way to remove the bracket?
The original message is:
Code:
Info: Received MQTT topic: tele/sonoff_caldaia/SENSOR payload: {"Time":"2018-01-07T17:38:49","Switch2":"ON","DS18B20":{"Temperature":45.3},"TempUnit":"C"}
I'm running 3.0.4.2

And also, the decimal point is shown as ".", any idea of an easy way to change it to "," ?
Using the other MQTT plugin, I made a script that read the whole string, trims out the XX.X and transform to XX,X.
Not the best way to do it but it worked.
Hi there....ok, it sounds like you have a single DS18B20 sensor and uncommented a "define" statement that is required for MULTIPLE sensors.

// WARNING: Select none for default one DS18B20 sensor or enable one of the following two options for multiple sensors
//#define USE_DS18x20 // Optional for more than one DS18x20 sensors with id sort, single scan and read retry (+1k3 code)

You need to go back into the user_config.h file and put a // infront of the define. Compile it and you can do an OTA upgrade and it will be sorted :-)

If you want different delimiters you will need to experiment in the Tasmota code to find where the mqtt message is created

Pete
Reply With Quote
  #67  
Old January 7th, 2018, 11:46 PM
epimetheus epimetheus is offline
Seer Plus
 
Join Date: Sep 2015
Location: League City, TX
Posts: 110
Maybe I've missed it, but is there a way with this plugin to specify a topic to receive and create a device for it if it's not in the list on the plugin config page? I'm switching over from the other MQTT plugin and I have devices for the number of broker connections and subscriptions to use as diagnostic tools ($SYS/broker/clients/connected and $SYS/broker/subscriptions/count). These topics don't appear in the list but are published when I subscribe to them with other clients.
Reply With Quote
  #68  
Old January 8th, 2018, 02:54 AM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,784
The plugin subscribes to Topic template # so everything the broker sees should also be visible to the plugin. Do you know why they may not be visible? Could it be that the Topic has not been published since the plugin was activated?

To answer you question explicitly, there is no provision to receive a Topic that has not been previously published. I can add it, but first need to understand the need. There is a means to publish Topic that are not associated with existing received or existing HS3 devices. While it is available, I do not see where many will use it.
Reply With Quote
  #69  
Old January 8th, 2018, 03:51 AM
petez69's Avatar
petez69 petez69 is offline
Seer Master
 
Join Date: Oct 2005
Location: Alice Springs, Australia
Posts: 882
Quote:
Originally Posted by doppiaemme View Post

is there a way to remove the bracket?
The original message is:
Code:
Info: Received MQTT topic: tele/sonoff_caldaia/SENSOR payload: {"Time":"2018-01-07T17:38:49","Switch2":"ON","DS18B20":{"Temperature":45.3},"TempUnit":"C"}
Here is the message you will get afterwards:

{"Time":"2018-01-08T08:49:51","AM2301":{"Temperature":44.6,"Humidity":5.0},"T empUnit":"C"}
Reply With Quote
  #70  
Old January 8th, 2018, 09:03 AM
petez69's Avatar
petez69 petez69 is offline
Seer Master
 
Join Date: Oct 2005
Location: Alice Springs, Australia
Posts: 882
Hi Michael

That last update broke the temp/humidity value. Example message sent from broker to mcs_mqtt

{"Time":"2018-01-08T08:49:51","AM2301":{"Temperature":44.6,"Humidity":5.0},"T empUnit":"C"}

The humidity value is set to 5.0}

I've rolled back to the previous version and its fine...ie: 5.0

Cheers..Pete
Reply With Quote
  #71  
Old January 8th, 2018, 11:26 AM
Pete's Avatar
Pete Pete is offline
OverSeer
 
Join Date: Jan 2001
Location: House
Posts: 15,446
Michael,

Here have created a 1-wire hub in the attic for the second floor temperature and humidity sensors.

Currently using both Digitemp and OWFS on an RPi in the attic. Digitemp creates a CSV file which is on a shared drive on the HS3 Linux mothership.

A VB script runs every 5 minutes which reads the values and creates dynamic variables.

Only thing is that the script is statically configured per 1-wire device reads. IE: adding a sensor is not a dynamic thing.

What would be the best or easiest methodology to broadcast these values with MQTT using OWFS or Digitemp?

I see a few python scripts that do this out there in internetlandia.

Here is one that I am looking at: mqtt-owfs-temp
__________________
- Pete

Automator

HS3 Pro & Lite Edition Beta 3.0.0.4449

HS3 Wintel Touch | Ubuntu 16.04 64 bit | Oracle Windows Virtual Box ==> for Wintel only SAPI and HS3 plugins | Speech - Microsoft SAPI - Neospeech - Amazon Echo | Hardware | Haswell Intel iSeries 3 - 16Gb | Pine64 - 2Gb computers | Openpeak Intel Atom SoC tabletop touchscreens (15 HS tabletop tablets) | Touchscreens - Windows embedded POE connected |Light switches - X10,UPB, ZWave and Zigbee | Firewall - PFSense - 2 WAN plus 4 LAN interfaces | Network - Gb managed switches / POE WAP(s) | CCTV - Zoneminder IPHD cams - variety | Audio - Russound - AB8SS | Security - Leviton HAI Omni Pro 2 | Weather - Davis Vantage Vue - MeteoStick - WeeWx | 1-Wire - AAG, Midon and HB | OWFS - Mosquitto - Node Red - Python - RPi Stretch - OpenWRT
Reply With Quote
  #72  
Old January 8th, 2018, 06:33 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,784
Quote:
That last update broke the temp/humidity value. Example message sent from broker to mcs_mqtt

{"Time":"2018-01-08T08:49:51","AM2301":{"Temperature":44.6,"Humidity":5.0},"T empUnit":"C"}

The humidity value is set to 5.0}
Took a deeper look and more thorough test. Update in 3.0.4.4 http://mcsSprinklers.com/mcsMQTT_3_0_4_4.zip


Quote:
What would be the best or easiest methodology to broadcast these values with MQTT using OWFS or Digitemp?
I have not ventured from the .NET connector for mono and the ESP8266 contained in the Sonoff units. I know 1-wire is supported by the Tasmota software that is installed on the Sonoff, but never tried to understand details. MQTT is part of Tasmota as well as several Aurdino-class products. It may even be possible to get the MQTT libraries from Tasmota or similiar for repurposing. Sorry I cannot be much help, but my breadth of usage is not large.
Reply With Quote
  #73  
Old January 8th, 2018, 10:29 PM
petez69's Avatar
petez69 petez69 is offline
Seer Master
 
Join Date: Oct 2005
Location: Alice Springs, Australia
Posts: 882
Quote:
Originally Posted by Michael McSharry View Post
Took a deeper look and more thorough test. Update in 3.0.4.4 http://mcsSprinklers.com/mcsMQTT_3_0_4_4.zip




I have not ventured from the .NET connector for mono and the ESP8266 contained in the Sonoff units. I know 1-wire is supported by the Tasmota software that is installed on the Sonoff, but never tried to understand details. MQTT is part of Tasmota as well as several Aurdino-class products. It may even be possible to get the MQTT libraries from Tasmota or similiar for repurposing. Sorry I cannot be much help, but my breadth of usage is not large.
Michael, thats fixed, thankyou....all sensors that have either temp or temp/humidity are working fine....all of the devices are running Tasmota firmware on either Sonoff or WeMOS/Nodemcu boards. Again all based on ESP8266 devices.

The WeMOS/Nodemcu configurations are extremely handy as you couple them with a DS18b20 or am2301 temp/humid sensor and they are a temp node. Cost is less than $5...

Cheers & thanks

Pete
Reply With Quote
  #74  
Old January 9th, 2018, 05:23 AM
epimetheus epimetheus is offline
Seer Plus
 
Join Date: Sep 2015
Location: League City, TX
Posts: 110
Quote:
Originally Posted by Pete View Post
Michael,

Here have created a 1-wire hub in the attic for the second floor temperature and humidity sensors.

Currently using both Digitemp and OWFS on an RPi in the attic. Digitemp creates a CSV file which is on a shared drive on the HS3 Linux mothership.

A VB script runs every 5 minutes which reads the values and creates dynamic variables.

Only thing is that the script is statically configured per 1-wire device reads. IE: adding a sensor is not a dynamic thing.

What would be the best or easiest methodology to broadcast these values with MQTT using OWFS or Digitemp?

I see a few python scripts that do this out there in internetlandia.

Here is one that I am looking at: mqtt-owfs-temp
If you want an easy way to get from a rpi into mqtt for your one wire hub, check out Node Red. It's got a couple of OWFS nodes and is a fairly easy and lightweight way to convert protocols. I've got 3 RPI3's and 3 RPIZW's running it with a variety of sensors. They're mostly talking mqtt back to HS.

Sent from my SM-N950U using Tapatalk
Reply With Quote
  #75  
Old January 9th, 2018, 05:35 AM
epimetheus epimetheus is offline
Seer Plus
 
Join Date: Sep 2015
Location: League City, TX
Posts: 110
Quote:
Originally Posted by Michael McSharry View Post
The plugin subscribes to Topic template # so everything the broker sees should also be visible to the plugin. Do you know why they may not be visible? Could it be that the Topic has not been published since the plugin was activated?

To answer you question explicitly, there is no provision to receive a Topic that has not been previously published. I can add it, but first need to understand the need. There is a means to publish Topic that are not associated with existing received or existing HS3 devices. While it is available, I do not see where many will use it.
Here are a couple of links on the topics in looking for.

https://mosquitto.org/man/mosquitto-8.html

https://github.com/mqtt/mqtt.github.io/wiki/SYS-Topics

https://www.hivemq.com/blog/mqtt-ess...best-practices

These don't appear in a subscription to #, and have to be subscribed to directly. Is it possible to add the ability to subscribe to a topic blindly, even if it hasn't already been published?

Sent from my SM-N950U using Tapatalk
Reply With Quote
  #76  
Old January 9th, 2018, 07:59 AM
petez69's Avatar
petez69 petez69 is offline
Seer Master
 
Join Date: Oct 2005
Location: Alice Springs, Australia
Posts: 882
If you want to create a dirt cheap Temp sensing system, consider this as a possibility...

WeMOS device with a DS18b20 hat, have a look at Aliexpress. You load the tasmota firmware onto the WeMOS and you have a fully functioning Temperature mqtt device.

Total price for mine are $5AUD for each node. Equally you could make your own like I did, there is ability in the code to add multiple sensors onto the 1-wire if needed.

If you need any more info dont hesitate to ask, it really is simple.

Pete
Attached Images
  
Reply With Quote
  #77  
Old January 9th, 2018, 11:04 AM
doppiaemme doppiaemme is offline
Seer
 
Join Date: Nov 2014
Location: Como
Posts: 57
Quote:
Originally Posted by Michael McSharry View Post
Took a deeper look and more thorough test. Update in 3.0.4.4 http://mcsSprinklers.com/mcsMQTT_3_0_4_4.zip

I have not ventured from the .NET connector for mono and the ESP8266 contained in the Sonoff units. I know 1-wire is supported by the Tasmota software that is installed on the Sonoff, but never tried to understand details. MQTT is part of Tasmota as well as several Aurdino-class products. It may even be possible to get the MQTT libraries from Tasmota or similiar for repurposing. Sorry I cannot be much help, but my breadth of usage is not large.
Hi Michael,

I am trying 3.0.4.4,
In the log I get:
Code:
mcsMQTT	ParseJSON tele/sonoff_caldaia/SENSOR:DS18B20={"Time":"2018-01-09T15:58:37","Switch2":"ON","DS18B20":{"Temperature":54.9},"TempUnit":"C"} Line 0 Length cannot be less than zero. parameter name length
While on the device view the temperature is shown as 549.

Do I need to make the change Petez69 recommends and recompile? However I didn't touch that config file at all.

For the decimal point, I am happy to provide you feedback if you want.
Reply With Quote
  #78  
Old January 9th, 2018, 05:57 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,784
Quote:
These don't appear in a subscription to #, and have to be subscribed to directly. Is it possible to add the ability to subscribe to a topic blindly, even if it hasn't already been published?
Done in 3.0.5.0 http://mcsSprinklers.com/mcsMQTT_3_0_5_0.zip The manual has been updated, but you will find one blank line at the end of the receive topic list and the topic can be entered there and then "A"ccept cliked to create the HS device. Rebuild list to have another blank line. I tried several of the SYS topics and some do not seem to generate data from my Mosquito on RPi.

Quote:
While on the device view the temperature is shown as 549.

Do I need to make the change Petez69 recommends and recompile? However I didn't touch that config file at all.

For the decimal point, I am happy to provide you feedback if you want.
What I understand you want mcsMQTT to do is interpret the payload and if regional settings are such that a period is not a decimal delimiter than covert the period to a comma. This can be done. My concern is for devices that publish their data consistent with regional nomenclature such as publishing temperature as 34,5 (local) rather than 34.5 (US). From your experience are all numbers with fractional parts always published with period as the delimiter?
Attached Images
 

Last edited by Michael McSharry; January 9th, 2018 at 06:18 PM.
Reply With Quote
  #79  
Old January 9th, 2018, 06:14 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,784
Quote:
If you want to create a dirt cheap Temp sensing system, consider this as a possibility...

WeMOS device with a DS18b20 hat, have a look at Aliexpress. You load the tasmota firmware onto the WeMOS and you have a fully functioning Temperature mqtt device.
This is a fine solution. I do recognize the 1-wire support in Tasmota, but have never tried it. Do you know how many of the 1-wire parts have the software support?

What I like about the Sonoff vs. WeMOS is the built-in 3.3V power supply and then the case that protects the circuit board. $4.85 USD delivered from China. I have modified most of mine so the relay is a dry contact rather than line voltage switch. I have also modified others so that the relay output screw connector is used as sensor input and the relay not used. Sonoff HW mods are in the manual for these two.

Next adaption I am going to tinker with is interfacing $2 water alarm/buzzers with the Sonoff. The relay for power control to the alarm and the GPIO14 input for the alarm output. I think it will just be a 3.3v zener and cap to replace the buzzer on the $2 alarm. I have several places I want to deploy a water detector/alarm. I have one Dlink Wifi water sensor that sells for around $60 and in general not too happy with it and it does not integrate well. I have seen units from Xiamoi from around $12 that I think are battery powered with very low consumption and integate with their "proprietary" base unit. I think the base has been hacked for easier HA integration, but in the early stages of looking at it.
Reply With Quote
  #80  
Old January 9th, 2018, 06:18 PM
doppiaemme doppiaemme is offline
Seer
 
Join Date: Nov 2014
Location: Como
Posts: 57
Quote:
Originally Posted by Michael McSharry View Post
My concern is for devices that publish their data consistent with regional nomenclature such as publishing temperature as 34,5 (local) rather than 34.5 (US). From your experience are all numbers with fractional parts always published with period as the delimiter?
Unfortunately my experience is limited to Sonoff using the Tasmota f/w only, I can't speak in general.
I don't know if a different code would present the data with regional settings.
It would make much more sense if this would be configurable on the module's fw but it's not the case today.

Thinking out loud,
perhaps for each subscription, a Regex could be configured to re-format the received payload? A checkbox at the top "Enable Regex" would show or hide this? just my 2 cents :-)
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ERRO Calling SetIOMulti in plugin Arduino Plugin:Object reference not set to an in fvhemert Arduino Plugin (3P) 5 April 28th, 2017 10:15 AM
Nest Plugin Errors - cannot change temperature via plugin TimSRQ Nest Devices (3P) 2 August 15th, 2016 08:48 AM
Upgrade procedure for ACRF plugin from W800 free plugin htsource ACRF Processor (3P) 14 January 26th, 2006 11:21 AM
Switch-to messages, plugin restart, and plugin startup Michael McSharry Plug-In Development 4 January 27th, 2003 11:20 PM


All times are GMT -4. The time now is 11:06 AM.


Copyright HomeSeer Technologies, LLC