A Forum run by Enthusiasts of MidNite Solar

The Open Source software/hardware corner => Raspberry PI => Topic started by: welmore on October 26, 2017, 12:44:45 AM

Title: Classic Monitoring with a raspberry pi
Post by: welmore on October 26, 2017, 12:44:45 AM
Greeting.  I have been working with Binkino on a web based Classic monitoring project.
It works with a raspberry pi that reads the Classics and provided a web based display.
This project assumes two Classics with a Wizbang jr attached to Classic #1.
You will need a raspberrypi loaded with Apache and PHP.
The attached zip file has all the files you will need.
Unzip the file into a folder named "Solar" in your host root folder.  Mine is "/var/www".
In the Solar folder, create a folder named "Data".
Open the permissions on the Data folder.
In "Logging.php" edit;
$Solar1="192.168.0.121" for your Classic #1 IP address. 
$Solar2="192.168.0.122" for your Classic #2 IP address.

On the pi, open a browser and start "IP address of your pi /Solar/Logging.php".
If youget error messages and the data is mostly zeros, you are not connecting to the Classics.
Keep this running.
It will create a "current.txt" file in the Data folder.  This file is the most recent data from the Classics and is used by the monitoring pages.
If this file is not created, check your permissions.
On the same pi or any computer on the same network, open another browser and start "IP address of your pi /Solar/Solar_Monitoring.php" or "IP address of your pi /Solar/Solar_Monitoring_Gauges.php".  You should see the display.

Some data will not be valid until "Logging.php" has been running past midnight.
"Logging.php" also creates a "Solar_log.dat" file.  This file is update every midnight with the prior days highs, lows and end of day data.  It is saved in CSV format.
"Logging.php" also creates files named "year month day .txt" .  These files save all teh data read from the Classics. .  It is saved in CSV format.
 I plan on providing a review page that will use these files.

I tried to comment out the files I wrote to aid you if you want to tweek them.  I attached a file "registers used" which has information about the variables used.
Binkino also created a  nice display also.  It uses the same Logging.php and current.txt files.

If  you have questions, comment please reply to this post, or email me at wade_elmore@comcast.net.
Have fun.
Title: Re: Classic Monitoring with a raspberry pi
Post by: binkino on October 26, 2017, 07:12:39 AM
Thats great ;)

So here are my files with date 26 OCT 2017

Here you find the Monitoring files, with my changes.
Place the files from the zip in the same folder like the installed files.
With my files, you need a sub-directory "js" (gauge.min.js) so the js file don't has to be loaded from external source
and "lc" with all the graphics for the "LCARS" pages -  here are 2 more zip in attachment of this post.
For the gauges and the old LCARS version, you need the sub-folder "pic" with the content of the pic.zip file.

The files are showing the state of today - so they are not perfect and finished yet.
But they can be a good start for everyone, who is interested in it.

I tried to clean up all this crazy spaghetti looking code, but also not perfect and if you have recommendations, please let me know. I did it on the way I can do it and trying and looking for code and maths that works.

And keep in mind, the temperatures are in °C Celsius, not Fahrenheit (exp. the original page from Wade) and the namings are in german. If there are questions, please also ask.

IMPORTANT: the Lcars Graphics, like I use the one in the right side for coming use, I have copied from the web and changede the graphics a bit. So if you publish the page, keep this in mind, so you don't run in trouble.

Title: Re: Classic Monitoring with a raspberry pi
Post by: binkino on October 26, 2017, 10:34:29 AM
I recommend:
For new beginners, please use the source page from Wade, write down the Classic-Numbers you need to know, when you want to display a value. Helped me so much. So you don't have to search thru other files ...
-> see attached photo
With this note you have a excellent quick view, which data# for which value you need to set in the code.
Also you can look thru the php files, and see how single displayed values are displayed.
In the first versions, we used a pure PHP form, then switched over to use the header for the code information and scripts, following html code with php code inserts. This also makes it possible, to edit the pages in an WYSIWYG editor (like Frontpage 2000/2003) and do fine tuning later in source text code.

For all those who want to setup a PI from scratch for this purpose, I will do a "how to" ... based on my PI.
Also with examples of code, links to all used things.
(But give me some days to do this, possible end of next week. Or I make a video ... we will see... If weather is good, I first have to finish some work on my cars)
Then, you should be able to transfer this also to other PIs. We find solutions for other PIs as well, they mostly work here too.
There are differences; but at the end it is all Linux /based and only small diffs we don't really have to think about.

For my system, I use a BananaPI M1 (2core) and yesterday I have received the BananaPI M2 (4core). On this M2 I will show the way to the goal.
I have tried the cheaper OrangePI but I am running against walls with it; a nightmare! So don't waste your time and money.
(finding a working image is an adventure. OSes are not running stable. CPU has also 1Ghz, but while the BananaPI idles about 10% the OrangePI is on 40% and very quick on 100% and freezes for seconds and/or crashes. But it is your decision.)

At this point, finally my opinion:
RasPI is the "yellow of the eg". No discussion from my side :)
But next cheaper and working Board (and has also Sata on board, that was important for me) is the BananaPI ...  and in all its flavors.
Okay, on BananaPI you don't have the best support (see topic: screen resolutions ... 1024x768 and 1280x720 with bad tricks only) but it is much much better, then for OrangePI.



Edit: I have been playing around with the BANANA PI M2 BERRY and it runs well, BUT it don't recognize my monitor while booting and in the loaded OS. Only, if I unplug the HDMI and plug it in again. That is no way for me.
So I am back on my BANANA PI M1 and will see, what else is on the marked.
On the M1 it also runs well. The CPU power with 1Ghz and 1GB of ram is limited, but it runs 100% stable here.
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on October 26, 2017, 12:08:11 PM
Thanks Wade and Bikino . I am planning to trying these out in the future when I get some time.

Bikino - have you tested the power requirements of the various boards you have tried ? I just checked my older Raspberry Pi B that has wifi dongle and weather station dongle plugged in and is running the Weewx weather program and it takes about 2.7 watts .

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: binkino on October 26, 2017, 01:04:43 PM
yes I can measure this. will post it later when I am back home (~ 5hrs)



in the web I found a German page about the Banana PI as a NAS (like I used it before)
https://nas-selber-bauen.de/energieverbrauch-des-banana-pi-nas/

Booting (min.)                3.7 watts
Booting (max.)                4.3 watts
Idle (cheap PSU)             3.7 watts
Idle (Anker PSU)             3.4 watts
Idle (sleeping HDD / cheap PSU)    2.8 watts
Idle (sleeping HDD / Anker PSU)    2.6 watts
Max. computing power          5.2 watts
Max. data transfer (SD-card)       4.8 watts
Max. data transfer (HDD)          5.8 watts
Max. computing power + data transfer (HDD)    6.2 watts

I hope my translation makes sense :D

--------------------------------------------------------------------------

I was hoping, I can start all 3 PIs with one image, so I have the same OS and programs and load on all of them, didn't work.
Need more time, but I can tell ...
The Orange PI takes 0.085 A when no card and OS not loaded, when OS loaded and is starting all the things, it goes up to 0.62 A (3.1 watts)
The Banana PI M2 takes 0.06 A when no card and OS not loaded.

Have now downloaded an image, installed and wrote a "how to" (this will follow tomorrow after some hours of sleep and re-read it haha)


The M2 takes 0.3 to 0.4 Ampere while booting and when running, between 0.25 and 0.42 Amps
At 5 volts this is in watts: 1.25 to 2.6 Watts.
If you add some more hardware, this will increase the power hunger.
I think, they all are close similar in power consumption.


Thanks to 2 more cores on this PI, the browser starts much faster and only goes up to 75% while starting, then down to < 10 % only. Sometimes 17% when it is getting datas.

Only thing I miss on the M2 is the missing connections for a battery ... works like a UPS ...
(have not seen the connections on the PCB for now ...)

Title: Re: Classic Monitoring with a raspberry pi
Post by: welmore on October 28, 2017, 05:37:12 PM
I discovered a bug. 

The Classics reset some of the registers at midnight, according to their clocks. 

The 'Logging.php' program keeps high and low data for each day.  'Logging.php' resets the data when the date changes, according to the pi's clock.

If the pi's clock is ahead of the Classics clock, the prior days Classic registers gets saved to the new day.

I have a fix.  I changed 'Logging.php' so it reads the time  and date from the Classics, not the pi.  I have it resetting the high and low data and starting the new daily log when Classic #1 changes dates and both Classics time is 00:00. 

Note: Even with the follow me cable and Classic #2 told to get its time from Classic #1, there can be slight differences in the time.

I am testing the patch over night and will post it when it passes.

This fix to 'Logging.php' does not require any changes to the monitoring programs.
Title: Re: Classic Monitoring with a raspberry pi
Post by: estragon on November 06, 2017, 05:12:43 PM
I'm looking at using a Rpi3 to monitor, mainly unattended over the winter.  In past years, I've had problems with snow covering panels, and even the Classics self-consumption has been a problem, so the Rpi consumption, even at ~5w or a bit under, could be just adding to the problem. 

To address the Rpi power consumption, I've added a "SleepyPi2" from SpellFoundry.com in the UK.  It's basically an Arduino with a real time clock that can turn the Rpi on and off (proper shutdown) according to time of day, time elapsed, etc.  It will also have to control power to hub, router, WAN router, and cellphone booster.  The idea is to wake up once a day, read stuff from the Classics, report status, maybe wait for a bit in case I want to log on remotely, turn stuff off, and go back to sleep.  If I really wanted to save power, I could get it to just read battery voltages and go back to sleep if everything's okay, but I think I'll work on getting it to do daily reporting for now.

