A Forum run by Enthusiasts of MidNite Solar

The Open Source software/hardware corner => Raspberry PI => Topic started by: ClassicCrazy on March 23, 2020, 04:08:28 PM

Title: Raspberry Pi Classic monitor using MQTT
Post by: ClassicCrazy on March 23, 2020, 04:08:28 PM
Thanks to Graham and Matt who have been working on Classic Monitoring App - you can now use a Raspberry Pi to monitor mulitple Classics . It reads the Classic via Modbus over IP , then acts as MQTT Publisher so that any other device can get the Classic data. In the past there was the frustrating limit of only one IP network connection to Classic at a time, but using the MQTT you can connect up multiple devices or do whatever you want with the data .  There is also the software to use and Esp32 to talk to the Classic and publish the MQTT data. The MQTT will work without any port forwarding . You can either use an outside MQTT broker or just use the Raspberry Pi locally on your own network .
What I have right now is a Raspberry Pi 3B+ running the software - it gets the data from both my Classics which are in follow me mode. I monitor the data on an old Android phone using Grahams Monitoring app ( the new version available on link) . It reads combines some of the data from both Classics on one screen for a system view.
Here is the detailed forum topic
http://midniteftp.com/forum/index.php?topic=4817.0

Larry
Title: Re: Raspberry Pi Classic monitor using MQTT
Post by: mcsarge on March 23, 2020, 05:31:17 PM
Thanks for the good press Larry!

I am also working on a couple of other projects that will use the data sent to the MQTT broker:

   1. An ESP32 driven RGB LED Panel that will display selected data from the Classic (SOC, Battery voltage, current, etc). Suitable for mounting on a wall to keep tabs on the status of your system.
   2. A web-based display that will show the data from the classic similar to Graham's Android App. This could be displayed on any smart phone, computer or tablet.

If anyone out there is more adept at writing a web site linked to an MQTT broker and needs information on the nature of the data that is published, sing out - I would love to have some help on that.

Matt
Title: Re: Raspberry Pi Classic monitor using MQTT
Post by: schroew on October 12, 2020, 05:49:47 PM
I am trying this out on a Ubuntu system and I can get it to connect and I have this error. What would cause that?

2020-10-12 16:45:48,281:DEBUG:classic_mqtt:Opening the modbus Connection
2020-10-12 16:45:48,391:ERROR:classic_mqtt:MODBUS isError H:192.168.1.126 P:502
2020-10-12 16:45:48,391:ERROR:classic_mqtt:MODBUS data not good, skipping publish
Title: Re: Raspberry Pi Classic monitor using MQTT
Post by: ClassicCrazy on October 12, 2020, 07:44:14 PM
Quote from: schroew on October 12, 2020, 05:49:47 PM
I am trying this out on a Ubuntu system and I can get it to connect and I have this error. What would cause that?

2020-10-12 16:45:48,281:DEBUG:classic_mqtt:Opening the modbus Connection
2020-10-12 16:45:48,391:ERROR:classic_mqtt:MODBUS isError H:192.168.1.126 P:502
2020-10-12 16:45:48,391:ERROR:classic_mqtt:MODBUS data not good, skipping publish

The Classic can only do one network modbus connection at a time - do you have anything else connected like the local status app ?

Larry
Title: Re: Raspberry Pi Classic monitor using MQTT
Post by: schroew on October 12, 2020, 07:58:25 PM
ohhhh, I do... I will stop the local app..
Title: Re: Raspberry Pi Classic monitor using MQTT
Post by: schroew on October 12, 2020, 08:20:28 PM
looks better
{"BatTemperature":19.7,"NetAmpHours":0,"ChargeState":0,"InfoFlagsBits":-1308610300,"ReasonForResting":5,"NegativeAmpHours":0,"BatVoltage":25.5,"PVVoltage":7.4,"VbattRegSetPTmpComp":27.5,"TotalAmpHours":400,"WhizbangBatCurrent":0.0,"BatCurrent":0.0,"PVCurrent":0.0,"ConnectionState":0,"EnergyToday":0.2,"EqualizeTime":3600,"SOC":100,"Aux1":false,"Aux2":false,"Power":0.0,"FETTemperature":26.4,"PositiveAmpHours":0,"TotalEnergy":127.9,"FloatTimeTodaySeconds":733,"RemainingAmpHours":400,"AbsorbTime":7200,"ShuntTemperature":-50.0,"PCBTemperature":33.5}

