ESP32 Classic MQTT Publisher & Home Assistant

Started by Graham, February 13, 2020, 05:58:57 PM

Previous topic - Next topic

ClassicCrazy

Quote from: mcsarge on January 27, 2021, 05:10:55 PM
Well, I just read the comments Paraphraser and I am not excited. I put alot of work into that code and the snarky comments were not good. I am considering removing the python version from the public.

Matt -
I appreciate all the work you did on getting the classic mqtt working. It has been really stable and works. I ventured into the IOTStack as an easy way to load those other programs like grafana . As far as Paraprhaser's build - it just doesn't work . I turned the other builds off and turned your builds on - they work.  I ventured into the IOTstack version and stuff just as a way to learn more about docker .  I didn't understand why he criticized the comments - it just seems like common sense and teaching others and I am sure most appreciate that you  took the time to put them in.
My only goal was to have one version of Mosquitto running - and I probably can - I just haven't quite figured it all out yet.  Please accept my apologies if anything I did on my end contributed to your frustration about this.
Larry
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system 2
 5s 135w Kyocero , 3s3p 270w Kyocera  to Classic 150 ,   8s Kyocera 225w to Hawkes Bay Jakiper 48v 15kwh LiFePO4 , Outback VFX 3648 inverter
system 3
KID / Brat portable

daklein

Matt,   Thank you for ClassicMQTT!   It did work already as it was, and your instructions are clear and easy enough for a middle aged hack to follow!   I set it up and manually started the docker image (method 2), and it worked.  It's awesome, I'm already using the bat voltage measured from the Classic in my system control a little bit, charge another battery bank when the main battery is not accepting any more AC coupled solar.     

My Pi I already had IOTstack on, I don't think I would have gotten all of mosquitto / nodered / influx / grafana all working together otherwise  (middle aged hack and all...).  I didn't know how to combine all that and have ClassicMQTT set up running from docker-compose and started on bootup, have it backed up, not have double mosquitto.  I think all the items need to be under one docker so they all share their same little network within docker?   Anyway, after a bunch of back & forth on discord, I got mine working, sort of temporary in a couple of details though.  None of my trouble with is the fault of your code or setup, only my lack of expertise with docker, and the complexity of all the other shtuff on the Pi.   I'm planning to redo it to see if I understand all the details, and test it some more.  I was planning to offer another install method description in the wiki, ie: method 4, if that's of interest.
Thanks,  Dale


Graham

Quote from: ForeverHomestead on January 27, 2021, 06:00:26 PM
...

What format is the "AbsorbTime":18000, in.

I am trying to figure out how to get it into useful format in my .net script.

It's the value in register 4139
you can find it in the attached classic_register_map document

Off-Grid Island cottage, Lac Simon QC Canada
370 Ahrs @ 24V (4 8L16 batteries)
4 x 250watt panels on dual axis trackers http://tinyurl.com/hfpkgr5
Classic 150, Whizbang Jr.
Android Monitor: http://tinyurl.com/lomzq3s

mcsarge

I appreciate the support guys, but those comments were way off base. I posted a note in there that he should have just started with the simple docker image and then he would not had to have figured out what I was doing with mosquitto.


Matt

Quote from: daklein on January 27, 2021, 09:07:43 PM
Matt,   Thank you for ClassicMQTT!   It did work already as it was, and your instructions are clear and easy enough for a middle aged hack to follow!   I set it up and manually started the docker image (method 2), and it worked.  It's awesome, I'm already using the bat voltage measured from the Classic in my system control a little bit, charge another battery bank when the main battery is not accepting any more AC coupled solar.     

My Pi I already had IOTstack on, I don't think I would have gotten all of mosquitto / nodered / influx / grafana all working together otherwise  (middle aged hack and all...).  I didn't know how to combine all that and have ClassicMQTT set up running from docker-compose and started on bootup, have it backed up, not have double mosquitto.  I think all the items need to be under one docker so they all share their same little network within docker?   Anyway, after a bunch of back & forth on discord, I got mine working, sort of temporary in a couple of details though.  None of my trouble with is the fault of your code or setup, only my lack of expertise with docker, and the complexity of all the other shtuff on the Pi.   I'm planning to redo it to see if I understand all the details, and test it some more.  I was planning to offer another install method description in the wiki, ie: method 4, if that's of interest.
Thanks,  Dale
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: 4s2p ROLLS S6-460AGM 6V for 24V pack
Inverter/Charger: Trace DR2424
Call Sign: KG4EUF

Graham

Quote from: ClassicCrazy on January 26, 2021, 11:39:55 PM
Quote from: daklein on January 26, 2021, 01:01:14 AM

This would be very helpful for anyone using classicMQTT with an IOTstack RPi, me for one!  Big thanks to Paraphraser from IOTstack discord!

https://gist.github.com/Paraphraser/378d17e759901d4871e5be4327e3f3c8

I have been trying to follow this and do the build.
I get an error though when I try to do the final build ( and I am using all his latest revisions) .
Did you get it working using this method  ?
I mainly want to just use the IOTstack mosquitto and not the other one installed by ClassicMQTT for pi .

Larry
I'm not sure if I understand what he's trying to do, in step 5 he's modifying the docker-compose.yml file which is the output of IOTStacks ./menu.sh "Build Stack" command.

IOTStack allows you to add a custom service using the compose-override.yml file which will get merged into the generated docker-compose.yml file when you run the "Build Stack" command.
The resulting docker-compose.yml file will include the content of the compose-override.yml, the image: classicdiy/classicmqtt in the classic_mqtt: section tells docker compose to get the image from dockerHub.
You also have to create a .env file that has the parameters for the classic.
See "Adding custom services" in: https://sensorsiot.github.io/IOTstack/Custom/

I created an organization and repository on dockerHub https://hub.docker.com/r/classicdiy/classicmqtt that has the docker image for the Raspberry Pi 4 ARM.
All you need from the classicMQTT github page is the compose-override.yml file (https://github.com/ClassicDIY/ClassicMQTT/blob/master/code/Python/compose-override.yml)
Place this file in the IOTStack directory on the pi along with the .env file.

I added a page to the wiki that describes the installation steps using IOTStack https://github.com/ClassicDIY/ClassicMQTT/wiki/3.1-Raspberry-Pi-setup-using-IOTStack, let me know if I missed any steps.
I can also add how to setup multiple classics using IOTStack if anyone is interested...

Graham.
Off-Grid Island cottage, Lac Simon QC Canada
370 Ahrs @ 24V (4 8L16 batteries)
4 x 250watt panels on dual axis trackers http://tinyurl.com/hfpkgr5
Classic 150, Whizbang Jr.
Android Monitor: http://tinyurl.com/lomzq3s

ClassicCrazy

Quote from: Graham on January 28, 2021, 11:47:32 AM
Quote from: ClassicCrazy on January 26, 2021, 11:39:55 PM
Quote from: daklein on January 26, 2021, 01:01:14 AM

This would be very helpful for anyone using classicMQTT with an IOTstack RPi, me for one!  Big thanks to Paraphraser from IOTstack discord!

https://gist.github.com/Paraphraser/378d17e759901d4871e5be4327e3f3c8

I have been trying to follow this and do the build.
I get an error though when I try to do the final build ( and I am using all his latest revisions) .
Did you get it working using this method  ?
I mainly want to just use the IOTstack mosquitto and not the other one installed by ClassicMQTT for pi .

Larry
I'm not sure if I understand what he's trying to do, in step 5 he's modifying the docker-compose.yml file which is the output of IOTStacks ./menu.sh "Build Stack" command.

IOTStack allows you to add a custom service using the compose-override.yml file which will get merged into the generated docker-compose.yml file when you run the "Build Stack" command.
The resulting docker-compose.yml file will include the content of the compose-override.yml, the image: classicdiy/classicmqtt in the classic_mqtt: section tells docker compose to get the image from dockerHub.
You also have to create a .env file that has the parameters for the classic.
See "Adding custom services" in: https://sensorsiot.github.io/IOTstack/Custom/

I created an organization and repository on dockerHub https://hub.docker.com/r/classicdiy/classicmqtt that has the docker image for the Raspberry Pi 4 ARM.
All you need from the classicMQTT github page is the compose-override.yml file (https://github.com/ClassicDIY/ClassicMQTT/blob/master/code/Python/compose-override.yml)
Place this file in the IOTStack directory on the pi along with the .env file.

I added a page to the wiki that describes the installation steps using IOTStack https://github.com/ClassicDIY/ClassicMQTT/wiki/3.1-Raspberry-Pi-setup-using-IOTStack, let me know if I missed any steps.
I can also add how to setup multiple classics using IOTStack if anyone is interested...

Graham.

I am giving this a try following your instructions . I will let you know how it goes.
I deleted the IOTstack classic mqtt that was there so I start out fresh I hope .
And yes I would like to know how to set up the multiple classics.
Thanks
Larry
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system 2
 5s 135w Kyocero , 3s3p 270w Kyocera  to Classic 150 ,   8s Kyocera 225w to Hawkes Bay Jakiper 48v 15kwh LiFePO4 , Outback VFX 3648 inverter
system 3
KID / Brat portable

Graham

Quote from: ClassicCrazy on January 28, 2021, 12:02:43 PM
...
I am giving this a try following your instructions . I will let you know how it goes.
I deleted the IOTstack classic mqtt that was there so I start out fresh I hope .
And yes I would like to know how to set up the multiple classics.
Thanks
Larry

You'll have to delete the docker containers and images
use docker ps to list the containers
and docker images to list the images
then sudo docker rm <containerId> to stop each container
and sudo docker rmi <imageId> to delete the images

you could also uninstall docker to really start out fresh

use dpkg -l | grep -i docker to list all the docker packages you have on your pi
then sudo apt remove docker-c* to uninstall each docker-c... package

you probably have
docker-ce
docker-ce-cli
docker-compose
Off-Grid Island cottage, Lac Simon QC Canada
370 Ahrs @ 24V (4 8L16 batteries)
4 x 250watt panels on dual axis trackers http://tinyurl.com/hfpkgr5
Classic 150, Whizbang Jr.
Android Monitor: http://tinyurl.com/lomzq3s

ClassicCrazy

Quote from: Graham on January 28, 2021, 01:53:15 PM
Quote from: ClassicCrazy on January 28, 2021, 12:02:43 PM
...
I am giving this a try following your instructions . I will let you know how it goes.
I deleted the IOTstack classic mqtt that was there so I start out fresh I hope .
And yes I would like to know how to set up the multiple classics.
Thanks
Larry

You'll have to delete the docker containers and images
use docker ps to list the containers
and docker images to list the images
then sudo docker rm <containerId> to stop each container
and sudo docker rmi <imageId> to delete the images

you could also uninstall docker to really start out fresh

use dpkg -l | grep -i docker to list all the docker packages you have on your pi
then sudo apt remove docker-c* to uninstall each docker-c... package

you probably have
docker-ce
docker-ce-cli
docker-compose

Okay - I think I will do that - nothing is working out too well. I was tempted to just reflash my pi card and start out fresh . But I will give your suggestions a try.
Do I need to wipe out my old Classic-Mqtt that runs under Python too ?
I tried so many things in the last few days I think I might be better off just starting with fresh flash of pi

Larry
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system 2
 5s 135w Kyocero , 3s3p 270w Kyocera  to Classic 150 ,   8s Kyocera 225w to Hawkes Bay Jakiper 48v 15kwh LiFePO4 , Outback VFX 3648 inverter
system 3
KID / Brat portable

mcsarge

Larry,

I have wiped and started again with my Raspberry Pi so many times, they are uncountable. There are ways to remove everything but etching a new SDcard is just easier - I sometime create a new SDCard and save the old one, you can put it in a USB reader and stick it in the newly programmed Pi and get anything you might have left behind.


[/quote]

Okay - I think I will do that - nothing is working out too well. I was tempted to just reflash my pi card and start out fresh . But I will give your suggestions a try.
Do I need to wipe out my old Classic-Mqtt that runs under Python too ?
I tried so many things in the last few days I think I might be better off just starting with fresh flash of pi

Larry
[/quote]
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: 4s2p ROLLS S6-460AGM 6V for 24V pack
Inverter/Charger: Trace DR2424
Call Sign: KG4EUF

ClassicCrazy

Quote from: mcsarge on January 28, 2021, 06:51:10 PM
Larry,

I have wiped and started again with my Raspberry Pi so many times, they are uncountable. There are ways to remove everything but etching a new SDcard is just easier - I sometime create a new SDCard and save the old one, you can put it in a USB reader and stick it in the newly programmed Pi and get anything you might have left behind.



Okay - I think I will do that - nothing is working out too well. I was tempted to just reflash my pi card and start out fresh . But I will give your suggestions a try.
Do I need to wipe out my old Classic-Mqtt that runs under Python too ?
I tried so many things in the last few days I think I might be better off just starting with fresh flash of pi

Larry
[/quote]
[/quote]

Good advice Matt  on saving the old card - next time I will do that . I just wiped it and am starting out fresh which I am getting pretty good at setting them back up again now !

Larry


system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system 2
 5s 135w Kyocero , 3s3p 270w Kyocera  to Classic 150 ,   8s Kyocera 225w to Hawkes Bay Jakiper 48v 15kwh LiFePO4 , Outback VFX 3648 inverter
system 3
KID / Brat portable

daklein

Quote from: Graham on January 28, 2021, 11:47:32 AM

I created an organization and repository on dockerHub https://hub.docker.com/r/classicdiy/classicmqtt that has the docker image for the Raspberry Pi 4 ARM.
All you need from the classicMQTT github page is the compose-override.yml file (https://github.com/ClassicDIY/ClassicMQTT/blob/master/code/Python/compose-override.yml)
Place this file in the IOTStack directory on the pi along with the .env file.

I added a page to the wiki that describes the installation steps using IOTStack https://github.com/ClassicDIY/ClassicMQTT/wiki/3.1-Raspberry-Pi-setup-using-IOTStack, let me know if I missed any steps.
I can also add how to setup multiple classics using IOTStack if anyone is interested...

Graham.

Thanks Graham,   I plan to try installing it this way also.   Are the dockerhub images specific to the Pi hardware?  ie:  3b vs. 4 ?         Dale

ClassicCrazy

#176
Quote from: Graham on January 28, 2021, 11:47:32 AM
Quote from: ClassicCrazy on January 26, 2021, 11:39:55 PM
Quote from: daklein on January 26, 2021, 01:01:14 AM

This would be very helpful for anyone using classicMQTT with an IOTstack RPi, me for one!  Big thanks to Paraphraser from IOTstack discord!

https://gist.github.com/Paraphraser/378d17e759901d4871e5be4327e3f3c8

I have been trying to follow this and do the build.
I get an error though when I try to do the final build ( and I am using all his latest revisions) .
Did you get it working using this method  ?
I mainly want to just use the IOTstack mosquitto and not the other one installed by ClassicMQTT for pi .

Larry
I'm not sure if I understand what he's trying to do, in step 5 he's modifying the docker-compose.yml file which is the output of IOTStacks ./menu.sh "Build Stack" command.

IOTStack allows you to add a custom service using the compose-override.yml file which will get merged into the generated docker-compose.yml file when you run the "Build Stack" command.
The resulting docker-compose.yml file will include the content of the compose-override.yml, the image: classicdiy/classicmqtt in the classic_mqtt: section tells docker compose to get the image from dockerHub.
You also have to create a .env file that has the parameters for the classic.
See "Adding custom services" in: https://sensorsiot.github.io/IOTstack/Custom/

I created an organization and repository on dockerHub https://hub.docker.com/r/classicdiy/classicmqtt that has the docker image for the Raspberry Pi 4 ARM.
All you need from the classicMQTT github page is the compose-override.yml file (https://github.com/ClassicDIY/ClassicMQTT/blob/master/code/Python/compose-override.yml)
Place this file in the IOTStack directory on the pi along with the .env file.

I added a page to the wiki that describes the installation steps using IOTStack https://github.com/ClassicDIY/ClassicMQTT/wiki/3.1-Raspberry-Pi-setup-using-IOTStack, let me know if I missed any steps.
I can also add how to setup multiple classics using IOTStack if anyone is interested...

Graham.

I installed Pi OS  Buster full version with suggested software on Pi3B+ with 32 GB sd card

sudo apt install -y git curl  was already installed on my pi

It didn't build the classic_mqtt - I first  had copied wrong file( classic_mqtt_compose.yml) and did build which didn't work.  Next I deleted that and copied compose-override.yaml  into Iotstack  and did build again, then restarted stack
It is not building the classic-mqtt container
I tried a few times and restarted pi too.
update - found problem - - I had named compose-override.yaml instead of .yml   - geez !
Now it built okay
success on using MQTT.fx
( need to really follow those screen shots carefully )
success on using connecting to ClassicMQTT  using Node Red ( Node Red is built into new Raspberry Pi builds - at least mine so I used that instead of installing from IOTstack)
No success so far into getting Android Classic Monitoring App to connect via MQTT - I will revisit the wiki to see if I am doing something wrong.
Larry
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system 2
 5s 135w Kyocero , 3s3p 270w Kyocera  to Classic 150 ,   8s Kyocera 225w to Hawkes Bay Jakiper 48v 15kwh LiFePO4 , Outback VFX 3648 inverter
system 3
KID / Brat portable

ClassicCrazy

#177
Quote from: ClassicCrazy on January 28, 2021, 11:26:00 PM
Quote from: Graham on January 28, 2021, 11:47:32 AM
Quote from: ClassicCrazy on January 26, 2021, 11:39:55 PM
Quote from: daklein on January 26, 2021, 01:01:14 AM

This would be very helpful for anyone using classicMQTT with an IOTstack RPi, me for one!  Big thanks to Paraphraser from IOTstack discord!

https://gist.github.com/Paraphraser/378d17e759901d4871e5be4327e3f3c8

I have been trying to follow this and do the build.
I get an error though when I try to do the final build ( and I am using all his latest revisions) .
Did you get it working using this method  ?
I mainly want to just use the IOTstack mosquitto and not the other one installed by ClassicMQTT for pi .

Larry
I'm not sure if I understand what he's trying to do, in step 5 he's modifying the docker-compose.yml file which is the output of IOTStacks ./menu.sh "Build Stack" command.

IOTStack allows you to add a custom service using the compose-override.yml file which will get merged into the generated docker-compose.yml file when you run the "Build Stack" command.
The resulting docker-compose.yml file will include the content of the compose-override.yml, the image: classicdiy/classicmqtt in the classic_mqtt: section tells docker compose to get the image from dockerHub.
You also have to create a .env file that has the parameters for the classic.
See "Adding custom services" in: https://sensorsiot.github.io/IOTstack/Custom/

I created an organization and repository on dockerHub https://hub.docker.com/r/classicdiy/classicmqtt that has the docker image for the Raspberry Pi 4 ARM.
All you need from the classicMQTT github page is the compose-override.yml file (https://github.com/ClassicDIY/ClassicMQTT/blob/master/code/Python/compose-override.yml)
Place this file in the IOTStack directory on the pi along with the .env file.

I added a page to the wiki that describes the installation steps using IOTStack https://github.com/ClassicDIY/ClassicMQTT/wiki/3.1-Raspberry-Pi-setup-using-IOTStack, let me know if I missed any steps.
I can also add how to setup multiple classics using IOTStack if anyone is interested...

Graham.



I started over and installed fresh  Pi OS  Buster full version with suggested software on Pi3B+ with 32 GB sd card

sudo apt install -y git curl  was already installed on my pi

It didn't build the classic_mqtt - I first  had copied wrong file( classic_mqtt_compose.yml) and did build which didn't work.  Next I deleted that and copied compose-override.yaml  into Iotstack  and did build again, then restarted stack
It is not building the classic-mqtt container
I tried a few times and restarted pi too.
update - found problem - - I had named compose-override.yaml instead of .yml   - geez !
Now it built okay
success on using MQTT.fx and connecting
( need to really follow those screen shots from directions carefully  )
success on using connecting to ClassicMQTT  using Node Red ( Node Red is built into new Raspberry Pi builds - at least mine so I used that instead of installing from IOTstack)
success on getting Android Classic Monitoring  App on MQTT 
( first had trouble getting mqtt working on my Fire android tablet - but after clearing , uninstalling, installing newest version , more stuff like restarting it I finally got it to work . Version says 3.0.6 . but I installed same APK on my galaxy 4 phone and it shows 3.1.0 version. )
Larry
system 1
Classic 150 , 5s3p  Kyocera 135watt , 12s Soneil 2v 540amp lead crystal for 24v pack , Outback 3524 inverter
system 2
 5s 135w Kyocero , 3s3p 270w Kyocera  to Classic 150 ,   8s Kyocera 225w to Hawkes Bay Jakiper 48v 15kwh LiFePO4 , Outback VFX 3648 inverter
system 3
KID / Brat portable

Graham

Quote from: ClassicCrazy on January 29, 2021, 12:29:47 AM
...
success on getting Android Classic Monitoring  App on MQTT 
( first had trouble getting mqtt working on my Fire android tablet - but after clearing , uninstalling, installing newest version , more stuff like restarting it I finally got it to work . Version says 3.0.6 . but I installed same APK on my galaxy 4 phone and it shows 3.1.0 version. )
Larry

Hmm, not sure why it's showing version 3.1.0, could your galaxy 4 already have had version 3.1.0, you would not be able to install 3.0.6 without first uninstalling 3.1.0.
The "MQTT" branch of ClassicMonitor is currently at version 3.0.6,
the new "master" branch (currently 3.1.4) is the merge of the latest updates of the app store branch "NoMQTT" with the MQTT branch as well as an experimental update to access my Tri-Star TS-45 using the modbus adapter.
Version 3.0.6 should be ok for testing ClassicMQTT


Graham
Off-Grid Island cottage, Lac Simon QC Canada
370 Ahrs @ 24V (4 8L16 batteries)
4 x 250watt panels on dual axis trackers http://tinyurl.com/hfpkgr5
Classic 150, Whizbang Jr.
Android Monitor: http://tinyurl.com/lomzq3s

Graham

Quote from: daklein on January 28, 2021, 11:10:00 PM
...

Thanks Graham,   I plan to try installing it this way also.   Are the dockerhub images specific to the Pi hardware?  ie:  3b vs. 4 ?         Dale

Looks like Larry got it working on a Pi3B+

I have it working on Docker Desktop on Windows 10 as well
Off-Grid Island cottage, Lac Simon QC Canada
370 Ahrs @ 24V (4 8L16 batteries)
4 x 250watt panels on dual axis trackers http://tinyurl.com/hfpkgr5
Classic 150, Whizbang Jr.
Android Monitor: http://tinyurl.com/lomzq3s