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
  #81  
Old January 9th, 2018, 06:37 PM
petez69's Avatar
petez69 petez69 is offline
Seer Master
 
Join Date: Oct 2005
Location: Alice Springs, Australia
Posts: 873
Hi Michael

Having a quick look in the drop down menu of tasmota, the devices I recognise are:

DHT11, AM2301, DS18b20
I2C sensor SI7021
LCD display offers I2C SCL & SDA

I deployed my first Sonoff POW last night with tasmota and mqtt, how cool is that :-) Alexa "turn man cave on" and it turns on the electronics bench :-) Ok on the mods you were doing, I like the sounds of that. I was looking to 3D print a small case for the WeMOS and ds18b20 hat and have a USB connector protrude from the case so it can plug into the back of a USB wall wart to make a temp node.

I had a 5 pack of sonoff basic units also arrive yesterday so I think I'll experiment with bypassing the relay too...as you said inbuilt power supply makes it easy.

Your plugin is doing all the heavy lifting and works like an absolute charm.

Thankyou..Pete
Reply With Quote
  #82  
Old January 9th, 2018, 07:19 PM
petez69's Avatar
petez69 petez69 is offline
Seer Master
 
Join Date: Oct 2005
Location: Alice Springs, Australia
Posts: 873
Quote:
Originally Posted by dopamine View Post
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.
Hi doppiaemme

For a single temp sensor using tasmota, the mqtt message looks wrong. It should have a "," after the temp ie: 54.9,

This is exactly what I had when I made a change in user_config.h

Can you please go and look at these two lines and see if they are "rem'd out"

// 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)
//#define USE_DS18x20_LEGACY // Optional for more than one DS18x20 sensors with dynamic scan using library OneWire (+1k5 code)

Pete
Reply With Quote
  #83  
Old January 9th, 2018, 07:32 PM
petez69's Avatar
petez69 petez69 is offline
Seer Master
 
Join Date: Oct 2005
Location: Alice Springs, Australia
Posts: 873
Michael

This error has crept back in on version 3.0.4.4 I've jsut tried it with 3.0.5.0 and its the same....

ParseJSON tele/sonoff-temp/SENSOR:AM2301={"Time":"2018-01-10T00:24:18","AM2301":{"Temperature":34.6,"Humidity":21.0}," TempUnit":"C"} Line 0 Length cannot be less than zero. Parameter name: length

Regards..Peter
Reply With Quote
  #84  
Old January 9th, 2018, 07:39 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,706
Thanks Pete for the feedback. Odd the parsing error exists as my test payload looks exactly like what you posted. I will look into it.
Reply With Quote
  #85  
Old January 9th, 2018, 10:03 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,706
Quote:
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
Regular Expressions transformation provided in 3.0.6.0. When a Topic is Accepted then Pattern and Replacement text boxes become available. If they are left blank then Payload goes directly into Device. If they are populated then the regular expression is applied to payload. The displayed payload on mcsMQTT setup is before regular expression is exercised.

The transformation of period to comma with something like pattern = \. and replacement = , are one example. I have also tested removal of suffix from a number so the DeviceValue rather than the DeviceString become populated. Other transformation such as Payload into ON and OFF may be other examples.

Quote:
ParseJSON tele/sonoff-temp/SENSOR:AM2301={"Time":"2018-01-10T00:24:18","AM2301":{"Temperature":34.6,"Humidity":21.0}," TempUnit":"C"} Line 0 Length cannot be less than zero. Parameter name: length
Fixed (again) in 3.0.6.0.
Reply With Quote
  #86  
Old January 9th, 2018, 10:39 PM
petez69's Avatar
petez69 petez69 is offline
Seer Master
 
Join Date: Oct 2005
Location: Alice Springs, Australia
Posts: 873
Quote:
Originally Posted by Michael McSharry View Post



Fixed (again) in 3.0.6.0.
Thankyou Michael, no more errors in the logs from the temp sensing
Reply With Quote
  #87  
Old January 9th, 2018, 10:48 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,706
I noticed that I excluded the recently added $SYS topics. I reuploaded 3.0.6.0. May not affect you, but letting you know.
Reply With Quote
  #88  
Old January 9th, 2018, 11:05 PM
petez69's Avatar
petez69 petez69 is offline
Seer Master
 
Join Date: Oct 2005
Location: Alice Springs, Australia
Posts: 873
Quote:
Originally Posted by Michael McSharry View Post
I noticed that I excluded the recently added $SYS topics. I reuploaded 3.0.6.0. May not affect you, but letting you know.
Thankyou, 3_0_6_0 installed...the log is clean :-)
Reply With Quote
  #89  
Old January 9th, 2018, 11:44 PM
petez69's Avatar
petez69 petez69 is offline
Seer Master
 
Join Date: Oct 2005
Location: Alice Springs, Australia
Posts: 873
Michael/epimetheus

Thanks for the pointer of the $SYS topics....client count now added :-)

Pete
Reply With Quote
  #90  
Old January 10th, 2018, 09:57 AM
doppiaemme doppiaemme is offline
Seer
 
Join Date: Nov 2014
Location: Como
Posts: 57
Quote:
Originally Posted by Michael McSharry View Post
Regular Expressions transformation provided in 3.0.6.0. When a Topic is Accepted then Pattern and Replacement text boxes become available. If they are left blank then Payload goes directly into Device. If they are populated then the regular expression is applied to payload. The displayed payload on mcsMQTT setup is before regular expression is exercised.

The transformation of period to comma with something like pattern = \. and replacement = , are one example. I have also tested removal of suffix from a number so the DeviceValue rather than the DeviceString become populated. Other transformation such as Payload into ON and OFF may be other examples.