Title: Re: Raspberry Pi Classic monitor using MQTT
Post by: ClassicCrazy on October 12, 2020, 08:49:48 PM
Matt and Graham have it so the local status app can break in whenever you turn that on because it polls on intervals. Then when you disconnect the Local Status app the MQTT data will resume. Works good that way because you can write changes to settings  no problem without disconnecting anything on the mqtt program.

Larry
Title: Re: Raspberry Pi Classic monitor using MQTT
Post by: schroew on October 12, 2020, 09:09:14 PM
If I make any headway with ELK visuals in Kibana I will share the configs here.
Title: Re: Raspberry Pi Classic monitor using MQTT
Post by: ClassicCrazy on October 12, 2020, 09:19:36 PM
Quote from: schroew on October 12, 2020, 09:09:14 PM
If I make any headway with ELK visuals in Kibana I will share the configs here.

great - thanks - and also  get in touch with Graham and Matt and see if they can add you to the github Slack developer group
https://github.com/ClassicDIY

Larry
Title: Re: Raspberry Pi Classic monitor using MQTT
Post by: schroew on October 18, 2020, 03:00:11 PM
I just got up to my place today and 2/3 controllers are saying Got Comm. I think the MQQT script has something to do with this.
Title: Re: Raspberry Pi Classic monitor using MQTT
Post by: schroew on October 18, 2020, 03:12:03 PM
I think they contributed power today but does anyone know if they will charge the batteries in this state?
Title: Re: Raspberry Pi Classic monitor using MQTT
Post by: ClassicCrazy on October 18, 2020, 06:52:09 PM
Got comm is just communication between controller and MNGP I believe. It shouldn't effect the Classics operation.
I have never seen any issues while using MQTT.
Did you change any of the Classic addresses ?

Larry
Title: Re: Raspberry Pi Classic monitor using MQTT
Post by: schroew on October 18, 2020, 07:10:39 PM
Hmm, I did when I was here last weekend. I changed the mod buss address. They were all at the same address. Was that bad?
Title: Re: Raspberry Pi Classic monitor using MQTT
Post by: schroew on October 18, 2020, 08:28:01 PM
It was something I did when I changed the modus address from 10 to 9 and 8 respectively. I think the MNGP couldn't talk to the classic anymore.
Title: Re: Raspberry Pi Classic monitor using MQTT
Post by: ClassicCrazy on October 18, 2020, 08:28:48 PM
I think maybe there are two addresses to set . There was just a discussion about this recently - I will see if I can find it.

Larry
Title: Re: Raspberry Pi Classic monitor using MQTT
Post by: ClassicCrazy on October 18, 2020, 08:33:19 PM
Take a look at this - was a bit different question about SMA but I think the same principle applies to your situation.
http://midniteftp.com/forum/index.php?topic=5000.msg46537#msg46537

Larry
Title: Re: Raspberry Pi Classic monitor using MQTT
Post by: ClassicCrazy on October 18, 2020, 08:36:11 PM

FNG

    Administrator
    Sr. Member
    *****
    Posts: 277
        View Profile Email Personal Message (Offline)

Re: One Classic 250 MNGP's mirrors the other Classic 250
« Reply #34 on: October 01, 2020, 11:44:59 AM »

    Quote

Ok the issue with addressing the classics using the local app is it does not address the MNGP. You dont want to use the local app for addressing on classics only classic lites.


and this

Actually to address the classic is done from the home screen. On page 21 of this manual

http://www.midnitesolar.com/pdfs/Classic_ClassicSL_Manual_10-001-1_REV_L.pdf

To address a Classic simply use the MNGP that is plugged into that Classicor plug the MNGP into that Classic and hold the LEFT ARROW keydown and tap the UP or DOWN ARROW key. The normal default address is 10 so going up will take you to 11 and down to 9. When you get to the unused address you want for that Classic, hold the LEFT and RIGHT ARROW keys for a second until “Data Sent and Saved” shows up. Now this Classic has been re-addressed to the new address.