I just got the gear, but so far it looks like it should do the job. 
Title: Re: Classic Monitoring with a raspberry pi
Post by: Westbranch on November 06, 2017, 08:02:29 PM
looks like they run on 5v and sip their amps....

Other Raspberry Pi models
Pi Model   Pi State   Power Consumption
model 3 B   HDMI off, LEDs off, onboard WiFi   250 mA (1.2W)
model 2 B   HDMI off, LEDs off   200 mA (1.0W)
model 2 B   HDMI off, LEDs off, USB WiFi   240 mA (1.2W)
Zero   HDMI off, LED off   80 mA (0.4W)

Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on November 06, 2017, 09:27:43 PM
I am tempted to get a Pi Zero W ( the new  model ) and see if it would run my Weewx weather program - I looked it up and it sounded like someone simply took SD card out of a regular Pi and put it in the Pi Zero W and it ran okay .  Ha - nothing works that easy ! They only cost $10 but you can only buy one at a time now so shipping probably jacks the price up - that is why I was hoping the supply would increase so I could get more than one .

If it works then I could get on the Midnite monitor project sometime.
Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: binkino on January 15, 2018, 03:24:03 PM
JUST 4 FUN  ;)

I just have played with a version for my phone in "portrait" mode:
http://a68k.de:81/Solar/Monitor_G1.php

Will be depending of the screen resolution... - I still have made it for my MOTO G5  (has 1920 x 1080 / 441 PPI)
Will test it later with my older phones and my 7" ASUS (they have lower resolutions)
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on January 15, 2018, 06:36:12 PM
JUST 4 FUN  ;)

I just have played with a version for my phone in "portrait" mode:
http://a68k.de:81/Solar/Monitor_G1.php

Will be depending of the screen resolution... - I still have made it for my MOTO G5  (has 1920 x 1080 / 441 PPI)
Will test it later with my older phones and my 7" ASUS (they have lower resolutions)

Is this sort of like Grahams Classic Android app  with the android connecting to Classic via modbus ? Or is this somehow using the Raspberry Pi ?

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: binkino on January 17, 2018, 09:26:05 PM
no this is still the PI
just another version
looks also good onb my older Moto G2 and my Asus 7" in portrait mode, have nothing to change
also tried a horicontal version, not finished yet, http://a68k.de:81/Solar/Monitor_G2.php
Title: Re: Classic Monitoring with a raspberry pi
Post by: binkino on March 28, 2018, 09:21:02 PM
now it is running well, i have another idea to add,
how can i display the generated energy of x-days in a list?
we have the data of the generated energy 'today'
but after 24:00h it is zero, and i like to see the value of the last day also, and if possible from some days before.
possible i could copy the data to a time (i.e. 23:55h) to a new value (like "$energylastday")
(if $time = 23:55:00 then  value 10 + 37 = $valuelastday, or so)
may bs i can shift the values day by day...

or do we have access to the saved log files in the data folder?
Title: Re: Classic Monitoring with a raspberry pi
Post by: welmore on March 31, 2018, 10:25:13 AM
Can be done.  How may days back would you like?  How do you suggest I display it? 

I'm thinking seven day summary as list with date, peak watts for each charger for the day and  kWhr for each charger for the day and total combined kWhr.  List will be below gauges.  You will have to scroll down to see it.

I will start working on this.

I am also working on
     1  Automatic vent covers for the battery area.  Covers will open and fans start when there is charge current to the battery, and close and fans stop when there is a drain on the batteries.

     2 Switching from a desk top monitor to a 7"LCD screen on the logging pi.  Will rearrange my gauges screen to fit on the LCD.  Will also add tabs to other screens.  This pi will also control lawn sprinklers and other items around my house.

Title: Re: Classic Monitoring with a raspberry pi
Post by: binkino on March 31, 2018, 08:30:41 PM
Yes, 7 days are perfect ;)

Title: Re: Classic Monitoring with a raspberry pi
Post by: welmore on April 22, 2018, 12:16:19 PM
Here is an updated "Logging.php" file.

   There are some new comments added.
   The issues with the "Solar_Log.dat" file is fixed.  The old version caused multiple entries each day.
   New code to update and display the "history.txt" file was added.

At the bottom of "Solar_Monitoring_Gauges_plus.php" is the code to ready and display the history information.

<?php
//Display history
$HistoryLog = fopen ($dir."history.txt","r");
for ($a = 0; $a <= 6; $a++){
   $History[$a] = fgetcsv($HistoryLog);
}
fclose($HistoryLog);
echo('<br><table><tr><td ALIGN=Center>Date<td ALIGN=Center>S1 Peak<td ALIGN=Center>S1 kWhr<td ALIGN=Center>S2 Peak<td ALIGN=Center>S2 kWhr');
for ($a = 0; $a <= 6; $a++){
   echo('<TR>');
   $HDay=$History[$a];
   echo('<td ALIGN=Center>'.substr($HDay[0],4,2).'/'.substr($HDay[0],6,2));
        echo('<td ALIGN=Center>'.$HDay[1]);
        echo('<td ALIGN=Center>'.number_format($HDay[2],$decimals=1));
        echo('<td ALIGN=Center>'.$HDay[3]);
        echo('<td ALIGN=Center>'.number_format($HDay[4],$decimals=1));
}
echo('</table>');



?>

Feel free to rearrange as you wish.

The "history.txt" file needs to be in your "Data/" folder there the "current.txt" file is.

The existing history data is from my system.  It will rotate out in 7 days.

Each day, around midnight, the "Logging.php" program will update the "history.txt" file, add a daily record to "Solar_log.dat" and reset the daily highs and lows saved in Dlog_Data

Contact me with questions, comments, or suggestions.

Have a great day

Others interested, I will supply all required files and instructions on request.
Title: Re: Classic Monitoring with a raspberry pi
Post by: binkino on April 23, 2018, 02:34:20 PM
Thanks Wade, that makes it so complete and perfect now,
have added the code to one of my gauges page and to my Lcars page and now waiting for it collects some days data and then I will see, how I can finetune it on my Lcars page.
(see link below)
If someone want to have the code for one of my pages too, let me know in comment / post here
Title: Re: Classic Monitoring with a raspberry pi
Post by: Jose Miranda on May 13, 2019, 09:26:09 AM
Hi guys. Is this code being maintained somewhere? Where can I get the latest code?
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on May 13, 2019, 01:12:40 PM
Hi guys. Is this code being maintained somewhere? Where can I get the latest code?

If using a Pi I would move on to using Node -Red - seems a more powerful tool to use and easier too.
There is a post on Node-Red on forums here.

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: Steve_S on May 26, 2019, 10:42:01 AM
I'm just catching up on the forum here and saw this and I am very intrigued indeed.   

While I don't mind the software for my C-200 and it's useable, it's just a tad "lacking" shall we say.  Now I don't have a Raspberry but have been pondering getting into them over the last couple of years as I've realized they can be used for many things.  I'd like to be able to setup a Pi that could gather the stats from my C200 and if possible from my new Samlex EVO-4024 Inverter which I could then access from my PC.  Although, I'm not sure of the Samlex capabilities the spec's state the following:
Quote
RJ-45 Jacks for Communication Ports “COMM 1” and “COMM 2” - for rS-485 networking and MODbUS Serial Communication Protocol (for future use)   RJ-45 Jacks for Communication Ports “COM 3” and “COM 4” - for “CANbus” Serial Communication Protocol (for future use)

Other uses for the Pi could be to manage my heat recovery / air exchanger ventilator (fan speeds related to temps) and such.  I know that's beyond the scope of this topic but I'm hoping you would be able to recommend a good Pi bundle (there are so darned many, it's nuts!) that could / would best accommodate me.

Thanks
Steve
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on May 26, 2019, 01:31:41 PM
You probably want the latest and greatest Raspberry Pi 3 B + model.
If you want to wait a bit there is supposed to be a Raspberry Pi 4 coming out but I don't know details.
As to where to purchase - depends on if you want to get the complete kit with power supply, a case, the sd card, etc or just the board which is abut $35 . Get the kit if you don't have all that other stuff laying around and the case is a good idea.
Lots of places to look for what you get for the money - Amazon, Adafruit, Ebay, Ali Express. Make sure you don't get an old Raspberry Pi 3 model - it has to be 3 B+
https://www.adafruit.com/category/105
Also a good quality SD card makes a big difference


For what you want to do Node Red is the way to go so if you can figure that out you have it made . Lots of tutorials on Node Red - I like Andreas Spiess on Youtube .
here is his latest video but look back at the others
https://youtu.be/z1y6j8-V7J0

Larry

Title: Re: Classic Monitoring with a raspberry pi
Post by: Steve_S on May 26, 2019, 04:27:46 PM
Thanks for the speedy response Classic Crazy.

RE-Edit:

I just purchased the CanaKit Raspberry Pi 3 B+ (B Plus) Starter Kit (32 GB EVO+ Edition, Premium Black Case)
https://www.canakit.com/raspberry-pi/pi-3-model-b-plus-kits

According to Tom's Hardware (which is usually pretty darn on the ball) the Pi 4 won't be out till 2020...
REF https://www.tomshardware.com/news/raspberry-pi-4-everything-we-know,38539.html (https://www.tomshardware.com/news/raspberry-pi-4-everything-we-know,38539.html)

Looking forward to getting the package next Friday, hopefully it rains so I can play with it ;-)
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on May 27, 2019, 03:05:53 PM
Thanks for the speedy response Classic Crazy.

