Author Topic: Classic Monitoring with a raspberry pi  (Read 13439 times)

ClassicCrazy

  • Hero Member
  • *****
  • Posts: 2670
Re: Classic Monitoring with a raspberry pi
« Reply #45 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 ?


Larry
« Last Edit: March 24, 2020, 11:21:43 PM by ClassicCrazy »
system one
Classic 150 , 5s4p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system two
Classic 150 ,5s 135 watt Kyocero , 16s Calb 100AH LiFePO4 , Outback VFX 3648 inverter
system three
Midnite KID MPPT 24 DC in to  12 volt AGM batterie

mcsarge

  • Full Member
  • ***
  • Posts: 106
Re: Classic Monitoring with a raspberry pi
« Reply #46 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
« Last Edit: March 25, 2020, 09:47:03 AM by mcsarge »
Off Grid Island in Ontario Canada (Beaverstone Bay)
Primary: Classic 150 + wbjr; 3s2p HES 270watt
Winter: SolarBoost 50 MPPT (into wbjr); 2 x Sharp NE-80EJEA 80watt
Pack: 4s4p US2200 FLA 6V for 24V pack
Inverter/Charger: Trace DR2424
Call Sign: KG4EUF

ClassicCrazy

  • Hero Member
  • *****
  • Posts: 2670
Re: Classic Monitoring with a raspberry pi
« Reply #47 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
system one
Classic 150 , 5s4p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system two
Classic 150 ,5s 135 watt Kyocero , 16s Calb 100AH LiFePO4 , Outback VFX 3648 inverter
system three
Midnite KID MPPT 24 DC in to  12 volt AGM batterie

Trapp

  • Newby
  • *
  • Posts: 3
Re: Classic Monitoring with a raspberry pi
« Reply #48 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 ????????????
« Last Edit: April 07, 2020, 08:58:20 PM by Trapp »

malkierian

  • Newby
  • *
  • Posts: 12
Re: Classic Monitoring with a raspberry pi
« Reply #49 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.

ClassicCrazy

  • Hero Member
  • *****
  • Posts: 2670
Re: Classic Monitoring with a raspberry pi
« Reply #50 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
« Last Edit: April 17, 2020, 12:13:02 AM by ClassicCrazy »
system one
Classic 150 , 5s4p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system two
Classic 150 ,5s 135 watt Kyocero , 16s Calb 100AH LiFePO4 , Outback VFX 3648 inverter
system three
Midnite KID MPPT 24 DC in to  12 volt AGM batterie

malkierian

  • Newby
  • *
  • Posts: 12
Re: Classic Monitoring with a raspberry pi
« Reply #51 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).

ClassicCrazy

  • Hero Member
  • *****
  • Posts: 2670
Re: Classic Monitoring with a raspberry pi
« Reply #52 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
system one
Classic 150 , 5s4p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system two
Classic 150 ,5s 135 watt Kyocero , 16s Calb 100AH LiFePO4 , Outback VFX 3648 inverter
system three
Midnite KID MPPT 24 DC in to  12 volt AGM batterie

malkierian

  • Newby
  • *
  • Posts: 12
Re: Classic Monitoring with a raspberry pi
« Reply #53 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?

ClassicCrazy

  • Hero Member
  • *****
  • Posts: 2670
Re: Classic Monitoring with a raspberry pi
« Reply #54 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
system one
Classic 150 , 5s4p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system two
Classic 150 ,5s 135 watt Kyocero , 16s Calb 100AH LiFePO4 , Outback VFX 3648 inverter
system three
Midnite KID MPPT 24 DC in to  12 volt AGM batterie

mcsarge

  • Full Member
  • ***
  • Posts: 106
Re: Classic Monitoring with a raspberry pi
« Reply #55 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
Off Grid Island in Ontario Canada (Beaverstone Bay)
Primary: Classic 150 + wbjr; 3s2p HES 270watt
Winter: SolarBoost 50 MPPT (into wbjr); 2 x Sharp NE-80EJEA 80watt
Pack: 4s4p US2200 FLA 6V for 24V pack
Inverter/Charger: Trace DR2424
Call Sign: KG4EUF

malkierian

  • Newby
  • *
  • Posts: 12
Re: Classic Monitoring with a raspberry pi
« Reply #56 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?

ClassicCrazy

  • Hero Member
  • *****
  • Posts: 2670
Re: Classic Monitoring with a raspberry pi
« Reply #57 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
system one
Classic 150 , 5s4p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system two
Classic 150 ,5s 135 watt Kyocero , 16s Calb 100AH LiFePO4 , Outback VFX 3648 inverter
system three
Midnite KID MPPT 24 DC in to  12 volt AGM batterie

malkierian

  • Newby
  • *
  • Posts: 12
Re: Classic Monitoring with a raspberry pi
« Reply #58 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.

ClassicCrazy

  • Hero Member
  • *****
  • Posts: 2670
Re: Classic Monitoring with a raspberry pi
« Reply #59 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
system one
Classic 150 , 5s4p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system two
Classic 150 ,5s 135 watt Kyocero , 16s Calb 100AH LiFePO4 , Outback VFX 3648 inverter
system three
Midnite KID MPPT 24 DC in to  12 volt AGM batterie