k20human / domoticz-linky

Get Linky datas from Enedis website and add to Domoticz
MIT License
3 stars 2 forks source link

TypeError: 'NoneType' object has no attribute '__getitem__' #1

Closed droop91 closed 6 years ago

droop91 commented 6 years ago

Hello,

The script crash on my Pi

pi@raspi1 ~/LINKY/LINKY2/domoticz-linky $ python execute.py 2017-10-09 10:44:30,393 :: INFO :: Logging in as XXXXXXXXXX@YYYY.COM 2017-10-09 10:44:30,402 :: INFO :: Logged in successfully! 2017-10-09 10:44:30,406 :: INFO :: Retreiving data... 2017-10-09 10:44:30,561 :: INFO :: Starting new HTTPS connection (1): espace-client-connexion.enedis.fr 2017-10-09 10:44:31,868 :: INFO :: Starting new HTTPS connection (1): espace-client-particuliers.enedis.fr 2017-10-09 10:44:33,809 :: INFO :: Starting new HTTPS connection (1): espace-client-particuliers.enedis.fr 2017-10-09 10:44:34,681 :: INFO :: Cookie has expired 2017-10-09 10:44:34,706 :: INFO :: Starting new HTTPS connection (1): espace-client-connexion.enedis.fr 2017-10-09 10:44:35,449 :: INFO :: Starting new HTTPS connection (1): espace-client-particuliers.enedis.fr 2017-10-09 10:44:37,066 :: INFO :: Starting new HTTPS connection (1): espace-client-particuliers.enedis.fr 2017-10-09 10:44:37,889 :: INFO :: Got datas! Traceback (most recent call last): File "execute.py", line 145, in main() File "execute.py", line 138, in main export_days_values(res_day) File "execute.py", line 72, in export_days_values value = res['graphe']['data'][-1]['valeur'] TypeError: 'NoneType' object has no attribute 'getitem'

k20human commented 6 years ago

Hi,

Enedis seems to have change their API ... Please try the fix i commit and let me know. For information i don't use anymore this script

droop91 commented 6 years ago

Thanks to take time on it if you don't user it anymore. I have a new error :

2017-10-09 17:02:01,626 :: INFO :: Logged in successfully! 2017-10-09 17:02:01,656 :: INFO :: Retreiving data... 2017-10-09 17:02:02,337 :: INFO :: Starting new HTTPS connection (1): espace-client-particuliers.enedis.fr 2017-10-09 17:02:04,376 :: INFO :: Got datas! 2017-10-09 17:02:04,431 :: INFO :: Starting new HTTP connection (1): localhost Traceback (most recent call last): File "execute.py", line 145, in main() File "execute.py", line 138, in main export_days_values(res_day) File "execute.py", line 80, in export_days_values 'rid': domoticzIdx TypeError: 'dict' object is not callable

k20human commented 6 years ago

Can you show me your config.json file (without password :)) ?

droop91 commented 6 years ago

Yes.

{ "login": "XXXXXX@gmail.com", "password": "YYYYYYYY", "domoticz_server": "localhost:8080", "domoticz_idx": "2383" }

k20human commented 6 years ago

Do you use Python 3 ?

droop91 commented 6 years ago

Yes i have python3.2.3. I have also tried with python2.7.3 but there is other errors.

k20human commented 6 years ago

Can you add this line at line 85 and telle me the result in the log ?

logger.info("Logging in as %s", enedisLogin)

droop91 commented 6 years ago

Hello,

I have made some small modifications and it works.

reponse=urllib.urlopen("http://" + domoticzServer +

"/json.htm?type=devices&rid=" + domoticzIdx) js_read = reponse.read() logger.info(js_read) counter = json.loads(js_read)

# Get value from Domoticz

counter = domoticzApi.call({

'type': 'devices',

'rid': domoticzIdx

}).json()

Thanks

On Sat, Oct 14, 2017 at 5:47 PM, Kévin Mathieu notifications@github.com wrote:

Can you add this line at line 85 and telle me the result in the log ?

logger.info("Logging in as %s", enedisLogin)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/k20human/domoticz-linky/issues/1#issuecomment-336643672, or mute the thread https://github.com/notifications/unsubscribe-auth/AfH2Rme829gnAcC8ppKXRP4IQj6qXs58ks5ssNecgaJpZM4PyLfy .

k20human commented 6 years ago

Nice :)