RE-Edit:

I just purchased the CanaKit Raspberry Pi 3 B+ (B Plus) Starter Kit (32 GB EVO+ Edition, Premium Black Case)
https://www.canakit.com/raspberry-pi/pi-3-model-b-plus-kits

According to Tom's Hardware (which is usually pretty darn on the ball) the Pi 4 won't be out till 2020...
REF https://www.tomshardware.com/news/raspberry-pi-4-everything-we-know,38539.html (https://www.tomshardware.com/news/raspberry-pi-4-everything-we-know,38539.html)

Looking forward to getting the package next Friday, hopefully it rains so I can play with it ;-)
Keep us posted on your project - check out section on here about hooking Classic up for Node Red.

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: Steve_S on May 31, 2019, 02:45:54 PM
The CanaKit Raspberry Pi 3B+ arrived with all it's goodies.  Amazing little piece of kit I must say, went together in < 5 minutes and was up & running in 10 !  Heck it even drives my LG 47" LED TV (which is what I use for a screen).  Love that I can use a wireless Logitech Keyboard & Mouse without hassle, that's a big saver.

Andreas Spiess on YouTube is amazing, he's my kinda guy for sure... Thank Goodness I have YouTube-DL & the YoutubeDLfronEnd for windows  REF:  https://cresstone.com/apps/youtubeDLFrontEnd/ so I downloaded all his relevant video's (far faster than viewing online and with a Satellite Internet Service, much better to DL and watch at my leisure.  One key issue raised by Andreas is speed & performance with the DB's storing all the logged data to an SD card and that can be worked around.  One Option is to use a USB connected SSD or high performance drives with much more capacity and greater reliability AND you can actually boot from them too with the native OS.

I've been delving into Node Red which certainly looks to be the right tool BUT I'm going farther with this and going to use Grafana & InfluxDB and possibly another bit of software.

You made reference to a possible Pi 4 version coming out.  Well I've been doing more research and asking questions and the Tom's review is correct and it will be a while BUT !  Yep, there is a BUT in there...   Have you looked at Orange Pi ? 

Now they have faster models using a slightly different ARM processor, all Raspberry stuff works on them, fully compatible.  They also have models with a variety of features & functions as well and the pricing is equally as attractive to boot.  One BIG HUGE BONUS is that several models come with 2GB on board plus more and they have some more flexibility for attached devices.   

Check this out:
Orange Pi Plus 2E  @  http://www.orangepi.org/orangepiplus2e/
Orange Pi 3 @ http://www.orangepi.org/Orange%20Pi%203/   (note it has a Quad Core 1.8 Ghz CPU and up to 2GB Ram).

I believe I will be posting in the other thread related to Node-Red and more as that will be more relative to where I am going with this.  Hopefully, I'll be able to connect my Classic & my Samlex Inverter to my software AND if there are some good souls out there with other Inverter/Chargers and Solar Related devices like controllers, they'll share the Modbus info so I can setup a DB with various models of gear...  Time will tell and I'm not in a Rush to do this, it's hobby thing so Bad Weather Days  & "Winter" or when I'm bored (doesn't happen that often).

Have a Marvelous Day everyone.
Steve
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on May 31, 2019, 03:07:35 PM
Great Steve - looking forward to seeing your contributions on the Node - Red section soon.
I kind of dropped it for the summer now that I am busy with outside stuff.
I have been using a Pi Zero W on all the time that just runs Weewx program that interfaces with my weather station - it just works and is very stable and other than updating Pi stuff now and then I don't mess with it much.
I log into via SSH from my computer and if I want to get into it graphical I can use VNC server for that using my laptop - so don't need any wires going into it - all works via it's wifi link.
One note on the Node - Red - when I first used it I had serial link to the Classic but after I set up my Classics on Follow Me the serial link doesn't work any longer . So I need to now use modbus connection over IP which then limits to one application - like if you use Local Status App then that is the one - you need to disconnect to use Node Red over IP or if you used Grahams Android Classic monitoring app then that would be the only one and you could need to disconnect that . Just keep that in mind if you have problems connecting over IP only one connection at a time .

I never looked at the Orange Pi . As long as it works with same amount of support for Raspberry Pi that is okay.
I have a Pi 3 B+ here that should keep me busy for awhile in addition to the Pi Zero W - I also have another one of those to use with Motion Eye and a video camera that plugs into the pi camera slot .

Lots to do !
Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: smartdave on June 06, 2019, 01:17:46 AM
There seem to be a few code zips in this thread.

Coming late to the party I guess...
Do I need a Full LAMP stack?  Or just Apache and php?

What are the latest version of code that have been written?  I have a classic 200

Thanks

Dave
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on June 06, 2019, 10:48:34 AM
There seem to be a few code zips in this thread.

Coming late to the party I guess...
Do I need a Full LAMP stack?  Or just Apache and php?

What are the latest version of code that have been written?  I have a classic 200

Thanks

Dave

I would suggest  checking out  Node Red - it has more capabilities . There is another thread about that .
http://midniteftp.com/forum/index.php?topic=4081.0

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: Steve_S on June 06, 2019, 01:08:04 PM
There seem to be a few code zips in this thread.

Coming late to the party I guess...
Do I need a Full LAMP stack?  Or just Apache and php?

What are the latest version of code that have been written?  I have a classic 200

I'm just setting up my new Pi 3B+ for this purpose as well as monitoring a few other things.  I've taken this project a bit further as I am incorporating the following: 

Raspian OS
- Node-Red
- Node-Red Dashboard   https://flows.nodered.org/node/node-red-dashboard
- Node-Red-contrib-modbus 4.1.3  (includes Serial & TCP) https://flows.nodered.org/node/node-red-contrib-modbus
- InfluxDB Time Relational Database  https://www.influxdata.com/
- Node-Red-contrib-influxdb 0.2.2  https://flows.nodered.org/node/node-red-contrib-influxdb
- Grafana Analytics & Monitoring https://grafana.com/

I partitioned & formatted a 240GB SSD Sata Drive and set that as boot device because the DB will be storing a lot of data over time.  This makes my installation slightly different.

After installing everything with a Fresh Rasparian, node-red and the rest, I ran Peter Scargills "the script" and ensured that everything I wanted was selected  and let it update everything (this takes a while).  There were a few errors during that update so after a reboot, I restarted and reran it and all came out 100%.   The Script is GENIUS and strongly suggested.  Here it is:  https://tech.scargill.net/the-script/

There is no need for Apache / Lamp to act as a webserver as Node Red (dev & dashboard), Grafana communicate directly.  InfluxDB is a command-line interface.  IF you wanted to do this without Node-Red there is Modbus for Java & Python that would accommodate using regular webpages as in the other thread but that is IMO a more complicated approach.

This Tutorial / Overview got me started on this particular path.  Have a peek and look at some of his other videos which tie  many things together.  https://www.youtube.com/watch?v=JdV4x925au0&t=3s    Also, there is other YouTube vid's that cover Solar & Node-Red and more... 

I may actually do up an article on setting up a Pi for this purpose including how to setup an SSD or other HDD as the boot device as there is some out of date info that can lead down a wrong path.  Of course that will likely take some time as it's mid busy season now that summer is attempting to start !  (well it seems that way at this moment).

BTW:  I have been playing with the flows posted in here...  some good potential in all of this and room to really expand on.  I will be posting flows as I work my stuff out.

A note to ponder on:  I'm using a combo of Node-Red Dashboard because not only can that be used to present the data in Real Time (system status etc) but it also has facility send setting changes (with extreme caution) to the Modbus device (using the Modbus lib I posted).  The Grafana and InfluxDB is for the longer term view of performance & generation and allowing to generate a nice view that results from eh data collected.   Ultimately, I would like to have my Classic-200, the Samlex 4024 Inverter/Charger and my Weather Station all  plugged into the Pi and collecting data. 

Hope that Helps,  Good Luck.
Steve
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on June 06, 2019, 06:17:04 PM
That is fantastic Steve . You should start a new topic and copy your last post there . Then if you could share the flow I could try it out sometime since that is easy ( you did most of the work !) .
Thanks for sharing !
Do you think I should ask the moderators to make a new Node Red forum or just keep it on here ? I was putting my Node Red stuff on General opensource since it can be used with Windows and not just Raspberry Pi , although some of the things you are using like Grafana - maybe that only works with Linux ? 

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: Steve_S on June 06, 2019, 08:10:34 PM
This is a Raspberry Pi Forum so Node-Red falls under that IMO.   BUT that being said, Node-Red IS cross Platform and works on Windows too but I don't know about everything else, I do believe that InfluxDB is also Multi Platform but Grafana ?

I will likely start my own thread series as I like to document a things as I go along.   I'm doing "upgrades" again this evening as I got a new Big Case, Fan (don't like CPU @ 61C) and an RTC clock so it keeps time for itself.

