Author Topic: ESP32 Classic MQTT Publisher & Home Assistant  (Read 11434 times)

ClassicCrazy

  • Hero Member
  • *****
  • Posts: 2842
Re: ESP32 Classic MQTT Publisher & Home Assistant
« Reply #180 on: January 29, 2021, 11:48:02 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

I probably had some other version of Classic Monitoring app on my phone already and didn't realize it- I don't use that phone too often as I have lineage OS on it and don't pay for phone service.

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

Graham

  • Sr. Member
  • ****
  • Posts: 292
    • ClassicDiy
Re: ESP32 Classic MQTT Publisher & Home Assistant
« Reply #181 on: January 31, 2021, 10:41:49 AM »
I updated the image on dockerHub https://hub.docker.com/r/classicdiy/classicmqtt so that you can now define the startup parameters in the environment section of the docker-compose.yml file when using IOTStack to setup your docker containers. You no longer need the .env file or the command: parameters.
Updated the wiki accordingly...
https://github.com/ClassicDIY/ClassicMQTT/wiki/3.1-Raspberry-Pi-setup-using-IOTStack


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

  • Hero Member
  • *****
  • Posts: 2842
Re: ESP32 Classic MQTT Publisher & Home Assistant
« Reply #182 on: January 31, 2021, 01:24:58 PM »
I updated the image on dockerHub https://hub.docker.com/r/classicdiy/classicmqtt so that you can now define the startup parameters in the environment section of the docker-compose.yml file when using IOTStack to setup your docker containers. You no longer need the .env file or the command: parameters.
Updated the wiki accordingly...
https://github.com/ClassicDIY/ClassicMQTT/wiki/3.1-Raspberry-Pi-setup-using-IOTStack


Graham

I got this error on build - probably because I had previous build the other way ?
Issue running build:
while constructing a mapping
  in "./compose-override.yml", line 2, column 3
found duplicate key "classic_mqtt" with value "ordereddict([('container_name', 'classic_mqtt'), ('image', 'classicdiy/classicmqtt'), ('restart', 'unless-stopped'), ('environment', ['LOGLEVEL=DEBUG', 'CLASSIC=192.168.2.31', 'CLASSIC_PORT=502', 'CLASSIC_NAME=HoopPV', 'MQTT_HOST=mosquitto', 'MQTT_PORT=1883', 'MQTT_ROOT=ClassicMQTT', 'MQTT_USER=ClassicPublisher', 'MQTT_PASS=ClassicPub']), ('networks', ['iotstack_nw'])])" (original value: "ordereddict([('container_name', 'classic_mqtt'), ('image', 'classicdiy/classicmqtt'), ('restart', 'unless-stopped'), ('environment', ['LOGLEVEL=DEBUG', 'CLASSIC=192.168.3.2', 'CLASSIC_PORT=502', 'CLASSIC_NAME=CLASSIC2', 'MQTT_HOST=mosquitto', 'MQTT_PORT=1883', 'MQTT_ROOT=ClassicMQTT', 'MQTT_USER=ClassicPublisher', 'MQTT_PASS=ClassicPub']), ('networks', ['iotstack_nw'])])")
  in "./compose-override.yml", line 20, column 3

To suppress this check see:
    http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys

Duplicate keys will become an error in future releases, and are errors
by default when using the new API.

I had already deleted .env file , then I deleted the classic part of docker_compose.yml , I used portainer and removed previous classicmqtt image, rebooted pi , but it still won't build and I get the same error as above.
After breakfast I may try to do what the link in the error message says to do if I can figure out how to do that.

Larry
« Last Edit: January 31, 2021, 02:40:26 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

Graham

  • Sr. Member
  • ****
  • Posts: 292
    • ClassicDiy
Re: ESP32 Classic MQTT Publisher & Home Assistant
« Reply #183 on: January 31, 2021, 02:42:12 PM »

I got this error on build - probably because I had previous build the other way ?
Issue running build:
while constructing a mapping
  in "./compose-override.yml", line 2, column 3
found duplicate key "classic_mqtt" with value "ordereddict([('container_name', 'classic_mqtt'), ('image', 'classicdiy/classicmqtt'), ('restart', 'unless-stopped'), ('environment', ['LOGLEVEL=DEBUG', 'CLASSIC=192.168.2.31', 'CLASSIC_PORT=502', 'CLASSIC_NAME=HoopPV', 'MQTT_HOST=mosquitto', 'MQTT_PORT=1883', 'MQTT_ROOT=ClassicMQTT', 'MQTT_USER=ClassicPublisher', 'MQTT_PASS=wt9m']), ('networks', ['iotstack_nw'])])" (original value: "ordereddict([('container_name', 'classic_mqtt'), ('image', 'classicdiy/classicmqtt'), ('restart', 'unless-stopped'), ('environment', ['LOGLEVEL=DEBUG', 'CLASSIC=192.168.3.2', 'CLASSIC_PORT=502', 'CLASSIC_NAME=CLASSIC2', 'MQTT_HOST=mosquitto', 'MQTT_PORT=1883', 'MQTT_ROOT=ClassicMQTT', 'MQTT_USER=ClassicPublisher', 'MQTT_PASS=ClassicPub']), ('networks', ['iotstack_nw'])])")
  in "./compose-override.yml", line 20, column 3
...
Larry

Looks like you have the container name in there twice

the second block should be called something different than the first and must have a unique container_name (see attached example)

you can delete your docker-compose.yml file in IOTStack, the menu.sh->Build Stack will create a new one with everything you selected.


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

  • Hero Member
  • *****
  • Posts: 2842
Re: ESP32 Classic MQTT Publisher & Home Assistant
« Reply #184 on: January 31, 2021, 03:00:55 PM »

I got this error on build - probably because I had previous build the other way ?
Issue running build:
while constructing a mapping
  in "./compose-override.yml", line 2, column 3
found duplicate key "classic_mqtt" with value "ordereddict([('container_name', 'classic_mqtt'), ('image', 'classicdiy/classicmqtt'), ('restart', 'unless-stopped'), ('environment', ['LOGLEVEL=DEBUG', 'CLASSIC=192.168.2.31', 'CLASSIC_PORT=502', 'CLASSIC_NAME=HoopPV', 'MQTT_HOST=mosquitto', 'MQTT_PORT=1883', 'MQTT_ROOT=ClassicMQTT', 'MQTT_USER=ClassicPublisher', 'MQTT_PASS=wt9m']), ('networks', ['iotstack_nw'])])" (original value: "ordereddict([('container_name', 'classic_mqtt'), ('image', 'classicdiy/classicmqtt'), ('restart', 'unless-stopped'), ('environment', ['LOGLEVEL=DEBUG', 'CLASSIC=192.168.3.2', 'CLASSIC_PORT=502', 'CLASSIC_NAME=CLASSIC2', 'MQTT_HOST=mosquitto', 'MQTT_PORT=1883', 'MQTT_ROOT=ClassicMQTT', 'MQTT_USER=ClassicPublisher', 'MQTT_PASS=ClassicPub']), ('networks', ['iotstack_nw'])])")
  in "./compose-override.yml", line 20, column 3
...
Larry

Looks like you have the container name in there twice

the second block should be called something different than the first and must have a unique container_name (see attached example)

you can delete your docker-compose.yml file in IOTStack, the menu.sh->Build Stack will create a new one with everything you selected.


Graham.

That seems to have done it Graham - thanks.
You may want to edit the file I got off the link .
This one - is where I got it from
https://github.com/ClassicDIY/ClassicMQTT/blob/master/code/Python/compose-override.yml

Larry
« Last Edit: January 31, 2021, 03:02:34 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

Graham

  • Sr. Member
  • ****
  • Posts: 292
    • ClassicDiy
Re: ESP32 Classic MQTT Publisher & Home Assistant
« Reply #185 on: January 31, 2021, 03:08:19 PM »
...

That seems to have done it Graham - thanks.
You may want to edit the file I got off the link .
This one - is where I got it from
https://github.com/ClassicDIY/ClassicMQTT/blob/master/code/Python/compose-override.yml

Larry

thanks Larry
I updated the file


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

  • Hero Member
  • *****
  • Posts: 2842
Re: ESP32 Classic MQTT Publisher & Home Assistant
« Reply #186 on: January 31, 2021, 03:18:04 PM »
...

That seems to have done it Graham - thanks.
You may want to edit the file I got off the link .
This one - is where I got it from
https://github.com/ClassicDIY/ClassicMQTT/blob/master/code/Python/compose-override.yml

Larry

thanks Larry
I updated the file


Graham

Okay rebuilt worked .
I wasn't getting Classic2 publishing
Just found a typo I put in on the ip address
That took awhile for me to figure out !
Larry
« Last Edit: January 31, 2021, 04:54:32 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: 123
Re: ESP32 Classic MQTT Publisher & Home Assistant
« Reply #187 on: February 16, 2021, 08:35:48 AM »
Hey All,

I am working on an update to the python implementation, it can read the environment variables directly in the code, so once the environment variable are set in the docker-compose or at the command line, it will be able to get those values in the python code. I am implementing it so it will use the environment variables if the value is not set in the command line. That way a command line setting will override the environment variable. I think the the whole creating of the .env file confused too many people. As soon as I get it finished and tested I will create a pull.

This may make the Home Assistance setup easier too.

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

Graham

  • Sr. Member
  • ****
  • Posts: 292
    • ClassicDiy
Re: ESP32 Classic MQTT Publisher & Home Assistant
« Reply #188 on: February 16, 2021, 08:52:10 AM »
Hey All,

I am working on an update to the python implementation, it can read the environment variables directly in the code, so once the environment variable are set in the docker-compose or at the command line, it will be able to get those values in the python code. I am implementing it so it will use the environment variables if the value is not set in the command line. That way a command line setting will override the environment variable. I think the the whole creating of the .env file confused too many people. As soon as I get it finished and tested I will create a pull.

This may make the Home Assistance setup easier too.

Matt

Hey Matt, did you see my pull request https://github.com/ClassicDIY/ClassicMQTT/pull/25 that adds the environment variables...


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

mcsarge

  • Full Member
  • ***
  • Posts: 123
Re: ESP32 Classic MQTT Publisher & Home Assistant
« Reply #189 on: February 16, 2021, 05:20:40 PM »
Well,

No I did not, stupid me. I put a bunch of work into the validator set them first and your method of setting them in the initialization looks far easier! I will get your changes and then push them down to me.

Matt

Hey All,

I am working on an update to the python implementation, it can read the environment variables directly in the code, so once the environment variable are set in the docker-compose or at the command line, it will be able to get those values in the python code. I am implementing it so it will use the environment variables if the value is not set in the command line. That way a command line setting will override the environment variable. I think the the whole creating of the .env file confused too many people. As soon as I get it finished and tested I will create a pull.

This may make the Home Assistance setup easier too.

Matt

Hey Matt, did you see my pull request https://github.com/ClassicDIY/ClassicMQTT/pull/25 that adds the environment variables...


Graham.
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