Git Product home page Git Product logo

p1-energy-meter-reader-using-python-in-docker's Introduction

p1-energy-meter-reader-using-python-in-docker's People

Contributors

atkaper avatar mpsanten avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

mpsanten

p1-energy-meter-reader-using-python-in-docker's Issues

Error with step " # start sql server: "

Hi,

After the build script, without any error, the mysql-server script is giving the following error:

pi@raspberrypi:~/p1-energy-meter-reader-using-python-in-docker` $ ./mysql-server.sh
Error: No such container: mysql-meter
Unable to find image 'mysql:latest' locally
latest: Pulling from library/mysql
docker: no matching manifest for linux/arm/v7 in the manifest list entries.
See 'docker run --help'.

Any idea?
Mariadb-server etc are already installed.

running raspbian with Raspberry Pi 3 Model B Plus Rev 1.3
Linux version 5.4.72-v7+ (dom@buildbot) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #1356 SMP Thu Oct 22 13:56:54 BST 2020

Thx!

EDIT1:

uninstalled/purged all mysql libraries
as I'm running on Rpi, mysql is not supported I believe in docker.
however, I have pulled a MySQL docker container from "docker pull hypriot/rpi-mysql "

changed the mysql-server.sh to:

docker rm -f mysql-meter
docker run -d --restart=always --name mysql-meter -p 3306:3306 -v /home/pi/p1-energy-meter-reader-using-python-in-docker/mysqldata:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=MyMeter18 -e MYSQL_DATABASE=meter hypriot/rpi-mysql

I had to delete the last 2 options in the file, as these were not supported, see docker log:

pi@raspberrypi:~/p1-energy-meter-reader-using-python-in-docker $ docker logs mysql-meter
201027 19:40:32 InnoDB: 5.5.60 started; log sequence number 1595675
201027 19:40:32 [ERROR] mysqld: unknown variable 'default-authentication-plugin=mysql_native_password'
201027 19:40:32 [ERROR] Aborting

pi@raspberrypi:~/p1-energy-meter-reader-using-python-in-docker $ docker logs mysql-meter
201027 19:41:12 InnoDB: 5.5.60 started; log sequence number 1595675
201027 19:41:12 [ERROR] mysqld: unknown option '--skip-mysqlx'
201027 19:41:12 [ERROR] Aborting

After those removements, I see successfull start of mysql:

pi@raspberrypi:~/p1-energy-meter-reader-using-python-in-docker $ docker logs mysql-meter
201027 19:41:56 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
201027 19:41:56 [Note] mysqld (mysqld 5.5.60-0+deb7u1) starting as process 1 ...
201027 19:41:56 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
201027 19:41:56 [Note] Plugin 'FEDERATED' is disabled.
201027 19:41:56 InnoDB: The InnoDB memory heap is disabled
201027 19:41:56 InnoDB: Mutexes and rw_locks use GCC atomic builtins
201027 19:41:56 InnoDB: Compressed tables use zlib 1.2.7
201027 19:41:56 InnoDB: Using Linux native AIO
201027 19:41:56 InnoDB: Initializing buffer pool, size = 128.0M
201027 19:41:56 InnoDB: Completed initialization of buffer pool
201027 19:41:56 InnoDB: highest supported file format is Barracuda.
201027 19:41:56  InnoDB: Waiting for the background threads to start
201027 19:41:57 InnoDB: 5.5.60 started; log sequence number 1595675
201027 19:41:57 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
201027 19:41:57 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
201027 19:41:57 [Note] Server socket created on IP: '0.0.0.0'.
201027 19:41:57 [Note] Event Scheduler: Loaded 0 events
201027 19:41:57 [Note] mysqld: ready for connections.
Version: '5.5.60-0+deb7u1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Debian)

But now, getting the following error:

pi@raspberrypi:~/p1-energy-meter-reader-using-python-in-docker $ ./mysql.sh < create-table.sql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
pi@raspberrypi:~/p1-energy-meter-reader-using-python-in-docker $
pi@raspberrypi:~/p1-energy-meter-reader-using-python-in-docker $ ./mysql.sh < create-view.sql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
pi@raspberrypi:~/p1-energy-meter-reader-using-python-in-docker $

Any idea?

EDIT 2:

docker-compose down -v
deleted all the docker containers etc
I have built it again in a different folder, with the modifications to the mysql-server.sh

only phpmyadmin is not working, probably a different architecture:

pi@raspberrypi:~/p11 $ docker logs myadmin-meter
standard_init_linux.go:211: exec user process caused "exec format error"
standard_init_linux.go:211: exec user process caused "exec format error"

Now waiting for the FTDI cable to be delivered, tried with a RS232 console with converters to RJ11, not working.

EDIT3:
Got it work with a USB-2-Serial FTDI convertor, which we normally use for network equipment.

But starting the "start.sh" script gives the following error within docker logs

pi@raspberrypi:~/p11 $ docker logs python-meter
/XMX5LGBBxxxxxxxx

1-3:0.2.8(42) --> DSMR_VERSION = "42"
0-0:1.0.0(201028010108W) --> TIMESTAMP = "2020-10-28 01:01:08"
0-0:96.1.1(xxx) --> METER_ID = "xxx"
1-0:1.8.1(008029.935*kWh) --> TOTAL_DELIVERY_LOW_KWH = "8029.935"
1-0:1.8.2(007466.832*kWh) --> TOTAL_DELIVERY_HIGH_KWH = "7466.832"
1-0:2.8.1(000000.000*kWh) --> TOTAL_BACKDELIVERY_LOW_KWH = "0.000"
1-0:2.8.2(000000.000*kWh) --> TOTAL_BACKDELIVERY_HIGH_KWH = "0.000"
0-0:96.14.0(0001) --> TARIFF_INDICATOR = "1"
1-0:1.7.0(00.538*kW) --> ACTUAL_DELIVERY_KW = "0.538"
1-0:2.7.0(00.000*kW) --> ACTUAL_BACKDELIVERY_KW = "0.000"
0-0:96.7.21(00001) --> NR_POWERFAILURES = "1"
0-0:96.7.9(00000) --> NR_POWERFAILURES_LONG = "00000"
1-0:99.97.0(0)(0-0:96.7.19) --> POWERFAILURE_LOG = "['0', '0-0:96.7.19']"
1-0:32.32.0(00000) --> NR_VOLTAGE_SAGS_L1 = "00000"
1-0:32.36.0(00000) --> NR_VOLTAGE_SWELLS_L1 = "00000"
0-0:96.13.1()
0-0:96.13.0() --> TEXT_MESSAGE = ""
1-0:31.7.0(003*A) --> CURRENT_L1_A = "3"
1-0:21.7.0(00.538*kW) --> ACT_POWER_L1_KW = "0.538"
1-0:22.7.0(00.000*kW) --> ACT_POWER_BACKDELIVERY_L1_KW = "0.000"
!D844

{'ACTUAL_DELIVERY_KW': '0.538', 'ACT_POWER_L1_KW': '0.538', 'CURRENT_L1_A': '3', 'NR_POWERFAILURES_LONG': '00000', 'TOTAL_DELIVERY_LOW_KWH': '8029.935', 'TIMESTAMP': '2020-10-28 01:01:08', 'TOTAL_BACKDELIVERY_HIGH_KWH': '0.000', 'ACTUAL_BACKDELIVERY_KW': '0.000', 'HEADER': '/XMX5LGBBxxxx', 'NR_VOLTAGE_SWELLS_L1': '00000', 'POWERFAILURE_LOG': "['0', '0-0:96.7.19']", 'METER_ID': 'xxxx', 'TOTAL_BACKDELIVERY_LOW_KWH': '0.000', 'TEXT_MESSAGE': '', 'TARIFF_INDICATOR': '1', 'NR_VOLTAGE_SAGS_L1': '00000', 'DSMR_VERSION': '42', 'TOTAL_DELIVERY_HIGH_KWH': '7466.832', 'ACT_POWER_BACKDELIVERY_L1_KW': '0.000', 'NR_POWERFAILURES': '1'}

CHECKSUM OK
Traceback (most recent call last):
  File "/read.py", line 204, in <module>
    cursor.execute("""INSERT INTO `METER` (`TIMESTAMP`, `TOTAL_DELIVERY_LOW_KWH`, `TOTAL_DELIVERY_HIGH_KWH`, `TOTAL_BACKDELIVERY_LOW_KWH`, `TOTAL_BACKDELIVERY_HIGH_KWH`, `TARIFF_INDICATOR`, `ACTUAL_DELIVERY_KW`, `ACTUAL_BACKDELIVERY_KW`, `NR_POWERFAILURES`, `NR_POWERFAILURES_LONG`, `POWERFAILURE_LOG`, `NR_VOLTAGE_SAGS_L1`, `NR_VOLTAGE_SWELLS_L1`, `TEXT_MESSAGE`, `VOLTAGE_L1_V`, `CURRENT_L1_A`, `MBUS1_VALUE_GAS_M3`, `MBUS1_VALUE_TIMESTAMP`, `JSON`) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)""", (values['TIMESTAMP'], values['TOTAL_DELIVERY_LOW_KWH'], values['TOTAL_DELIVERY_HIGH_KWH'], values['TOTAL_BACKDELIVERY_LOW_KWH'], values['TOTAL_BACKDELIVERY_HIGH_KWH'], values['TARIFF_INDICATOR'], values['ACTUAL_DELIVERY_KW'], values['ACTUAL_BACKDELIVERY_KW'], values['NR_POWERFAILURES'], values['NR_POWERFAILURES_LONG'], values['POWERFAILURE_LOG'], values['NR_VOLTAGE_SAGS_L1'], values['NR_VOLTAGE_SWELLS_L1'], values['TEXT_MESSAGE'], values['VOLTAGE_L1_V'], values['CURRENT_L1_A'], values['MBUS1_VALUE_GAS_M3'], values['MBUS1_VALUE_TIMESTAMP'], str(values)))
KeyError: 'VOLTAGE_L1_V'


Edit 4:

Took out the variable within the cursor.execute , however I dont see any error anymore in the docker log, but there is also no fillment of data within mysql. How can we check/know if the docker-database connection to docket-pyton-meter is oke?

FINAL EDIT:

3 Values are taken out from the cursor.execute , while doing this, take out also the %s 3 times in the same command.
Logging is only seen, when the docker is running with -ti

Database is now filled with the data :)
Have to see now, how I can plot the data now.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.