Because of my setup here... having a separate PowerHouse 60 feet from Cabin and having my solar rack even farther away I have to organise a few things up...  I want to be able to run this 7/24 BUT I do not want to have the satellite (I'm remote Sat is my internet etc) which is a power pig, so it will likely be located in the powerhouse & attached to my battery bank through the 12V circuit I have running off it...  I'll just have to find an "adapter" that will step that down to 5V-3A and another for the Router which I think is 4.5V

So far I have my flow talking to the Classic but that needs serious lovin to clean it up and once I have that the way I want, then I'll dashboard it with Node-red.  I really don't see too many issues with the Classic itself and sure am hoping the folks @ MidNite are considering all of this with their new Inverter/Chargers (B17 ?) too. 

My biggest issue at this time, is with Samlex Inc !  Their Inverter has Modbus but they've never released the information on it and are not forthcoming with that.  They are discussing it at Corporate now because I presented a case scenario which would increase their profile in the RE Sector.  Ironically, they have RJ45 connectors but I do not believe they are Ethernet but rather some form of Serial so I'll have to get an engineering type to look at that... maybe I'll have to use an RS485 port or something... ugh....
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on June 06, 2019, 09:25:00 PM
I asked Midnite if they would want to make a Node Red heading for forums here.
Will be interesting to see your project.
I get what you mean about being busy in the summer now !

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on June 07, 2019, 09:55:20 AM
This is a Raspberry Pi Forum so Node-Red falls under that IMO.   BUT that being said, Node-Red IS cross Platform and works on Windows too but I don't know about everything else, I do believe that InfluxDB is also Multi Platform but Grafana ?

I will likely start my own thread series as I like to document a things as I go along.   I'm doing "upgrades" again this evening as I got a new Big Case, Fan (don't like CPU @ 61C) and an RTC clock so it keeps time for itself.

