InfernoEmbedded / PowerScraper

A scraper for power devices to feed data to OpenEnergyMonitor
GNU General Public License v3.0
36 stars 17 forks source link

how to use #1

Closed sommo closed 5 years ago

sommo commented 6 years ago

Hi! i'm back :P i see you update the project, how could i use it? after edit the config.tml (but what i have to edit?) i was thinking that i need to edit inverter's ip address but can't find it... could you help me? Thank you!

deece commented 6 years ago

Start by copying comfig-sample.toml to config.toml. If you want to use the Wifi interface, add a list of inverter IPs or hostnames under 'inverters', in the sample, there are 3 hostnames there.

I've added support for the ethernet interface too, to user that, set the inverters list for the Wifi section to the empty list '[]', and add the IP address or hostname of the ethernet interface under 'inverters' for the Solax-Modbus section.

If you don't have an SDM630 Power meter, you should leave the 'ports' line of that section as the empty list too.

deece commented 6 years ago

I spoke to the Solax engineers, there is no way to disable the Wifi interface. You can significantly reduce the signal though by removing the top and front cover, then disconnecting the antenna cable from the motherboard. This will probably void your warranty though, so do this at your own risk.

sommo commented 6 years ago

All clear, I think tomorrow I will try! My inverter is connect via wifi to my my network, so i will put the inverter ip where u said, or by wifi u meaning when connecting to inverter ap wifi? Any way for the enomcms side, I need to configure sensor right? Like in other post says? Or needs a custom configuration for them to work with your script? It could be awesome also to trigger the collected data not through enomcms or any other external service/cloud but directly to a webserver in lan (so i can get graphs also if there is no internet connection or cloud maintenance) and most important no data goes out from our home, at least we could publish it directly from our public ip (on specific port) to reach it when we are away.. What you think?

deece commented 6 years ago
  1. It needs your inverter's IP on your Wifi interface. The wired interface is a better choice though, it exports far more information and doesn't add load to your wireless network.
  2. Once working, you should see inputs show up in EmonCMS from your inverter, you can then create feeds based on this.
  3. The software is modular, so if you want to stash the data elsewhere, you can write an output module to do that. I would just run EmonCMS locally though, it's not hard to set up.
sommo commented 6 years ago

Amazing! I’m looking to install emoncms on my pi, didnt thought it could be possible. Thank you! I will let you know!

Inviato da iPhone

Il giorno 26 lug 2018, alle ore 01:11, deece notifications@github.com ha scritto:

It needs your inverter's IP on your Wifi interface. Once working, you should see inputs show up in EmonCMS from your inverter, you can then create feeds based on this. The software is modular, so if you want to stash the data elsewhere, you can write an output module to do that. I would just run EmonCMS locally though, it's not hard to set up. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

sommo commented 6 years ago

Hi! i'm having issue when trying to launch the script:

=> python power_scraper.py Traceback (most recent call last): File "power_scraper.py", line 37, in from Inputs.SolaxWifi import SolaxWifi ImportError: No module named Inputs.SolaxWifi

my config.toml: poll_period = 10 # seconds

[Solax-Wifi] timeout = 5 # seconds inverters = ['192.168.0.106']

[Solax-Modbus] timeout = 5 # seconds inverters = []

[SDM630Modbusv2] timeout = 5 # seconds baud = 38400 parity = 'E' stopbits = 1 ports = []

[emoncms] timeout = 5 # seconds server = "http://xxxxxxxxx" api_key = "xxxxxxxxxxxxxxxx"

all dependecies seems ok: sudo pip install toml twisted pymodbus Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: toml in /usr/local/lib/python2.7/dist-packages (0.9.4) Requirement already satisfied: twisted in /usr/lib/python2.7/dist-packages (16.6.0) Requirement already satisfied: pymodbus in /usr/local/lib/python2.7/dist-packages (1.5.2) Requirement already satisfied: pyserial>=2.6 in /usr/local/lib/python2.7/dist-packages (from pymodbus) (3.2.1)

deece commented 6 years ago

How did you download the program? If you just downloaded the script & config file, you'll need to clone the full repo (or download & extract the archive).

sommo commented 6 years ago

i did a git clone of the repo:

sudo git clone https://github.com/InfernoEmbedded/PowerScraper.git

and i have all the files here /home/pi/PowerScraper:

total 68 drwxr-xr-x 2 root root 4096 Jul 30 07:52 Outputs -rw-r--r-- 1 root root 35149 Jul 30 07:52 LICENSE.txt drwxr-xr-x 2 root root 4096 Jul 30 07:52 Inputs -rw-r--r-- 1 root root 311 Jul 30 07:55 config-sample.toml -rw-r--r-- 1 root root 343 Jul 30 08:16 config.toml -rw-r--r-- 1 root root 2605 Jul 30 08:31 EmonCMS.py -rwxr-xr-x 1 root root 2755 Jul 30 10:06 power_scraper.py

deece commented 6 years ago

Hmm, and are you running it from the directory you cloned it into?

sommo commented 6 years ago

yes of course, otehrwise i could not execute it from the wrong folder: pi@emonpi(rw):~$ python power_scraper.py python: can't open file 'power_scraper.py': [Errno 2] No such file or directory

pi@emonpi(rw):PowerScraper$ pwd /home/pi/PowerScraper

pi@emonpi(rw):PowerScraper$ python power_scraper.py Traceback (most recent call last): File "power_scraper.py", line 37, in from Inputs.SolaxWifi import SolaxWifi ImportError: No module named Inputs.SolaxWifi

don't know if emonpi distro, has some issue... i had error by installing via pip some dependaince, but i did it via apt-get install (not pip install) and all requirement are ok:

pi@emonpi(rw):~$ sudo pip install toml twisted pymodbus Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: toml in /usr/local/lib/python2.7/dist-packages (0.9.4) Requirement already satisfied: twisted in /usr/lib/python2.7/dist-packages (16.6.0) Requirement already satisfied: pymodbus in /usr/local/lib/python2.7/dist-packages (1.5.2) Requirement already satisfied: pyserial>=2.6 in /usr/local/lib/python2.7/dist-packages (from pymodbus) (3.2.1)

the error is: ImportError: No module named Inputs.SolaxWifi

seems a script problem.. don't know if i can trust the emonpi distro but i think is usefull to run your script and the emoncms server on the same machine so it can point locally directly. i could try to install the script (and other packages) on a different rpi if you don't know how to resolve or point me to that error.

deece commented 6 years ago

Could you please paste the output of find . from the directory with the script? We should see 'Inputs/SolaxWifi.py' in there.

deece commented 6 years ago

One other thing to try, I've only tested with Python 3.6, not 2.7. I'm still fairly new to Python, but there may be some differences there.

sommo commented 6 years ago

i'm struggling with installing python3 and it's dependancy, no way still haveing problem installing pymodbus.... i can't figured out.. so can't test with python 3.x

sommo commented 6 years ago

maybe is the python version but don't know

sommo commented 6 years ago

installed python3 on a mac, i recieve error anyway: python3 power_scraper.py Traceback (most recent call last): File "power_scraper.py", line 38, in from Inputs.SolaxModbus import SolaxModbus File "/Users/sommo/Desktop/Solax/PowerScraper/Inputs/SolaxModbus.py", line 1 from pymodbus.client.async import ModbusClientProtocol, ModbusClientFactory

there's something else..

deece commented 6 years ago

Do you have PYTHONPATH set in the environment? If so, you may need to add '.' or the path to the powerscraper directory to it.

sommo commented 6 years ago

What’s the command to do so?

Inviato da iPhone

Il giorno 31 lug 2018, alle ore 14:17, deece notifications@github.com ha scritto:

Do you have PYTHONPATH set in the environment? If so, you may need to add '.' or the path to the powerscraper directory to it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

deece commented 6 years ago

echo $PYTHONPATH will tell you if it's set and what the value is export PYTHONPATH="$PYTHONPATH:/path/to/powerscraper" will add the powerscraper path to it

sommo commented 6 years ago

it doesn't help, thank you anyway

deece commented 6 years ago

Have you had any luck? If not, try changing "from Inputs" to "from .Inputs" (& the same for outputs) as described here, and let me know how you go: https://stackoverflow.com/questions/24722212/python-cant-find-module-in-the-same-folder

averter commented 5 years ago

@sommo I am trying to have the same setup as you. However I am still stuck trying to access the data. Did you configured anything special on your LAN to access the inverter? When I try to access http://ipinverter/api/realTimeData.htm or http://ipinverter/ I am met with a login webpage from Solaxpower. I cannot logon to it with the default admin/admin. Thanks for any information

deece commented 5 years ago

@averter i wouldn't bother with the wifi interface. Modbus on the wired Ethernet interface is a lot richer, and allows you the option of managing the battery by software.