-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LocalSmappee restart error 404 #9
Comments
If I understand right this is about accessing the smappee gateway directly in the local network, right? |
I can confirm the error with $ python3
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 26 2016, 10:47:25)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from smappy import LocalSmappee
>>> ls = LocalSmappee(ip='192.168.178.36')
>>> ls.logon(password='XXX‘)
{'success': 'Logon successful!', 'header': 'Logon to the monitor portal successful...'}
>>> ls.report_instantaneous_values()
{'report': 'Instantaneous values:<BR>voltage=229.7 Vrms<BR>FFTComponents:<BR>Phase 1:<BR>\tcurrent=0.355 A, activePower=30.738 W, reactivePower=75.645 var, apparentPower=81.652 VA, cosfi=36, quadrant=0, phaseshift=0.0, phaseDiff=0.0<BR>\tFFTComponents:<BR>Phase 2:<BR>\tcurrent=0.988 A, activePower=172.133 W, reactivePower=148.239 var, apparentPower=227.167 VA, cosfi=75, quadrant=0, phaseshift=0.0, phaseDiff=0.0<BR>\tFFTComponents:<BR>Phase 3:<BR>\tcurrent=0.178 A, activePower=36.222 W, reactivePower=19.399 var, apparentPower=41.09 VA, cosfi=87, quadrant=0, phaseshift=0.0, phaseDiff=0.0<BR>\tFFTComponents:<BR><BR>Load[555075] state[0] power: 0.0 on Sun Oct 23 07:37:08 GMT 2016<BR>Load[545894] state[0] power: 0.0 on Fri Oct 21 09:42:00 GMT 2016<BR>Load[553872] state[0] power: 0.0 on Sun Oct 23 07:37:08 GMT 2016<BR>Load[657445] state[0] power: 0.0 on Sun Oct 23 07:37:08 GMT 2016<BR>Load[707410] state[0] power: 0.0 on Fri Oct 21 11:12:13 GMT 2016<BR>Load[545897] state[0] power: 0.0 on Sun Oct 23 14:51:38 GMT 2016<BR>Load[581323] state[0] power: 0.0 on Fri Oct 21 09:35:19 GMT 2016<BR>Load[579206] state[0] power: 0.0 on Thu Oct 20 17:35:18 GMT 2016<BR>Load[545893] state[0] power: 0.0 on Fri Oct 21 09:41:13 GMT 2016<BR>Load[608840] state[0] power: 0.0 on Sun Oct 23 07:37:08 GMT 2016<BR>Load[645565] state[0] power: 0.0 on Sun Oct 23 13:32:13 GMT 2016<BR>Load[588906] state[0] power: 0.0 on Sun Oct 23 11:41:23 GMT 2016<BR>Load[562900] state[0] power: 0.0 on Sun Oct 23 13:32:13 GMT 2016<BR>Load[551500] state[0] power: 0.0 on Sun Oct 23 07:37:08 GMT 2016<BR>Load[561431] state[0] power: 0.0 on Sat Oct 22 21:15:18 GMT 2016<BR>Load[553875] state[0] power: 0.0 on Sat Oct 22 09:40:54 GMT 2016<BR>Load[556393] state[0] power: 0.0 on Sat Oct 15 19:34:35 GMT 2016<BR>Load[545896] state[0] power: 0.0 on Sun Oct 23 15:41:16 GMT 2016<BR>Load[648471] state[0] power: 0.0 on Sun Oct 23 11:30:39 GMT 2016<BR>Load[570223] state[0] power: 0.0 on Sun Oct 09 12:49:28 GMT 2016<BR>Load[618144] state[0] power: 0.0 on Sun Oct 23 10:52:55 GMT 2016<BR>Load[628724] state[0] power: 0.0 on Sun Oct 23 07:37:08 GMT 2016<BR>Load[549199] state[0] power: 0.0 on Sun Oct 23 11:26:09 GMT 2016<BR>Load[553874] state[0] power: 0.0 on Sun Oct 23 07:37:08 GMT 2016<BR>Load[545895] state[0] power: 0.0 on Fri Oct 21 12:24:18 GMT 2016<BR>Load[704509] state[1] power: 55.0 on Sun Oct 23 15:37:01 GMT 2016<BR>Load[549200] state[0] power: 0.0 on Fri Oct 21 13:42:35 GMT 2016<BR>Load[556394] state[0] power: 0.0 on Fri Oct 21 18:55:07 GMT 2016<BR>Load[653335] state[0] power: 0.0 on Fri Sep 30 13:02:00 GMT 2016<BR>Load[551498] state[0] power: 0.0 on Fri Oct 21 09:36:06 GMT 2016<BR>Load[594652] state[0] power: 0.0 on Sun Oct 16 11:39:16 GMT 2016<BR>Load[553873] state[0] power: 0.0 on Fri Oct 21 09:05:21 GMT 2016<BR>Load[547700] state[0] power: 0.0 on Sun Oct 23 13:32:13 GMT 2016<BR>Load[581324] state[0] power: 0.0 on Sun Oct 23 07:37:08 GMT 2016<BR>Load[574732] state[0] power: 0.0 on Sun Oct 23 09:39:01 GMT 2016<BR>Load[550464] state[0] power: 0.0 on Fri Oct 21 19:29:24 GMT 2016<BR>Load[550466] state[0] power: 0.0 on Fri Oct 21 19:44:25 GMT 2016<BR>Load[547694] state[0] power: 0.0 on Sat Oct 22 16:10:33 GMT 2016<BR>Load[589961] state[0] power: 0.0 on Sun Oct 23 10:28:54 GMT 2016<BR>Load[547699] state[0] power: 0.0 on Sun Oct 23 11:24:42 GMT 2016<BR>Load[550465] state[0] power: 0.0 on Sun Oct 23 07:37:08 GMT 2016<BR>Load[557781] state[0] power: 0.0 on Thu Oct 20 11:15:42 GMT 2016<BR>Load[547698] state[0] power: 0.0 on Sun Oct 09 15:29:55 GMT 2016<BR>Load[550463] state[0] power: 0.0 on Sun Oct 23 07:37:08 GMT 2016<BR>Load[592660] state[0] power: 0.0 on Sun Oct 23 13:50:59 GMT 2016<BR>Load[614615] state[0] power: 0.0 on Sat Oct 22 20:17:50 GMT 2016<BR>Load[551501] state[0] power: 0.0 on Sat Oct 22 03:25:31 GMT 2016<BR>Load[740748] state[0] power: 0.0 on Sun Oct 23 13:51:45 GMT 2016<BR>Load[733827] state[0] power: 0.0 on Sun Oct 23 15:34:26 GMT 2016<BR>Load[579205] state[0] power: 0.0 on Mon Oct 17 10:04:15 GMT 2016<BR>Load[679987] state[0] power: 0.0 on Sun Oct 23 08:37:44 GMT 2016<BR>Load[754521] state[0] power: 0.0 on Sun Oct 23 07:37:08 GMT 2016<BR>Load[727850] state[0] power: 0.0 on Sat Oct 15 16:15:05 GMT 2016<BR>Load[547697] state[0] power: 0.0 on Sun Oct 23 13:32:13 GMT 2016<BR>Load[568665] state[0] power: 0.0 on Sun Oct 23 10:56:33 GMT 2016<BR>Load[551499] state[0] power: 0.0 on Sun Oct 23 07:37:08 GMT 2016<BR>Load[551502] state[0] power: 0.0 on Sun Oct 23 11:55:23 GMT 2016<BR>Load[547696] state[0] power: 0.0 on Sun Oct 23 10:56:53 GMT 2016<BR>Load[547695] state[0] power: 0.0 on Sun Oct 23 15:36:20 GMT 2016<BR>Load[627020] state[0] power: 0.0 on Fri Oct 21 11:50:03 GMT 2016<BR><BR>Phase 1, peak active power 5323.626 W at 22/04/2016 09:38:00<BR>Phase 2, peak active power 6459.089 W at 01/04/2016 12:23:35<BR>Phase 3, peak active power 4628.469 W at 14/05/2016 17:33:00<BR>active energy RMS per phase mapping combination<BR>phase mapping 210=1085.04 kWh [ 1/1]<BR>phase mapping 12=1213.511 kWh [ -1/1]<BR>phase mapping 21=2600.062 kWh [* 1/3]<BR>phase mapping 102=1736.609 kWh [ 1/0]<BR>phase mapping 120=937.823 kWh [ 1/1]<BR>phase mapping 201=987.557 kWh [ 1/2]<BR><BR>active energy RMS (solar) per phase mapping combination<BR>phase mapping 210=0.0 kWh [ 1/1]<BR>phase mapping 12=0.0 kWh [ -1/1]<BR>phase mapping 21=0.0 kWh [* 1/3]<BR>phase mapping 102=0.0 kWh [ 1/0]<BR>phase mapping 120=0.0 kWh [ 1/1]<BR>phase mapping 201=0.0 kWh [ 1/2]<BR><BR>'}
>>> ls.load_instantaneous()
[{'value': '1', 'key': 'meterReaderRestart'}, {'value': '30998', 'key': 'phase0ActivePower'}, {'value': '36', 'key': 'phase0Cosfi'}, {'value': '0', 'key': 'phase0Quadrant'}, {'value': '168871', 'key': 'phase1ActivePower'}, {'value': '74', 'key': 'phase1Cosfi'}, {'value': '0', 'key': 'phase1Quadrant'}, {'value': '36234', 'key': 'phase2ActivePower'}, {'value': '87', 'key': 'phase2Cosfi'}, {'value': '0', 'key': 'phase2Quadrant'}, {'value': '2', 'key': 'autoCommissioningCandidate'}, {'value': '0', 'key': 'autoCommissioningRunning'}, {'value': '1', 'key': 'autoCommissioningValidation'}, {'value': '0', 'key': 'voltageReversed'}]
**>>> ls.restart()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/smappy/smappy.py", line 496, in restart
r.raise_for_status()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/models.py", line 862, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://192.168.178.36/gateway/apipublic/restartEMeter**
>>> |
Here is another code sample for this aborting with a similar error message: >>> import json, requests, shed
>>> smappeeIP = '192.168.178.36'
>>> smappeePwd = 'XX'
>>> headers = {'Content-Type': 'application/json;charset=UTF-8'}
>>> payload = smappeePwd
>>> r = requests.post('http://'+smappeeIP+'/gateway/apipublic/logon', data = payload, headers=headers)
>>> print(r.content)
b'{"success":"Logon successful!","header":"Logon to the monitor portal successful..."}'
>>> payload = "loadInstantaneous"
>>> r = requests.post('http://'+smappeeIP+'/gateway/apipublic/instantaneous', headers=headers, data=payload )
>>> print(r.content)
b'[{"value":"1","key":"meterReaderRestart"},{"value":"33517","key":"phase0ActivePower"},{"value":"38","key":"phase0Cosfi"},{"value":"0","key":"phase0Quadrant"},{"value":"183537","key":"phase1ActivePower"},{"value":"76","key":"phase1Cosfi"},{"value":"0","key":"phase1Quadrant"},{"value":"35764","key":"phase2ActivePower"},{"value":"87","key":"phase2Cosfi"},{"value":"0","key":"phase2Quadrant"},{"value":"2","key":"autoCommissioningCandidate"},{"value":"0","key":"autoCommissioningRunning"},{"value":"1","key":"autoCommissioningValidation"},{"value":"0","key":"voltageReversed"}]'
>>> r = requests.post('http://'+smappeeIP+'/gateway/apipublic/restartEMeter', headers=headers)
>>> print(r.content)
b'{"errorMessage":"The server has not found anything matching the request URI"}' |
We are missing another parameter. I copied the following API from here:
Now I played too much with the API. My smappee crashed... Needs manual reboot ;-) |
My smappee is up again. Here I downloaded the
The restart button is working fine! |
strange... still an error message >>> r = requests.post('http://'+smappeeIP+'/gateway/apipublic/restartEMeter?action=2', headers=headers)
>>> print(r.content)
b'{"errorMessage":"The server has not found anything matching the request URI"}' |
I don't know if it changes anything, but would you try specifying the extra parameter separately? import requests
url = 'http://'+smappeeIP+'/gateway/apipublic/restartEMeter'
headers = {'Content-Type': 'application/json;charset=UTF-8'}
payload = {'action': 2}
r = requests.get(url, params=payload, headers=headers)
print(r.status_code, r.content) Maybe leave out the headers and see what that gives. As for the other requests: might be nice to include them in the code too. Would you mind opening a new issue for this? It seems as though each button has a JavaScript function attached to it, see |
still does not work: >>> import requests
>>> headers = {'Content-Type': 'application/json;charset=UTF-8'}
>>> payload = {'action': 2}
>>> url = 'http://192.168.178.36/gateway/apipublic/restartEMeter'
>>> r = requests.get(url, params=payload, headers=headers)
>>> print(r.status_code, r.content)
404 b'{"errorMessage":"The server has not found anything matching the request URI"}' we are somehow missing this part: data: '',
dataType: 'son', what do you think? |
Error 404 indicates that something is wrong with the URL we are using. If it had something to do with the headers or the payload we would be getting different errors... The ajax call is |
I found the baseURL in #16, it seems to be the one we've been using. I'll first add all those new requests, we'll see if any more errors pop up |
I checked. The var baseURL = "/gateway/apipublic";
|
@stefferber I noticed that the restart function in the javascript code uses a get method, while we were using a post. I fixed it in f80b59c, maybe try it again? |
hello @JrtPec - the local smappee restart function works fine now |
Great, thanks! |
The method
LocalSmappee.restart()
has been reported to raise 404-errors. There is probably something wrong with the URL:http://<ip address>/gateway/apipublic/restartEMeter
.I'm looking for someone to verify the bug, and perhaps provide me with the answer. I have no documentation, all methods were inspired by issue #7.
The text was updated successfully, but these errors were encountered: