ashleypittman / mec Goto Github PK
View Code? Open in Web Editor NEWMyEnergi Client API and Management tools.
License: GNU General Public License v3.0
MyEnergi Client API and Management tools.
License: GNU General Public License v3.0
I just wanted to fetch data for last month and struggled to find, that he is just taking the first 2 days in the output.
python3 get_zappi_history.py --month=08 --show-month
Day 1
There are 0 records
Time Duration Imported Exported Generated Negative Generation Zappi diverted Zappi imported pect1 nect1 pect2 nect2 pect3 nect3
Totals 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh
Day 2
There are 0 records
Totals 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh
Time Duration Imported Exported Generated Negative Generation Zappi diverted Zappi imported pect1 nect1 pect2 nect2 pect3 nect3
Totals 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh
Totals 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh 0.000kWh
So i go with the arg day=31 to make clear i want all data, but that is going to an error
python3 get_zappi_history.py --month=08 --show-month --day=31
Traceback (most recent call last):
File "get_zappi_history.py", line 217, in
main()
File "get_zappi_history.py", line 108, in main
for dom in range(1, day.tm_mday + 1):
TypeError: can only concatenate str (not "int") to str
I could fix the issue by
elif show_month:
all_data = []
for dom in range(1, int(day.tm_mday) + 1):
This seems to work for everything but I have to say that I am a complete python noob.
Maybe it would be better to have --show-month
always checking the max day of the month argument and giving this value as the day argument.
Hi Ashley, sorry! found another issue has Nissan done something to their login, get these errors in the log.
2021-10-05 17:24:37,053 - 768 - pycarwings2.pycarwings2 - DEBUG - invoking carwings API: https://gdcportalgw.its-mo.com/api_v190426_NE/gdc/InitialApp_v2.php
2021-10-05 17:24:37,053 - 768 - pycarwings2.pycarwings2 - DEBUG - params: {
"RegionCode": "NE",
"custom_sessionid": "",
"initial_app_str": "9s5rfKVuMrT03RtzajWNcA",
"lg": "en-US"
}
2021-10-05 17:24:37,055 - 768 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): gdcportalgw.its-mo.com:443
2021-10-05 17:24:38,077 - 768 - urllib3.connectionpool - DEBUG - https://gdcportalgw.its-mo.com:443 "POST /api_v190426_NE/gdc/InitialApp_v2.php HTTP/1.1" 404 234
2021-10-05 17:24:38,080 - 768 - pycarwings2.pycarwings2 - DEBUG - Response HTTP Status Code: 404
2021-10-05 17:24:38,080 - 768 - pycarwings2.pycarwings2 - DEBUG - Response HTTP Response Body: b'\n\n<title>404 Not Found</title>\n\n
The requested URL /api_v190426_NE/gdc/InitialApp_v2.php was not found on this server.
\n\n'zp.py line 220 self.remaining_boost_time = self._glimpse(data, 'rbt')
if Eddi isnt boosting I dont get a value in rbt and thus get : Exception has occurred: KeyError 'rbt'
{'r1a': 0, 'r2a': 0, 'rbc': 0, 'tp1': 127, 'tp2': 127} When not boosting
{'r1a': 0, 'r2a': 0, 'rbc': 0, 'rbt': 1186, 'tp1': 127, 'tp2': 127} When boosting
Hi Ashley, are my two Harvis confusing your code? generation is not correct as the code does not add the two values for generation and AC battery. I have two solar arrays monitored by two Harvi.
Logs show this confusion, Harvi code below
2021-10-05 10:24:37,176 - 749 - myenergi - INFO - Extra data for zappi:{'pwm': 1000, 'zs': 1026, 'rdc': -4, 'rac': 4, 'rrac': -4, 'zsh': 4, 'zsl': 2}
2021-10-05 10:24:37,177 - 749 - myenergi - DEBUG - Data from <class 'mec.zp.Harvi'> is 1 second(s) old
2021-10-05 10:24:37,177 - 749 - myenergi - DEBUG - {'Generation': 324, 'AC Battery': 3177}
2021-10-05 10:24:37,177 - 749 - myenergi - DEBUG - Data from <class 'mec.zp.Harvi'> is 6 second(s) old
2021-10-05 10:24:37,178 - 749 - myenergi - DEBUG - {'Grid': 33, 'Generation': 439, 'AC Battery': 23}
2021-10-05 10:24:37,178 - 749 - myenergi - INFO - Discrepancy in Generation values: 766 439
2021-10-05 10:24:37,179 - 749 - myenergi - INFO - 54.32% difference
{'harvi': [{'dat': '05-10-2021',
'ect1p': 1,
'ect2p': 1,
'ect3p': 1,
'ectp1': 324,
'ectp2': 3177,
'ectt1': 'Generation',
'ectt2': 'AC Battery',
'ectt3': 'None',
'fwv': '',
'sno': 11147497,
'tim': '09:24:36'},
{'dat': '05-10-2021',
'ect1p': 1,
'ect2p': 1,
'ect3p': 1,
'ectp1': 33,
'ectp2': 439,
'ectp3': -23,
'ectt1': 'Grid',
'ectt2': 'Generation',
'ectt3': 'AC Battery',
'fwv': '',
'sno': 10327777,
'tim': '09:24:31'}]},
Hi, have just updated mine to the latest files but get no display and this error in the logs, I have reloaded older version and all is OK.
2022-05-16 14:16:34,639 - 728 - e-paper - DEBUG - ['Waiting for export Unknown', 'Generation 1.9 Export 1.1', 'Days import/export: 0.0 0.0', '']
2022-05-16 14:16:34,640 - 728 - run_zappi - ERROR - Exception
Traceback (most recent call last):
File "run_zappi.py", line 108, in main
run_loop(server_conn, sockets, session_engine, display)
File "run_zappi.py", line 538, in run_loop
loop_handler.loop(culm_values)
File "run_zappi.py", line 233, in loop
self._check_eddi_boost()
File "run_zappi.py", line 298, in _check_eddi_boost
eddi = self.server_conn.state.eddi_list()[0]
IndexError: list index out of range
This line:
https://github.com/ashleypittman/mec/blob/master/get_zappi_history.py#L185
...appears to be wrong. I'm interested to know where the 4
in this expression came from?
I plotted some of my data from both Octopus 30 min readings and the Zappi API data, turning their joules into average kW using the above approach and the more naive one of assuming average kW is just energy divided by time:
volts = zappi_data['v1'] / 10
joules = zappi_data['imp']
kw_1 = (joules / volts * 4) / 1000
kw_2 = (joules / 60) / 1000
kw_o = octopus_data['consumption'] *2
ax = gca()
kw_1.plot(ax=ax, label='kw_1')
kw_2.plot(ax=ax, label='kw_2')
kw_o.plot(ax=ax, label='kw_o')
ax.legend()
The plot shows the naive approach lines up with the data from Octopus:
I thought I'd chuck in issue in as I couldn't find a reason for the constant 4 so wanted to ask...
Bit of a strange one for you.
The set_boost_charge works appears to work fine, the API calls occur and the correct schedule appears in the MyEnergi app, but the schedule on the Zappi device itself does not match.
If you try an edit the slots in the app they all appear unset.
I thought it might be a problem with types but I set a slot on the app and the types are identical.
DEBUG slt <class 'int'>
DEBUG bsh <class 'int'>
DEBUG bsm <class 'int'>
DEBUG bdh <class 'int'>
DEBUG bdm <class 'int'>
DEBUG bdd <class 'str'>
I have raised a myenergi support ticket to try and get some insight.
My own api is moving into setting Zappi schedules shortly will see if I run into the same issue.
./set_boost_charge.py
Will aim to add 10.0kWh at 7.2kW by 8am
Zappi is currently in mode Fault/Startup. (it didn't like set_mode.sh, i manually changed it back to eco+ on zappi)
Setting boost times without car connected?
Start 02:30 End 03:00 (duration 00:30) days Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday
Start 04:30 End 05:30 (duration 01:00) days Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday
Estimaged charge cost 21.1 pence
Boost Slot 11+12 blank.
Other slots as follows:
{
'boost_days': 'Mon,Tue,Wed,Thu,Fri,Sat,Sun',
'boost_slot': 13,
'boost_start_hour': 4,
'boost_start_minute': 30,
'boot_duration_hours': 1,
'boot_durations_mins': 0
}
{
'boost_days': 'Mon,Tue,Wed,Thu,Fri,Sat,Sun',
'boost_slot': 14,
'boost_start_hour': 2,
'boost_start_minute': 30,
'boot_duration_hours': 0,
'boot_durations_mins': 30
}
With a recent firmware/app update it is now possible to set the zappi in 1/3/auto phase selection in ECO+ mode, would be nice when the API would support this
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.