Code Monkey home page Code Monkey logo

sma-sunnyboy's Introduction

Welcome to SMA API!

This is a simple data retrieving for SMA SunnyBoy.

See:

Comptability

Tested on SunnyBoy 5.0 (1.3.17.R)

Installation

pip install SMA-SunnyBoy

Simple usage

from sma_sunnyboy import *
client = WebConnect("192.168.0.10", Right.USER, "password")
client.auth()
pow_current = client.get_value(Key.power_current)
client.logout()

Initialize

Start by import and instantiate the module using WebConnect

from sma_sunnyboy import *
client = WebConnect("192.168.0.10", Right.USER, "password")

Authenticate

Initialize the module using auth()

(return: Boolean)

client.auth()

You can check if you are still authenticated using check_connection()

(return: Boolean)

client.check_connection()

Logout

You have to call logout before exiting the program

(return: Boolean)

client.logout()

Get all instant values

Using get_all_keys() you can obtains all SMA value in JSON format

(return: JSON)

data = client.get_all_keys()
print(data)

Get Value

You can retrieve an instant value using get_value()

Pass in argument the wanted key from Key.key_name

(return: String)

value = client.get_value(Key.power_total)
print(value)

You can use preset keys from the list bellow:

Tag ID Unit
power_current 6100_40263F00 W
power_total 6400_00260100 W
server_ip 6180_104A9A00
server_dns 6180_104A9D00
server_netmask 6180_104A9B00
server_gatewy 6180_104A9C00
power_ab 6380_40251E00
power_b 6380_40451F00
voltage_ab 6380_40451F00
tide_ab 6380_40452100
power_amp_ 6100_40465300 A
productivity_total 6400_00260100
service_time 6400_00462E00 s
injection_time 6400_00462F00 s
ethernet_status 6180_084A9600 status
ethernet_counter_status 6180_084AAA00 status
wlan_strength 6100_004AB600
wlan_ip 6180_104AB700
wlan_netmask 6180_104AB800
wlan_gateway 6180_104AB900
wlan_dns 6180_104ABA00
wlan_status 6180_084ABC00 status
wlan_scan_status 6180_084ABB00
device_state 6180_084B1E00 W
device_warning 6100_00411F00 W
device_error 6100_00412000 W

sma-sunnyboy's People

Contributors

december-soul avatar dymerz avatar k-sartor avatar rickmeasham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sma-sunnyboy's Issues

SMA docs for this api?

Hi, I am trying to get this api to work. I know this was developed for SunnyBoy 5.0. My inverter is SunnyBoy 7.0

Do you have a url to the SMA docs for this api? I have googled and can't find them anywhere.

My issue is when I call client.auth, the response I'm getting is:
{"result":{"sid":null}}

If I can look at the SMA docs, maybe I can figure out why.

Thanks, Matt.

serial-Id in API

Hi.
You did a nice work, but Why did you hardcode your serial-number into the api ?
'0156-76BD14A8' will only work with your device.

the last part stands for the serialnumber as hex encoded value, but I am not sure what the first value stands for.

pip install on raspberry fails

Hallo, i tried to do "pip install SMA-SunnyBoy" on a raspberry pi 3 and failed
on my windows pc it works like a charm but on my raspberry i get the following
`pi@NAS:~/script $ pip install SMA-SunnyBoy

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting SMA-SunnyBoy
Could not find a version that satisfies the requirement SMA-SunnyBoy (from versions: )
No matching distribution found for SMA-SunnyBoy
`
any ideas

best regards frits

[BUG] Insequre HTTPS reques warning, and not working connection

Describe the bug
The function client.auth() produces errors/warnings in an infinite loop. No connection to Inverter prossible.

To Reproduce
Code causing the bug:

from sma_sunnyboy import *
client = WebConnect("192.168.188.47", Right.USER, "password")
client.auth()

Error Message:

  warnings.warn(
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:999: InsecureRequestWarning: Unverified HTTPS request is being made to host '192.168.188.47'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  1. See error

Expected behavior

authentificate and continue with python script reading values etc...

Actual behavior

Script procudes 10 times this warning and then hangs.

Hardware (please complete the following information):

  • Device type: [Sunny Boy 5.0]
  • Software package: ?
    Additional context
    I am new to this, maybe I have got it wrong.

SUNNY TRIPOWER 8.0 not connect

Hello
I have SMA SUNNY TRIPOWER 8.0 and trying to use your library to connect to my inverter ... unfortunately it doesn't connect. Permission denied message.
I have SSL conection. I connect via WLAN (not LAN) Firmware is: 3.00.05.R

Request about logger

Hi, do you know how to interpret value received from getLogger?
I'd like to draw production chart but values received from getLogger have to be manipulated before drawing.
Do you know how?
Thank you

Current consumption

Using the SMA web interface you are able to see "current consumption", but I can't find that key in this class... I need some help with this

Binary log parsing

The 5-minute logs are available at /dyn/genericLog.bin, however they're returned as binary data and script.xxxx.js decodes them and pushes them to the user as CSV.

This ticket isn't a bug report as these logs aren't yet implemented in the library. Instead it's a Feature ticket in case @Dymerz or anyone else has already done some work on rewriting the binary interpreter so we don't double up.

SMA extra key readout

Hello

is there a way to implement also the total power day : key = 6400_00262200.
Is it possible to import this lib to an esp32 running on micropython?

Kurt

[BUG] Unable to login-Resolved

While trying to run getValue.py, after setting address and password, I get repeated:
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:1015: InsecureRequestWarning: Unverified HTTPS request is being made to host '192.168.1.158'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
warnings.warn(

I added:
from urllib3.exceptions import InsecureRequestWarning
from urllib3 import disable_warnings
disable_warnings(InsecureRequestWarning)

This suppresses the warning but it seems to hang. Control C shows:
File "getkwh.py", line 16, in
client.auth()
File "/home/frankbanul/.local/lib/python3.9/site-packages/sma_sunnyboy/sma.py", line 101, in auth
time.sleep(5)
KeyboardInterrupt

To Reproduce
python3 getkwh.py

Expected behavior
Total and current power would be printed

Actual behavior
No output

Hardware (please complete the following information):

  • Device type: SUNNY BOY 5.0-US
  • Software package: Firmware version: 3.2.16.R

Additional context
Debian 11.4, Linux 5.10.0-17-amd64 #1 SMP Debian 5.10.136-1 (2022-08-13) x86_64 GNU/Linux

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.