Fixed (again) in 3.0.6.0.
This was awesome! The regex worked like a charm!! thank you!
Reply With Quote
  #91  
Old January 10th, 2018, 07:56 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,706
After playing a little with the regular expression I found it was sometimes easier to find the pattern of interest rather than finding the part that was to be replaced. I provided a checkbox option to select Extract mode (checked) vs. the Replace mode (unchecked). 3.0.7.0 http://mcsSprinklers.com/mcsMQTT_3_0_7_0.zip is backward compatible with 3.0.6.x. The manual has been updated and contains a page of examples.
Reply With Quote
  #92  
Old January 10th, 2018, 08:23 PM
petez69's Avatar
petez69 petez69 is offline
Seer Master
 
Join Date: Oct 2005
Location: Alice Springs, Australia
Posts: 873
Quote:
Originally Posted by Michael McSharry View Post
The manual has been updated and contains a page of examples.
Hate to sound ignorant :-) and look in all the wrong places, where is the updated manual ? The enclosed PDF is dated 12th December 2017.....

Pete
Reply With Quote
  #93  
Old January 10th, 2018, 09:58 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,706
At the top of the thread is the link to the pdf file. I uploaded again now just to be certain.
Reply With Quote
  #94  
Old January 13th, 2018, 01:57 PM
adeux adeux is offline
Seer
 
Join Date: Sep 2015
Location: UK
Posts: 39
Hi,

just installing your plugin to test with MQTT json weather data.

Some initial wrinkles are that:

1. In the 'Release Info' link in the HS installer the message board link points to your xAP thread and not this one;

2. On a RPi running HS3 ZEE S2 Edition 3.0.0.399 the installer fails with the following error in the log:
Updater Error Unable to open install.txt file for update \usr\local\HomeSeer\Updates3\mcsMQTT3.0.0.0

Looking at that the slashes are win \ rather than Linux /
Reply With Quote
  #95  
Old January 13th, 2018, 02:04 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,706
Thank You for the feedback. I have been working with Tyler at HST to try to get the updater setup for mcsXap and mcsMQTT. I suspect that CES has had priority the past week or so as it has been silent.

Are you able to get it installed manually?
Reply With Quote
  #96  
Old January 13th, 2018, 03:50 PM
aldo's Avatar
aldo aldo is offline
Super Seer
 
Join Date: Feb 2002
Location: Massachusetts
Posts: 1,631
Michael/All,
I love all your plugins. I start to see lot of topics about your new plugin. Mloebl is helping me on another post https://forums.homeseer.com/showthread.php?t=193054. Unfortunately I need some extra guidance from all of you if possible. Right now I have a JSON that is outputting on the screen where I see my meter reading. Would it be possible to integrate it in your plugin? I read your documentation, unfortunately I could not find any example on how to use MQTT. I'm starting from zero here.

Thanks,
Aldo
Reply With Quote
  #97  
Old January 13th, 2018, 05:47 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,706
I took a quick look at the referenced thread and see the script that reads JSON and then publishes to MQTT. It is not clear to me what you are trying to achieve, but assuming that you want to take what Mloebl has done and have the data show up in HS3 then mcsMQTT could be used for this purpose. What I did not see was how Mloebl was using the info published on MQTT.

To run MQTT you need to install Mosquito (do google search). RPi is what I used. Windows can also be used. Mosquito is much like an xAP hub in the xAP world where it routes messages. The script that Mloebl posted would send it on LAN using MQTT protocol. Mosquito would resend it. mcsMQTT would see it and put the data into HS3 devices.

While MQTT is an good communication standard for this purpose, if you only will only have this one use, then it would be a shorter path to use the HS3 API to store the data into HS3 devices directly (Script->HS3) rather than using the (Script->MQTT->LAN->MQTT->HS3) routing. Setting up MQTT is easy and well documented on the web. It does provide segue to many other IOT devices. As a side note mcsMQTT does decode JSON into multiple HS3 devices so transmitting the original data from your sensor may be all that you will need.
Reply With Quote
  #98  
Old January 13th, 2018, 07:03 PM
aldo's Avatar
aldo aldo is offline
Super Seer
 
Join Date: Feb 2002
Location: Massachusetts
Posts: 1,631
As always Michael, thank you. What I try to accomplish at this point almost impossible is to read a JSON file that is located on another machine and import it into a 1) ideal mysql or 2) in HS3. Any suggestion would be greatly appreciated.

Thanks
Aldo
Reply With Quote
  #99  
Old January 13th, 2018, 07:32 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,706
Since your objective to store data in mySQL then it seems the most direct way to accomplish it is to connect to your database via script and execute the SQL statement that stores a new record in that database. If you are staring with a python script that decodes the JSON data then it seems that the statements that send MQTT would be replaced with statements that do the mySQL activity. I am not a python user, but a google search brings up an example such as https://stackoverflow.com/questions/...base-in-python I use vb.net in a few applications that publish the mySQL so I provide that syntax if it helps.

If you want to go the MQTT route then I can help there as well. That requires that you install mosquitto on one of your computers and mcsMQTT on the HS3 computer. The script that Mloebl posted I would expect to be the front end for whatever approach you take.
Reply With Quote
  #100  
Old January 14th, 2018, 07:44 AM
adeux adeux is offline
Seer
 
Join Date: Sep 2015
Location: UK
Posts: 39
Quote:
Originally Posted by Michael McSharry View Post
Thank You for the feedback. I have been working with Tyler at HST to try to get the updater setup for mcsXap and mcsMQTT. I suspect that CES has had priority the past week or so as it has been silent.

Are you able to get it installed manually?
Thanks, yes I have installed it manually using the file locations from install.txt - seems to come up

Just RTFM at the moment.
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 01:16 AM.


Copyright HomeSeer Technologies, LLC