Because of my setup here... having a separate PowerHouse 60 feet from Cabin and having my solar rack even farther away I have to organise a few things up...  I want to be able to run this 7/24 BUT I do not want to have the satellite (I'm remote Sat is my internet etc) which is a power pig, so it will likely be located in the powerhouse & attached to my battery bank through the 12V circuit I have running off it...  I'll just have to find an "adapter" that will step that down to 5V-3A and another for the Router which I think is 4.5V

So far I have my flow talking to the Classic but that needs serious lovin to clean it up and once I have that the way I want, then I'll dashboard it with Node-red.  I really don't see too many issues with the Classic itself and sure am hoping the folks @ MidNite are considering all of this with their new Inverter/Chargers (B17 ?) too. 

My biggest issue at this time, is with Samlex Inc !  Their Inverter has Modbus but they've never released the information on it and are not forthcoming with that.  They are discussing it at Corporate now because I presented a case scenario which would increase their profile in the RE Sector.  Ironically, they have RJ45 connectors but I do not believe they are Ethernet but rather some form of Serial so I'll have to get an engineering type to look at that... maybe I'll have to use an RS485 port or something... ugh....

New Node Red header was added on forums here
http://midniteftp.com/forum/index.php?board=73.0

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClayHadi on March 23, 2020, 01:38:06 PM
Hi....the Arduino suggestions will probably work fine if you account for the voltage range that the Raspberry Pi can handle. I used input from relay output once in a car security system to tell when a remote commanded the doors to lock or unlock. That was years ago in the days before Arduino; I used a PIC16F84. I vaguely recall having to do some filtering in the analog domain to make it work, but I might be remembering it wrong. I'm a software developer, not an electrical engineer, so I always found the analog stuff more difficult. Still, I made it work reliably, so I don't think you're bitting too much to chew.

pcb and small parts assembly (https://www.7pcb.com/PCB-Assembly-Service.php)
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on March 23, 2020, 03:55:52 PM
Hi....the Arduino suggestions will probably work fine if you account for the voltage range that the Raspberry Pi can handle. I used input from relay output once in a car security system to tell when a remote commanded the doors to lock or unlock. That was years ago in the days before Arduino; I used a PIC16F84. I vaguely recall having to do some filtering in the analog domain to make it work, but I might be remembering it wrong. I'm a software developer, not an electrical engineer, so I always found the analog stuff more difficult. Still, I made it work reliably, so I don't think you're bitting too much to chew.

Check this project out if you haven't seen it yet . I now have Raspberry Pi monitoring the Classic thanks to Graham and Matt
http://midniteftp.com/forum/index.php?topic=4817.0

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: mcsarge on March 23, 2020, 08:43:49 PM
Hey Guys,

I took the Node-Red that I got from your guys a little while ago and it was really easy to convert it to getting the data about the classic from MQTT instead of directly from the MODBUS. I just have to convert the field names in the payload you guys were using to the field names we use in the json packet. Here is what our "readings" packet looks like:

Code: [Select]
{"BatTemperature":0.8,
  "NetAmpHours":4,
  "ChargeState":0,
  "InfoFlagsBits":-1308610300,
  "ReasonForResting":4,
  "NegativeAmpHours":-9369,
  "BatVoltage":25.9,
  "PVVoltage":10.5,
  "VbattRegSetPTmpComp":27.4,
  "TotalAmpHours":704,
  "WhizbangBatCurrent":-0.5,
  "BatCurrent":0.0,
  "PVCurrent":0.0,
  "ConnectionState":0,
  "EnergyToday":0.5,
  "EqualizeTime":10800,
  "SOC":100,
  "Aux1":false,
  "Aux2":false,
  "Power":0.0,
  "FETTemperature":14.0,
  "PositiveAmpHours":17138,
  "TotalEnergy":616.1,
  "FloatTimeTodaySeconds":29689,
  "RemainingAmpHours":704,
  "AbsorbTime":18000,
  "ShuntTemperature":4.0,
  "PCBTemperature":21.3}

We also send an "info" packet for things that do not change much, but you get the idea

Matt
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on March 23, 2020, 10:16:53 PM
Matt
I was messing with the Node Red a little bit on my windows computer . I wanted to see if I could get it to subscribe to the raspberry pi MQTT broker that is already running on same network.  I think I did get it to connect . I then tried to hook it up to the one Node Red flow that was shared but didn't see anything from it.  I didn't get too much farther than that.

If you want to share your Node Red flow I will give it a try here .

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: mcsarge on March 24, 2020, 12:14:21 PM
Larry,

I used the --snooze_secs to update every 1 minute instead of five so it is easier to get some data. All I did wa remove the MODBUS and route the MQTT readr to the link to the JSON message thingy.

[{"id":"44d8794b.34ddd8","type":"tab","label":"Classic Data Getter","disabled":false,"info":"This flow retrieves data from the Midnite Classic \nSolar Controller using Modbus over TCPIP.  \nTakes the raw data and formats it for use with labels.\nJSON for convenience. !\n\nIt then transfers this data to the Dashboard Flow "},{"id":"479ec480.5bf78c","type":"tab","label":"Classic Dashboard Flow","disabled":false,"info":"This flow receieves it's data from the Data Getter\nand presents a basic dashboard view.\n\n"},{"id":"c033e13a.592b2","type":"modbus-client","z":"","name":"ClassicRemote","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"tcpHost":"127.0.0.1","tcpPort":"1883","tcpType":"TPC-RTU-BUFFERED","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectTimeout":"2000"},{"id":"af7bd7ae.bc45e8","type":"ui_group","z":"","name":"Current Status","tab":"aaa74f48.136a7","order":1,"disp":true,"width":"22","collapse":false},{"id":"a603949e.27e288","type":"ui_group","z":"","name":"Panel Watts Generation","tab":"aaa74f48.136a7","order":2,"disp":true,"width":"15","collapse":false},{"id":"aaa74f48.136a7","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1},{"id":"5ca6233.e85a1dc","type":"ui_base","theme":{"name":"theme-light","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#0094CE","value":"#0094CE","edited":false},"page-titlebar-backgroundColor":{"value":"#0094CE","edited":false},"page-backgroundColor":{"value":"#fafafa","edited":false},"page-sidebar-backgroundColor":{"value":"#ffffff","edited":false},"group-textColor":{"value":"#1bbfff","edited":false},"group-borderColor":{"value":"#ffffff","edited":false},"group-backgroundColor":{"value":"#ffffff","edited":false},"widget-textColor":{"value":"#111111","edited":false},"widget-backgroundColor":{"value":"#0094ce","edited":false},"widget-borderColor":{"value":"#ffffff","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}},"angularTheme":{"primary":"indigo","accents":"blue","warn":"red","background":"grey"}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","lockMenu":"false","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"16705c50.f9a794","type":"mqtt-broker","z":"","name":"Island","broker":"0.tcp.ngrok.io","port":"10693","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"79fd54c3.7f5bdc","type":"ui_spacer","name":"spacer","group":"af7bd7ae.bc45e8","order":1,"width":1,"height":1},{"id":"27a2f700.e982b8","type":"debug","z":"44d8794b.34ddd8","name":"RAW payload","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":540,"y":300,"wires":[]},{"id":"6fcbc911.4fc1f8","type":"link out","z":"44d8794b.34ddd8","name":"","links":["a5bf75bd.e2df18"],"x":775,"y":220,"wires":[]},{"id":"85722714.288338","type":"ui_gauge","z":"479ec480.5bf78c","name":"","group":"af7bd7ae.bc45e8","order":3,"width":"4","height":"4","gtype":"gage","title":"Input Watts","label":"Watts","format":"{{payload.PVCurrent}}","min":"0","max":"2080","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":970,"y":200,"wires":[]},{"id":"4752aed1.c84fe","type":"ui_chart","z":"479ec480.5bf78c","name":"","group":"a603949e.27e288","order":1,"width":"5","height":"5","label":"Input Amps (24hrs)","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"No Data","dot":false,"ymin":"0","ymax":"2080","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":true,"outputs":1,"x":670,"y":320,"wires":[[]]},{"id":"d111e626.910bd8","type":"json","z":"479ec480.5bf78c","name":"","property":"payload","action":"obj","pretty":false,"x":90,"y":120,"wires":[["4ba0b222.6e49fc","85722714.288338","85b81828.707f68","cf678ab.887af78","a53d84f3.d38538","ec9c248a.c27c08","b25e09f8.4cbcb8","7c078e46.0f115","d237b039.0a69c","5e9f17e2.005e48","71c98bfb.510b34","bbcf0529.774df8","dbd75023.c7a06","2fb99b52.1bc384"]]},{"id":"85b81828.707f68","type":"ui_gauge","z":"479ec480.5bf78c","name":"","group":"af7bd7ae.bc45e8","order":1,"width":"4","height":"4","gtype":"gage","title":"Battery Volts","label":"Volts","format":"{{payload.BatVoltage}}","min":"23.00","max":"32.00","colors":["#ff0000","#e6e600","#00b700"],"seg1":"","seg2":"","x":610,"y":200,"wires":[]},{"id":"fec31f54.d6d32","type":"ui_chart","z":"479ec480.5bf78c","name":"","group":"a603949e.27e288","order":2,"width":"5","height":"5","label":"Input Volts (24hrs)","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"No Data","dot":false,"ymin":"0","ymax":"210","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":true,"outputs":1,"x":670,"y":360,"wires":[[]]},{"id":"a5bf75bd.e2df18","type":"link in","z":"479ec480.5bf78c","name":"","links":["6fcbc911.4fc1f8"],"x":35,"y":200,"wires":[["d111e626.910bd8","a530bc96.b8e76"]]},{"id":"4ba0b222.6e49fc","type":"debug","z":"479ec480.5bf78c","name":"JSON converted (msg.paylod)","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":250,"y":40,"wires":[]},{"id":"a530bc96.b8e76","type":"moment","z":"479ec480.5bf78c","name":"","topic":"","input":"","inputType":"flow","inTz":"America/Toronto","adjAmount":0,"adjType":"days","adjDir":"add","format":"L, h:mm a","locale":"en_CA","output":"payload.daytime","outputType":"msg","outTz":"America/Toronto","x":180,"y":460,"wires":[["d077f37d.f56fe"]]},{"id":"d077f37d.f56fe","type":"ui_text","z":"479ec480.5bf78c","group":"af7bd7ae.bc45e8","order":4,"width":"5","height":"1","name":"Date","label":"","format":"{{msg.payload.daytime}}","layout":"row-left","x":350,"y":460,"wires":[]},{"id":"cf678ab.887af78","type":"ui_gauge","z":"479ec480.5bf78c","name":"","group":"af7bd7ae.bc45e8","order":2,"width":"4","height":"4","gtype":"gage","title":"Input Volts","label":"Volts","format":"{{payload.PVVoltage}}","min":"0","max":"200","colors":["#ff0000","#e6e600","#00b700"],"seg1":"","seg2":"","x":790,"y":200,"wires":[]},{"id":"a53d84f3.d38538","type":"ui_text","z":"479ec480.5bf78c","group":"af7bd7ae.bc45e8","order":5,"width":"5","height":"1","name":"","label":"Lifetime kWh : ","format":"{{msg.payload.TotalAmpHours}}","layout":"row-left","x":720,"y":20,"wires":[]},{"id":"ec9c248a.c27c08","type":"ui_text","z":"479ec480.5bf78c","group":"af7bd7ae.bc45e8","order":7,"width":"5","height":"1","name":"","label":"Lifetime Ahrs : ","format":"{{msg.payload.PositiveAmpHours}}","layout":"row-left","x":720,"y":60,"wires":[]},{"id":"b25e09f8.4cbcb8","type":"change","z":"479ec480.5bf78c","name":"In_PV_Amps payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.PVCurrent","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":320,"wires":[["4752aed1.c84fe"]]},{"id":"7c078e46.0f115","type":"change","z":"479ec480.5bf78c","name":"In_PV_Volts payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.PVVoltage","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":360,"wires":[["fec31f54.d6d32"]]},{"id":"d237b039.0a69c","type":"ui_text","z":"479ec480.5bf78c","group":"af7bd7ae.bc45e8","order":11,"width":"5","height":"1","name":"","label":"Ahrs Today : ","format":"{{msg.payload.NetAmpHours}}","layout":"row-left","x":710,"y":140,"wires":[]},{"id":"5e9f17e2.005e48","type":"ui_text","z":"479ec480.5bf78c","group":"af7bd7ae.bc45e8","order":9,"width":"5","height":"1","name":"","label":"kWhrs Today : ","format":"{{msg.payload.EnergyToday}}","layout":"row-left","x":720,"y":100,"wires":[]},{"id":"71c98bfb.510b34","type":"ui_text","z":"479ec480.5bf78c","group":"af7bd7ae.bc45e8","order":6,"width":"5","height":"1","name":"","label":"Battery Temp : ","format":"{{msg.payload.BatTemperature}}","layout":"row-left","x":980,"y":20,"wires":[]},{"id":"bbcf0529.774df8","type":"ui_text","z":"479ec480.5bf78c","group":"af7bd7ae.bc45e8","order":10,"width":"5","height":"1","name":"","label":"FET Temp : ","format":"{{msg.payload.FETTemperature}}","layout":"row-left","x":970,"y":60,"wires":[]},{"id":"dbd75023.c7a06","type":"ui_text","z":"479ec480.5bf78c","group":"af7bd7ae.bc45e8","order":8,"width":"5","height":"1","name":"","label":"Pcb Temp : ","format":"{{msg.payload.PCBTemperature}}","layout":"row-left","x":970,"y":100,"wires":[]},{"id":"5ccb367a.49db58","type":"ui_chart","z":"479ec480.5bf78c","name":"","group":"a603949e.27e288","order":2,"width":"5","height":"5","label":"High Volts in (24hrs)","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"bezier","nodata":"No Data","dot":false,"ymin":"0","ymax":"210","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":true,"outputs":1,"x":680,"y":400,"wires":[[]]},{"id":"2fb99b52.1bc384","type":"change","z":"479ec480.5bf78c","name":"Hi_V_In_Today payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.HighVoltInToday","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":400,"wires":[["5ccb367a.49db58"]]},{"id":"2fb36cba.543cd4","type":"comment","z":"479ec480.5bf78c","name":"Dashboard Flow Read Me !","info":"This is a simple \"SnapShot\" Dashboard for Node-Red\nNothing too fancy but a start...\n\nData is received from the Data Getter using an InFlow [NODE]\n- json cleanup goes on which has a debug [NODE].\n- date & time are triggered by the input activity for display using system time.\n\nBattery Volts, Input Volts, Input Watts guages retrieve their data directly.\nThe Text Nodes also retrieve their data directly from the input.\n\nThe graphs must have the \"msg\" tweaked as they only take a simple payload.\nThis change is accomplished in front of them, taking data from the input.","x":390,"y":220,"wires":[]},{"id":"de40081b.e86998","type":"mqtt in","z":"44d8794b.34ddd8","name":"readings","topic":"ClassicMQTT/classic/stat/readings/#","qos":"2","datatype":"auto","broker":"16705c50.f9a794","x":260,"y":160,"wires":[["27a2f700.e982b8","6fcbc911.4fc1f8"]]}]


Matt
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on March 24, 2020, 01:05:37 PM
I tried your flow Matt - it was pretty much like I had already.
I think we may be talking about two different copied flows from others.
I will try again later.

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: Vic on March 24, 2020, 03:05:36 PM
Thank you very much,  to ALL who have contributed to this project.

We  will,  soon try dipping one toe into this water.

Great work !   Thanks again,   Vic
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on March 24, 2020, 04:16:04 PM
Thank you very much,  to ALL who have contributed to this project.

We  will,  soon try dipping one toe into this water.

Great work !   Thanks again,   Vic

Get a raspberry pi Vic and we can get you up and running soon - at least with the Android Monitor app part
Title: Re: Classic Monitoring with a raspberry pi
Post by: mcsarge on March 24, 2020, 05:36:20 PM
I updated the flow to better match the values in our "readings" subject. It looks like the attached.

Code: [Select]
[{"id":"44d8794b.34ddd8","type":"tab","label":"Classic Data Getter","disabled":false,"info":"This flow retrieves data from the Midnite Classic \nSolar Controller using Modbus over TCPIP.  \nTakes the raw data and formats it for use with labels.\nJSON for convenience. !\n\nIt then transfers this data to the Dashboard Flow "},{"id":"479ec480.5bf78c","type":"tab","label":"Classic Dashboard Flow","disabled":false,"info":"This flow receieves it's data from the Data Getter\nand presents a basic dashboard view.\n\n"},{"id":"af7bd7ae.bc45e8","type":"ui_group","z":"","name":"Current Status","tab":"aaa74f48.136a7","order":1,"disp":true,"width":"22","collapse":false},{"id":"a603949e.27e288","type":"ui_group","z":"","name":"Power Generation","tab":"aaa74f48.136a7","order":3,"disp":true,"width":"22","collapse":false},{"id":"aaa74f48.136a7","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1},{"id":"5ca6233.e85a1dc","type":"ui_base","theme":{"name":"theme-light","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#0094CE","value":"#0094CE","edited":false},"page-titlebar-backgroundColor":{"value":"#0094CE","edited":false},"page-backgroundColor":{"value":"#fafafa","edited":false},"page-sidebar-backgroundColor":{"value":"#ffffff","edited":false},"group-textColor":{"value":"#1bbfff","edited":false},"group-borderColor":{"value":"#ffffff","edited":false},"group-backgroundColor":{"value":"#ffffff","edited":false},"widget-textColor":{"value":"#111111","edited":false},"widget-backgroundColor":{"value":"#0094ce","edited":false},"widget-borderColor":{"value":"#ffffff","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}},"angularTheme":{"primary":"indigo","accents":"blue","warn":"red","background":"grey"}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","lockMenu":"false","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"16705c50.f9a794","type":"mqtt-broker","z":"","name":"Island","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"cb16369e.0e7fc8","type":"ui_group","z":"","name":"Temperatures","tab":"aaa74f48.136a7","order":4,"disp":true,"width":"22","collapse":true},{"id":"4229bb36.fe3a84","type":"ui_group","z":"","name":"Power","tab":"aaa74f48.136a7","order":5,"disp":true,"width":"22","collapse":true},{"id":"612bf217.53203c","type":"ui_group","z":"","name":"Time","tab":"aaa74f48.136a7","order":2,"disp":false,"width":"22","collapse":false},{"id":"27a2f700.e982b8","type":"debug","z":"44d8794b.34ddd8","name":"RAW payload","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":540,"y":300,"wires":[]},{"id":"6fcbc911.4fc1f8","type":"link out","z":"44d8794b.34ddd8","name":"","links":["a5bf75bd.e2df18"],"x":775,"y":220,"wires":[]},{"id":"85722714.288338","type":"ui_gauge","z":"479ec480.5bf78c","name":"","group":"af7bd7ae.bc45e8","order":5,"width":"4","height":"4","gtype":"gage","title":"PV Current","label":"Amps","format":"{{payload.PVCurrent}}","min":"0","max":"1500","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":970,"y":200,"wires":[]},{"id":"4752aed1.c84fe","type":"ui_chart","z":"479ec480.5bf78c","name":"","group":"a603949e.27e288","order":4,"width":"5","height":"5","label":"PV Current (24hrs)","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"No Data","dot":false,"ymin":"0","ymax":"30","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":true,"outputs":1,"x":670,"y":320,"wires":[[]]},{"id":"d111e626.910bd8","type":"json","z":"479ec480.5bf78c","name":"","property":"payload","action":"obj","pretty":false,"x":90,"y":120,"wires":[["4ba0b222.6e49fc","85722714.288338","85b81828.707f68","cf678ab.887af78","a53d84f3.d38538","ec9c248a.c27c08","b25e09f8.4cbcb8","7c078e46.0f115","d237b039.0a69c","5e9f17e2.005e48","71c98bfb.510b34","bbcf0529.774df8","dbd75023.c7a06","2fb99b52.1bc384","bbdfde82.e5d2b","77f51866.d246d8","e3333f4a.65f36","7520a9fb.3f5488"]]},{"id":"85b81828.707f68","type":"ui_gauge","z":"479ec480.5bf78c","name":"","group":"af7bd7ae.bc45e8","order":2,"width":"4","height":"4","gtype":"gage","title":"Battery Volts","label":"Volts","format":"{{payload.BatVoltage}}","min":"23.00","max":"32.00","colors":["#ff0000","#e6e600","#00b700"],"seg1":"24.7","seg2":"24.7","x":610,"y":200,"wires":[]},{"id":"fec31f54.d6d32","type":"ui_chart","z":"479ec480.5bf78c","name":"","group":"a603949e.27e288","order":3,"width":"5","height":"5","label":"PV Voltage (24hrs)","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"No Data","dot":false,"ymin":"0","ymax":"150","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":true,"outputs":1,"x":670,"y":360,"wires":[[]]},{"id":"a5bf75bd.e2df18","type":"link in","z":"479ec480.5bf78c","name":"","links":["6fcbc911.4fc1f8"],"x":35,"y":200,"wires":[["d111e626.910bd8"]]},{"id":"4ba0b222.6e49fc","type":"debug","z":"479ec480.5bf78c","name":"JSON converted (msg.paylod)","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","x":250,"y":40,"wires":[]},{"id":"cf678ab.887af78","type":"ui_gauge","z":"479ec480.5bf78c","name":"","group":"af7bd7ae.bc45e8","order":4,"width":"4","height":"4","gtype":"gage","title":"Input Volts","label":"Volts","format":"{{payload.PVVoltage}}","min":"0","max":"200","colors":["#ff0000","#e6e600","#00b700"],"seg1":"50","seg2":"50","x":790,"y":200,"wires":[]},{"id":"a53d84f3.d38538","type":"ui_text","z":"479ec480.5bf78c","group":"4229bb36.fe3a84","order":4,"width":"5","height":"1","name":"","label":"Lifetime kWh : ","format":"{{msg.payload.TotalAmpHours}}","layout":"row-left","x":720,"y":20,"wires":[]},{"id":"ec9c248a.c27c08","type":"ui_text","z":"479ec480.5bf78c","group":"4229bb36.fe3a84","order":3,"width":"5","height":"1","name":"","label":"Lifetime Ahrs : ","format":"{{msg.payload.PositiveAmpHours}}","layout":"row-left","x":720,"y":60,"wires":[]},{"id":"b25e09f8.4cbcb8","type":"change","z":"479ec480.5bf78c","name":"In_PV_Amps payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.PVCurrent","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":320,"wires":[["4752aed1.c84fe"]]},{"id":"7c078e46.0f115","type":"change","z":"479ec480.5bf78c","name":"In_PV_Volts payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.PVVoltage","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":360,"wires":[["fec31f54.d6d32"]]},{"id":"d237b039.0a69c","type":"ui_text","z":"479ec480.5bf78c","group":"4229bb36.fe3a84","order":1,"width":"5","height":"1","name":"","label":"Net AHrs : ","format":"{{msg.payload.NetAmpHours}}","layout":"row-left","x":710,"y":140,"wires":[]},{"id":"5e9f17e2.005e48","type":"ui_text","z":"479ec480.5bf78c","group":"4229bb36.fe3a84","order":2,"width":"5","height":"1","name":"","label":"kWhrs Today : ","format":"{{msg.payload.EnergyToday}}","layout":"row-left","x":720,"y":100,"wires":[]},{"id":"71c98bfb.510b34","type":"ui_text","z":"479ec480.5bf78c","group":"cb16369e.0e7fc8","order":1,"width":"5","height":"1","name":"","label":"Battery Temp : ","format":"{{msg.payload.BatTemperature}} C","layout":"row-left","x":980,"y":20,"wires":[]},{"id":"bbcf0529.774df8","type":"ui_text","z":"479ec480.5bf78c","group":"cb16369e.0e7fc8","order":3,"width":"5","height":"1","name":"","label":"FET Temp : ","format":"{{msg.payload.FETTemperature}} C","layout":"row-left","x":970,"y":60,"wires":[]},{"id":"dbd75023.c7a06","type":"ui_text","z":"479ec480.5bf78c","group":"cb16369e.0e7fc8","order":2,"width":"5","height":"1","name":"","label":"Pcb Temp : ","format":"{{msg.payload.PCBTemperature}} C","layout":"row-left","x":970,"y":100,"wires":[]},{"id":"5ccb367a.49db58","type":"ui_chart","z":"479ec480.5bf78c","name":"","group":"a603949e.27e288","order":2,"width":"5","height":"5","label":"Battery Currrent (24hrs)","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"bezier","nodata":"No Data","dot":false,"ymin":"-70","ymax":"70","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":true,"outputs":1,"x":690,"y":400,"wires":[[]]},{"id":"2fb99b52.1bc384","type":"change","z":"479ec480.5bf78c","name":"WzBJr payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.WhizbangBatCurrent","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":400,"wires":[["5ccb367a.49db58"]]},{"id":"2fb36cba.543cd4","type":"comment","z":"479ec480.5bf78c","name":"Dashboard Flow Read Me !","info":"This is a simple \"SnapShot\" Dashboard for Node-Red\nNothing too fancy but a start...\n\nData is received from the Data Getter using an InFlow [NODE]\n- json cleanup goes on which has a debug [NODE].\n- date & time are triggered by the input activity for display using system time.\n\nBattery Volts, Input Volts, Input Watts guages retrieve their data directly.\nThe Text Nodes also retrieve their data directly from the input.\n\nThe graphs must have the \"msg\" tweaked as they only take a simple payload.\nThis change is accomplished in front of them, taking data from the input.","x":520,"y":520,"wires":[]},{"id":"de40081b.e86998","type":"mqtt in","z":"44d8794b.34ddd8","name":"readings","topic":"ClassicMQTT/classic/stat/readings/#","qos":"2","datatype":"auto","broker":"16705c50.f9a794","x":260,"y":160,"wires":[["27a2f700.e982b8","6fcbc911.4fc1f8"]]},{"id":"bbdfde82.e5d2b","type":"ui_gauge","z":"479ec480.5bf78c","name":"","group":"af7bd7ae.bc45e8","order":1,"width":"4","height":"4","gtype":"gage","title":"SOC","label":"% Charge","format":"{{payload.SOC}}","min":"0","max":"100","colors":["#ff0000","#e6e600","#00b700"],"seg1":"50","seg2":"70","x":770,"y":240,"wires":[]},{"id":"77f51866.d246d8","type":"change","z":"479ec480.5bf78c","name":"BatVoltage payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.BatVoltage","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":440,"wires":[["7543e6b2.112af8"]]},{"id":"e3333f4a.65f36","type":"change","z":"479ec480.5bf78c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.timestamp","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":240,"y":540,"wires":[["77ff432e.bd6adc"]]},{"id":"77ff432e.bd6adc","type":"moment","z":"479ec480.5bf78c","name":"","topic":"","input":"","inputType":"msg","inTz":"America/New_York","adjAmount":0,"adjType":"days","adjDir":"add","format":"ddd DD MMM HH:mm:ss","locale":"en_US","output":"","outputType":"msg","outTz":"America/New_York","x":520,"y":580,"wires":[["9228f077.77b3d"]]},{"id":"9228f077.77b3d","type":"ui_text","z":"479ec480.5bf78c","group":"612bf217.53203c","order":1,"width":"5","height":"1","name":"","label":"Time","format":"{{msg.payload}}","layout":"row-left","x":810,"y":600,"wires":[]},{"id":"7520a9fb.3f5488","type":"ui_gauge","z":"479ec480.5bf78c","name":"","group":"af7bd7ae.bc45e8","order":3,"width":"4","height":"4","gtype":"gage","title":"Battery Current","label":"Amps","format":"{{payload.WhizbangBatCurrent}}","min":"-100","max":"100","colors":["#ff0000","#e6e600","#00b700"],"seg1":"-50","seg2":"50","x":620,"y":260,"wires":[]},{"id":"7543e6b2.112af8","type":"ui_chart","z":"479ec480.5bf78c","name":"","group":"a603949e.27e288","order":1,"width":"5","height":"5","label":"Battery Voltage(24hrs)","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"bezier","nodata":"No Data","dot":false,"ymin":"23","ymax":"32","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":true,"outputs":1,"x":680,"y":440,"wires":[[]]}]
Title: Re: Classic Monitoring with a raspberry pi
Post by: Vic on March 24, 2020, 06:11:19 PM

Get a raspberry pi Vic and we can get you up and running soon - at least with the Android Monitor app part

Hi Larry,   have several R Pis here,   but have not done much with them  --  they DO make a perfectly acceptable Internet cruising machine.   Amazin'  that those lil boxes are SO capable.

Thanks for the offer.   73,   Vic
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on March 24, 2020, 06:22:58 PM
Matt,
I tried  your last flow in Node Red - It won't run because of an "unknown moment "
What is that so I can add it to my Node red
see snapshot
thanks Larry
(http://)
Title: Re: Classic Monitoring with a raspberry pi
Post by: mcsarge on March 24, 2020, 10:16:15 PM
Here it is, it is just a time formatter.
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on March 24, 2020, 10:52:38 PM
okay - found the moment node - looked for it before but I was looking in the wrong spot to search and install it.
giving it another try

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on March 24, 2020, 11:09:32 PM
Matt ,
I made some progress - and have the getter running now and it says it is connnected and UI showing up .
But I don't see any data on the UI or in any of the debugs msg payload
I am wondering about this in getter for topic
ClassicMQTT/classic/stat/readings/#

When I set up the Pi for Grahams android  app I only had ClassicMQTT as the topic . Do I need to change that in the Raspberry Pi publisher to match this now ? Maybe you are collecting more data on the Pi than I am ?
(http://)

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: mcsarge on March 25, 2020, 09:44:02 AM
Larry,

That subscription needs to match the mqtt_root and the classic_name you used when you started the Python publisher(s).

Oh and remember, if you are in snooze mode on the classic_mqtt.py, the default is an update every 5 minutes. That is why I added --snooze_secs so I could set it to 60 so it will give you an update every minute when no one is connected.

Matt
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on March 31, 2020, 12:50:23 PM
Thanks to Matt and Graham the raspberry pi  MQTT software is now working very well.
They worked out a few bugs and I tested it and now my Pi connects to the Classic , publishes the data on MQTT, and I was able to connect up two different androids to it at the same time - one an Amazon Fire tablet with custom Rom and a Samsung Galaxy S4 with custom Rom . The newest beta android  app monitors both of my Classics which are in Follow me mode .
More info here https://github.com/ClassicDIY

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: Trapp on April 03, 2020, 05:26:57 PM
Thanks welmore your code “Logging.php” works right out of the box I’ve been using it for over a year now

Clasic 200
SN # CL 12345

I want to turn on/off the relay on aux1 with $modbus->writeSingleRegister(0, 4129, $relayon, $dataTypes);

And keep the Ethernet lock on
Please help me

Nothing ????????????
Title: Re: Classic Monitoring with a raspberry pi
Post by: malkierian on April 16, 2020, 10:29:49 PM
Hey, so I tried installing this and running it (with Mosquitto, though I don't think that makes a difference). I'm having a problem (that I think I've been having for a while) where the Classics I have won't communicate over the ethernet, despite using DHCP and having an IP assigned and listed on the Classic's control panel. It also won't communicate with Classic Monitor on Android, even when I manually set the IP address. It was more intermittent before, with only one of them going unresponsive, but now, for some reason, they just won't work at all. My Pi and the Classics are connected to the same switch on the same network. I wasn't sure where else to go on this, it seems like I'd get more help here in a development forum than in the general discussion forum.
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on April 17, 2020, 12:06:57 AM
Hey, so I tried installing this and running it (with Mosquitto, though I don't think that makes a difference). I'm having a problem (that I think I've been having for a while) where the Classics I have won't communicate over the ethernet, despite using DHCP and having an IP assigned and listed on the Classic's control panel. It also won't communicate with Classic Monitor on Android, even when I manually set the IP address. It was more intermittent before, with only one of them going unresponsive, but now, for some reason, they just won't work at all. My Pi and the Classics are connected to the same switch on the same network. I wasn't sure where else to go on this, it seems like I'd get more help here in a development forum than in the general discussion forum.

What version of firmware is in your Classic ?
last time I had problem with Classic not showing up it was because of problem with my cat 5 cable .
Are you looking at the connected lan  list in your router or just what is showing up on local status app ?
You mentioned a switch - or are they plugged into a router ? What kind of router is it ?
Also have you ever restarted the Classic and seen if that makes the Classics work again ?
You mentioned DHCP - have you ever tried making a static address ?
just some quick thoughts here

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: malkierian on April 17, 2020, 01:33:51 AM
I just recently updated to the latest firmware version on both, but the classic app was working before and after that. I have tried restarting, to no avail. I did recently change the router that the switch was plugged into, but the Classics have never shown up in the active device list of any router I've had them plugged into, even when Classic Monitor was picking them up. The new router is an ASUS RT-AC56U with ASUSWRT-Merlin custom firmware. As far as static vs DHCP, once it's been assigned an IP address from the router, it shouldn't make any difference to it being static as long as the router isn't reset (they hang onto MAC addresses and try to assign them the same IP address when they reconnect).
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on April 17, 2020, 11:45:37 AM
When you did the firmware updates did you do VMM reset on the Classics ?
can you plug your classics directly into the router to see what happens ?

Seems like if it started having problems when you got a new router then that is the place there is an issue.

Also I believe when you make changes on the networking on Classic MNGP you need to restart Classic.

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: malkierian on April 17, 2020, 01:35:14 PM
Man, I hate technology sometimes. I unplugged the ethernet cables from the switch and put the feeding one into a different port and they're working now.

Anyway, I don't know if I'm missing something. I have Mosquitto installed. I'm running classic_mqtt.py with mqtt_root of "classic_mqtt", and I'm running mosquitto_sub with a topic of "classic_mqtt", but whenever your script transmits (I assume that's what it's doing when it says "Enter encodeClassiCdata_readings", etc), nothing shows up on the subscription. Is there a third step somewhere that I'm missing?
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on April 17, 2020, 02:01:25 PM
Man, I hate technology sometimes. I unplugged the ethernet cables from the switch and put the feeding one into a different port and they're working now.

Anyway, I don't know if I'm missing something. I have Mosquitto installed. I'm running classic_mqtt.py with mqtt_root of "classic_mqtt", and I'm running mosquitto_sub with a topic of "classic_mqtt", but whenever your script transmits (I assume that's what it's doing when it says "Enter encodeClassiCdata_readings", etc), nothing shows up on the subscription. Is there a third step somewhere that I'm missing?
To be clear - I am not the guy who wrote the code - Graham and Matt did - I am just the tester and helper !
Are you using this as a guide ?
https://github.com/ClassicDIY/ClassicMQTT/wiki/3.-Raspberry-Pi-Classic-MQTT-Publisher
Not sure how long ago you downloaded any of the files - there have been some updates along the way.
Anyway on the wiki go to Step 3  - Using Docker Compose and follow those instructions .
it will install mosquitto and the other things needed if you just folllow those steps.
Let me know if you have any problems following that - I made some notes for myself last time I did my install on fresh raspberry pi.
It helps to install Portainer to see what is going on with the Docker Containers which is how this works.

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: mcsarge on April 17, 2020, 02:18:44 PM
After you give it another go, let us know what is happening and we will help you out. It is a bit complicated. I am in the process of adding some additional logging so that it might be easier to know what is happening in the code and where stuff is being published.

Matt
Title: Re: Classic Monitoring with a raspberry pi
Post by: malkierian on April 17, 2020, 07:21:06 PM
I don't see anything about Mosquitto on there, and that is what I was following. I just barely started this project this week (been working on getting the Magnum logger working first).

And docker/docker-compose isn't necessary for me because I run VNC and keep desktop running all the time.

Thanks for checking in, Matt. Still have the issue of not getting publish data on mosquitto_sub. To be clear, I'm running
Code: [Select]
python3 classic_mqtt.py --classic 192.168.1.165 --classic_name North --mqtt_root classic_mqtt --snooze_secs 15 in one terminal window and
Code: [Select]
mosquitto_sub -d -t classic_mqtt in a second terminal. First terminal is logging "Got data", "Enter encodeClassicData_readings" and "Enter encodeClassicData_info", and the second one is just a bunch of "sending PINGREQ, received PINGRESP", but never gets any data from classic_mqtt.py. Do I still not have a broker running at this point? Is that my problem?

Also, is there no way to set this thing running for all available Classics on the network, or do I have to run separate instances of the script for each Classic I have connected?
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on April 17, 2020, 07:30:17 PM
I don't see anything about Mosquitto on there, and that is what I was following. I just barely started this project this week (been working on getting the Magnum logger working first).

And docker/docker-compose isn't necessary for me because I run VNC and keep desktop running all the time.

Thanks for checking in, Matt. Still have the issue of not getting publish data on mosquitto_sub. To be clear, I'm running
Code: [Select]
python3 classic_mqtt.py --classic 192.168.1.165 --classic_name North --mqtt_root classic_mqtt --snooze_secs 15 in one terminal window and
Code: [Select]
mosquitto_sub -d -t classic_mqtt in a second terminal. First terminal is logging "Got data", "Enter encodeClassicData_readings" and "Enter encodeClassicData_info", and the second one is just a bunch of "sending PINGREQ, received PINGRESP", but never gets any data from classic_mqtt.py. Do I still not have a broker running at this point? Is that my problem?

Also, is there no way to set this thing running for all available Classics on the network, or do I have to run separate instances of the script for each Classic I have connected?

if you follow the instructions I suggested it will install everything you need , mosquitto included. Once installed you only need to add the .env file with your info , then it will publish via mqtt to the Android app. And it will show both classics .

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: malkierian on April 17, 2020, 09:35:29 PM
Alright, I gave it a try, despite still not wanting to use docker or docker-compose. I still didn't see anything in there about specifying more than one Classic (.env only has one Classic host variable), but, since I had to uninstall mosquitto from my system in order for docker-compose's one could run, I don't know how to connect to the broker with a sub to verify what's actually being sent.
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on April 17, 2020, 09:51:20 PM
did you make a .env file for the classic you have and try that using the Android App ? 
Yes you need a different .env file to do both Classics - I have to look at my notes

Make you .env file like this
CLASSIC_NAME1=CLASSIC1 ( whatever you have you classic named )
CLASSIC1=192.168.x.xx
CLASSIC_PORT1=502
CLASSIC_NAME2=Classic 2 ( whatever you have your classic named)
CLASSIC2=192.168.x.xx
CLASSIC_PORT2=502
MQTT_ROOT=ClassicMQTT
MQTT_USER=ClassicPublisher( or whatever you want )
MQTT_PASS=ClassicPub123 ( whatever you want )

I forget now if you need to run a separate container for the other classic - I will look and see

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on April 17, 2020, 10:00:58 PM
yes I think you need to build container for both of the classics  so run this twice using the two different classics info

docker run classic_mqtt --classic <ClassicHost> --classic_port <502> --classic_name MyClassic --mqtt <127.0.0.1> --mqtt_port <1883> --mqtt_root <ClassicMQTT> --mqtt_user <username> --mqtt_pass <password>

After you modify that .env file you will have to run the

3.  and 4 directions again .

Tell docker-compose to download, build and start up the both mosquitto and the script with the following command.

docker-compose -f classic_mqtt_compose.yml up

Only use this if you change the .env file or anything classic_mqtt_compose.yml or Dockerfile once you have already run the command in step 3 above. This tells docker-compose to rebuild and save the images use the command in step 3 to run it:

docker-compose -f classic_mqtt_compose.yml build

Title: Re: Classic Monitoring with a raspberry pi
Post by: malkierian on April 17, 2020, 10:25:04 PM
How do I use the app on a local network? I don't even know what the password is supposed to be, it looks like the thing stored in mosquitto.pass is already hashed. I did try using option 1 with dioty.co, and it's publishing, but the app isn't picking up on anything (yes, I made sure the roots are the same).
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on April 17, 2020, 10:54:00 PM
I never got that dioty site to work for me.
But if you have that part working you need to put that info in the MQTT setup of Grahams Android Classic Monitoring app .
https://github.com/ClassicDIY/ClassicMQTT/wiki/4.-Classic-Monitor-MQTT-Subscriber-app-for-Android
Then you go to the right on Android app and hit the + sign top right corner and add your Classic names
It shows in that wiki link above .
I use it with mosquitto on my local network so don't go out to another server.

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: malkierian on April 17, 2020, 11:23:55 PM
Yes, yes, I've already done all that, but what username and password do I use to connect to the local server? Just using garbage login credentials still doesn't show anything on the app. I've put in the IP address of the Pi that it's running on, the port is 1883, but the Classic app just immediately tells me "Failed to connect to MQTT broker".
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on April 18, 2020, 11:23:18 AM
You are telling me two different thngs - that you are using dioty but now you want to connect to the local server ?
Which did you set up the initial container for .
What did you put in this ?
docker run classic_mqtt --classic <ClassicHost> --classic_port <502> --classic_name MyClassic --mqtt <127.0.0.1> --mqtt_port <1883> --mqtt_root <ClassicMQTT> --mqtt_user <username> --mqtt_pass <password>

You use those same credentials in the MQTT setup on the Android app.
Keep in mind that only one IP connection at a time can connect to Classic so you can't have the Midnite Local Status app and the others connected at the same time.

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: malkierian on April 18, 2020, 07:38:18 PM
Well, you told me you were never able to get DIoTY working, so I tried switching back over, but I've tried both of them over and over with no success either way. And I STILL don't know how to test connection to this thing on the same machine to see if it's actually broadcasting, and perhaps it's not allowing connections from outside the machine.

And that "docker run" command doesn't do me any good, I was running docker-compose ever since you told me following step 3 would make it all work automatically. So I don't know what username and password to use, because that's all set up in the script, and the password is already encrypted. And no, using the ClassicPublisher username with ClassicPub123 as the password (the default .env values) didn't work.
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on April 18, 2020, 10:31:23 PM
I am starting to think maybe I should make a Raspberry Pi card image that is all set up .
But just to be sure .
Did you do these steps first
https://dev.to/rohansawant/installing-docker-and-docker-compose-on-the-raspberry-pi-in-5-simple-steps-3mgl

There is a small program called MQTT Explorer that you can use to see if you pi is publishing
screen shot below
Also I found it really helpful to install Portainer because you can see if the proper containers are installed and up and running.
(install portainer )
docker pull portainer/portainer:linux-arm
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer:linux-arm
info on these commands at link below
https://www.osarea.com/docker-environment-with-raspbian-buster-with-rasbian-pi-4-portainer

With portainer it makes it easy to remove old containers and start over too .

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: mcsarge on April 30, 2020, 05:25:15 PM
Hi if you look in the classic_mqtt_compose.yml file, it tells you the usernames and password that are used in the Mosquitto broker that the compose sets up.

Matt


I am starting to think maybe I should make a Raspberry Pi card image that is all set up .
But just to be sure .
Did you do these steps first
https://dev.to/rohansawant/installing-docker-and-docker-compose-on-the-raspberry-pi-in-5-simple-steps-3mgl

There is a small program called MQTT Explorer that you can use to see if you pi is publishing
screen shot below
Also I found it really helpful to install Portainer because you can see if the proper containers are installed and up and running.
(install portainer )
docker pull portainer/portainer:linux-arm
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer:linux-arm
info on these commands at link below
https://www.osarea.com/docker-environment-with-raspbian-buster-with-rasbian-pi-4-portainer

With portainer it makes it easy to remove old containers and start over too .

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: Trapp on May 18, 2020, 07:52:36 PM
No Response
From this forum and Midnite Solar support
WHY ?
Title: Re: Classic Monitoring with a raspberry pi
Post by: ClassicCrazy on May 18, 2020, 10:18:15 PM
No Response
From this forum and Midnite Solar support
WHY ?

What exactly is your question ?

Larry
Title: Re: Classic Monitoring with a raspberry pi
Post by: Trapp on May 31, 2020, 11:06:11 PM
No Response
From this forum and Midnite Solar support
WHY ?

What exactly is your question ?

Larry
Do you read Larry I only have 2 posts here
Title: Re: Classic Monitoring with a raspberry pi
Post by: boB on June 01, 2020, 02:05:27 AM
No Response
From this forum and Midnite Solar support
WHY ?

What exactly is your question ?

Larry
Do you read Larry I only have 2 posts here


He posted....


Thanks welmore your code “Logging.php” works right out of the box I’ve been using it for over a year now

Clasic 200
SN # CL 12345

I want to turn on/off the relay on aux1 with $modbus->writeSingleRegister(0, 4129, $relayon, $dataTypes);

And keep the Ethernet lock on
Please help me

Nothing ????????????


I can't remember the exact addresses to use but you have to write the Classic's serial number to unlock the Classic for writing first.

Some of these guys here may know this but I can take a look and/or ask around.  That info "should" be in the latest document but I wonder ?