From 75867bbfa8d4281d7faa98047492095b5f3b964b Mon Sep 17 00:00:00 2001 From: Sean Holtshousen Date: Wed, 11 Nov 2020 22:19:14 +0000 Subject: [PATCH 1/4] Adding implementation project and printing all devices --- .vs/evohome-client/v15/.suo | Bin 0 -> 45056 bytes evohome-client.pyproj | 47 +++++++++++++++++++++++++++++++ evohome-client.sln | 27 ++++++++++++++++++ evohome_client_implementation.py | 7 +++++ 4 files changed, 81 insertions(+) create mode 100644 .vs/evohome-client/v15/.suo create mode 100644 evohome-client.pyproj create mode 100644 evohome-client.sln create mode 100644 evohome_client_implementation.py diff --git a/.vs/evohome-client/v15/.suo b/.vs/evohome-client/v15/.suo new file mode 100644 index 0000000000000000000000000000000000000000..56e8066ab1052d40b4d544b501f13d2bfc702343 GIT binary patch literal 45056 zcmeHQdu$xXd0$GhCCiHKShkZUvO>v<^)T;p?}uJCc@NRHWIaedQd6alcT4HSBagX< zBub?0C~e)QjuQkZ5*VqGCQ9nsMQZ1dCIRfmHj379+{!In14&yn0aE1ApheLFt&7I$ z@3*^i++E)7gFNy`>E`g=?9R^4H}lQRH{WA+_pK}M|Ir`5_@N(5rm$ODF1>g4Ch109 zdWY^4sXL-)VE# z_!Daf&wcxyj=P!fJ~i_JU@S_fr3Zn17)L4ToJ}dl%XeV}>d9@qTL0|#kc{E01c9G; z$E5;lP?BUoA83&Q$XdQe(I#nGhgqVRZ zBmsN0G?vA-KZx^(0Hm3|d_7$b;aVTyR={Dv5kL<>pMS9)FXa3`vH3gycNX(snffi9 z|G$mCY2y4h^fQXK4IJYaxo{%1V*YbXi}^3cng}WFTtENW-iMK{pX1EG7ipa1`?Y%xAYLl-T(s95e-drD1o#wy?bU-h zZ!6CK81;G%@Vr*PR@C8I#@Pdjrznj`qmXt=h@Hwk=nf^UgZ$BfBkBUAlbUM%&-Io( zhM^yL%fP!AvQ8P2P@i;4k-;ibR*{U#YPN>|lz*1ts_3JJ8Fd%9#;?-Oj{s}GLW6=d zg!mk4K>6XWsV{>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756fe} + + evohomeclient2\module1.py + + . + . + {888888a0-9f3d-457c-b088-3a5042f75d52} + Standard Python launcher + + + + + + 10.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/evohome-client.sln b/evohome-client.sln new file mode 100644 index 0000000..8588c0c --- /dev/null +++ b/evohome-client.sln @@ -0,0 +1,27 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27428.2015 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "evohome-client", "evohome-client.pyproj", "{9C55B0D5-8C60-445F-8E2D-FA7F652756FE}" +EndProject +Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "evohome-client-implementation", "..\evohome-client-implementation\evohome-client-implementation.pyproj", "{E403C845-8122-4415-8ABD-CCE816286913}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9C55B0D5-8C60-445F-8E2D-FA7F652756FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9C55B0D5-8C60-445F-8E2D-FA7F652756FE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E403C845-8122-4415-8ABD-CCE816286913}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E403C845-8122-4415-8ABD-CCE816286913}.Release|Any CPU.ActiveCfg = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {91C12F89-56E9-4574-9B07-0E6DDAB3B7B3} + EndGlobalSection +EndGlobal diff --git a/evohome_client_implementation.py b/evohome_client_implementation.py new file mode 100644 index 0000000..1836385 --- /dev/null +++ b/evohome_client_implementation.py @@ -0,0 +1,7 @@ +from evohomeclient2 import EvohomeClient + +# Add username and password here +#client = EvohomeClient('username', 'password', debug=True) + +for device in client.temperatures(): + print(device) \ No newline at end of file From 539c8e82624260982fe342ada6480bce093e8bf4 Mon Sep 17 00:00:00 2001 From: Sean Holtshousen Date: Fri, 13 Nov 2020 12:34:09 +0000 Subject: [PATCH 2/4] adding datetimestamp and moving things to a config --- .vs/evohome-client/v15/.suo | Bin 45056 -> 43520 bytes evohome_client_implementation.py | 43 ++++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/.vs/evohome-client/v15/.suo b/.vs/evohome-client/v15/.suo index 56e8066ab1052d40b4d544b501f13d2bfc702343..2969e0510564f08d19133d72f5ecd6a33ab15416 100644 GIT binary patch delta 4849 zcmc(jdsLI>9mn4%B!OUnKrjT9Bw$;)h$I2RMJGX`ASeVcRX3`rpwa^YAvjTM(&^5& z>bT_RHZQm$u5LPOv1zwzSIg9OYu75S*1Au4?LUf`@Bg6fgQA`J$*T! z_qn{!<@fw*XVrj5vXBK+fgK`oG z1qu)W;z1<9WARd=4sirCos!0oRbgdesHs^tzteS{wj$p@+KRFOM1evu9|Tq@LcJI) z03~1%SO~ZjWhm`{kF7viij%%Pd`$Po^7zv@W+EP0E#fh+iO1xU`i}Vn)c7%jI> z+Xzg8pb;`q;hSZm%mQ=35{RZ}Hr!)m^Uy9wZF=Nl)c8n#Sx~>zS>g4BDoGh0{n)qA zehTacd%(9r8)yd|;5)zr2nYJ+Ke#2M54G&;<^G?}Mj7H%02zu4hm?3VsMq zfMeh|_%YzCJ&W=r;EvP_PJ!ov7rX#o1U~^k1uucq;0$;f{0zJX_&Tqm>;pgdx6h-z zAP9?vU-&zIiSk$A4S)OBDBlEcfs5c0=m(dZ7^pWt|v2M1%1ziq@-?JjVFc zhf&hrnR_Wof6ZeoW{>c(@{=QUsQL^)-zV`e0^CMGiz zl43krb3!~tGi2w`eO2tv5WD+gq%s7iFj*AhENZV&g}Rh3s7ok3E=w+Ef@%CAGf+!h zxlDl}@xHy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PTvR5E4UvPcP+r}oMwnGtB^4Y)fr;< zGBjfcce$OXARR|mK>%10lCRq;8~}o1!QE{WMO`A!*Ny8YsU5USi?KPbGsA=VU9m6M z=RDHm8FV|`LnF1i3Y|Z${vSLnzxZd0YpbaUUTjK&`LSd=EihWagV~*MJv&zTilVWj zaK1?n6Jv>Rc~}7tniX)#Rw}*sPZaB+i$!o@NC9SdGQ6&i6guEI5jYM-ODFuixebkS zXdKH2bIV?+Z1r5Ok^q~`fcIOoV6x>c_-pG4l-LWlzd^2TC;Z*s37z|j!Q9pfz3ob0 zhfHe1gT+7JHX-qutvnrI(IRteE(;5FnLvq5k1h2HqPxgJL3d3s4Lr;i1TDHr`2kOh zCEb<7iJaGhgo_^i;)GY!n`-@W>Ickk-v1hd#tswI^zVMBaXAb9zy41ozgvUjoLNPic+-T zXU41AU4tI?fNOZyxbwKH-!l%lMxQb!0>?E;aF$t zce!8caXUu^(+zAj&W}0Wo)Mw`A=Y0$7FbK!$jOmW*HK)OMO&#hsw-<%R%5L}r8Cu8 zRK_|>9X^a!y}@9psI1YP88=k)9Z?%AD^-V&=qs>QrC!ymMG~~V8cmW!zmHQ>4D{~~Dq z|4)&Ln-vM(o@!|J9gJ8{YD{#nhTax6w9&BE9yLU67DP%{S1Sc8C-fXc?{{^FL?GAbg{)cBzy*pL@B&_@gbr^ZR diff --git a/evohome_client_implementation.py b/evohome_client_implementation.py index 1836385..125e3fe 100644 --- a/evohome_client_implementation.py +++ b/evohome_client_implementation.py @@ -1,7 +1,42 @@ -from evohomeclient2 import EvohomeClient +from evohomeclient2 import EvohomeClient; +import pyodbc; +from datetime import datetime; +import configparser; -# Add username and password here -#client = EvohomeClient('username', 'password', debug=True) +config = configparser.ConfigParser() + +config.read("config.ini") + +databasename = config.get('DB', 'dbname'); +server = config.get('DB', 'dbserver'); +driver = config.get('DB', 'dbdriver'); + +username = config.get('evohome', 'username'); +password = config.get('evohome', 'password'); + +CONNECTION_STRING = 'DRIVER=' + driver + '; SERVER=' + server + '; DATABASE=' + databasename + '; Trusted_Connection=yes'; +connection = pyodbc.connect(CONNECTION_STRING); + +client = EvohomeClient(username, password, debug=True) + +def insert_zones(thermostat, id, name, temp, setpoint): + cursor = connection.cursor(); + sSQL = ''' + INSERT INTO + dbo.Zones (uid, timestamp, thermostat, id, [name], temp, setpoint) + VALUES (NEWID(), CURRENT_TIMESTAMP, \'''' + thermostat + '''\', \'''' + id + '''\', \'''' + name + '''\', \'''' + str(temp) + '''\', \'''' + str(setpoint) + '''\') + ''' + + print(sSQL); + + cursor.execute(sSQL); + + print('id: ' + id + ' inserted') + + cursor.commit(); for device in client.temperatures(): - print(device) \ No newline at end of file + print(device) + insert_zones(thermostat=device['thermostat'], id=device['id'], name=device['name'], temp=device['temp'], setpoint=device['setpoint']) + +connection.close(); \ No newline at end of file From 8db3538c5e2b7b61b6367992b7ee2afc7fc72ef7 Mon Sep 17 00:00:00 2001 From: Sean Holtshousen Date: Fri, 13 Nov 2020 15:44:41 +0000 Subject: [PATCH 3/4] adding unending loop --- .vs/evohome-client/v15/.suo | Bin 43520 -> 40960 bytes evohome_client_implementation.py | 32 +++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/.vs/evohome-client/v15/.suo b/.vs/evohome-client/v15/.suo index 2969e0510564f08d19133d72f5ecd6a33ab15416..17eeef54ee26f6992befb7f16b5111ef8f9daca2 100644 GIT binary patch delta 1890 zcmb_ceN0iy{?5)TPO&~N6YsZV8=%hSi>W$hbyBG_K3o!ZH(3aK`8#{9!T_H6#`zi(5VSwO#ZN9e;R}-#ho5 zcfQZP*S*ZUz5Iw7Ms}$UI*wCu9LFQ>`2Bt)905~C)P*(;uRXKv(9)IJ8zh#Ai@?RZ z$O3FAkMpk*a4B5mG;Am`+tCH5M1&*Ih5tUJ(Fo@6exwly4I&YtN2n1|2rYu?8<55! z;t>f!Sw7Or;Qr3&?mCzkatx6{ffZ?0a1SccsINn&F(_ajlUW6$Z68T|x7Mh%UYNrg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%m&dQ2E>9m5D(^n1ds$?0K%ITkjmIhHW!MxFAXvsybKCpS~y>TK2Wm|V-vI(-<8mu zmQ7?pAMeUnY#t?PJ<#`pec)a29@r0h!2xg(2sfreogN>@UBbdJxD2jOpI1|jM~Y4yIfA1{!LiA|m~uaz@pyCL^W1#{ zhrb2ift%nK_#XTKoOZPcyG}Ul`ov+^akBW{HHb`!jEM}1h=&4^X_2+5VGz2=o{*E- zqaMFBA2A`aA>@mYbj#1676T>J|Bhq}G4nLV5^`1IGwAWGIhwQB@+GAfETQozgH3DZ zI#jFwM{zOXOL{M=jnXjpEMYps*El+sVFyb zyD&x>UAEL+3X>=&E1s)pd6t$RC1cbsRSC*#GH#oofeop2ur^3p{MG|ba`R{2HB}WG&52dD^)(eRlu^T4gIm!h5k3sc z*C)|diw9X-V}stUX)`0qXLk|Z z@5#Y}cweFknM@7o{?w|Eb?l4H3KFlt(bVKSdk$uOXed2^bhCpTdaHg0@>jTcs>2gBMeIZ8mKy4VL1ICRLhNo$Dx<8MM0k&LMdlCwp}UMc0^=p&EnAwo^u> zoD-JBOFnezZ5O)Mtn)q0oMB_ma-saFmqevde^e0JTV-0=hI)va>B^V}#`V$V?mD`^ zM-NNA=tB2t-iw(I8jha+?8?b=7j;w4%&dx1+X|Ic9mgg3CM)uuKe%t;zEX;1bAMj5 ztl?hQNx!oUUo?Mub#FX<5u+t-_uBp*{eSI}ciTzsmHXeZBSyWlZyno+Er&oDW% r_o>s3tOAd>ksa(@SGeAObJ2+Ym)}18>fx^_ZxhJ{2-&}IFg@Zg#OL}G diff --git a/evohome_client_implementation.py b/evohome_client_implementation.py index 125e3fe..8485bf5 100644 --- a/evohome_client_implementation.py +++ b/evohome_client_implementation.py @@ -1,6 +1,7 @@ from evohomeclient2 import EvohomeClient; import pyodbc; from datetime import datetime; +import time; import configparser; config = configparser.ConfigParser() @@ -15,9 +16,6 @@ password = config.get('evohome', 'password'); CONNECTION_STRING = 'DRIVER=' + driver + '; SERVER=' + server + '; DATABASE=' + databasename + '; Trusted_Connection=yes'; -connection = pyodbc.connect(CONNECTION_STRING); - -client = EvohomeClient(username, password, debug=True) def insert_zones(thermostat, id, name, temp, setpoint): cursor = connection.cursor(); @@ -26,17 +24,31 @@ def insert_zones(thermostat, id, name, temp, setpoint): dbo.Zones (uid, timestamp, thermostat, id, [name], temp, setpoint) VALUES (NEWID(), CURRENT_TIMESTAMP, \'''' + thermostat + '''\', \'''' + id + '''\', \'''' + name + '''\', \'''' + str(temp) + '''\', \'''' + str(setpoint) + '''\') ''' - - print(sSQL); - + cursor.execute(sSQL); print('id: ' + id + ' inserted') cursor.commit(); -for device in client.temperatures(): - print(device) - insert_zones(thermostat=device['thermostat'], id=device['id'], name=device['name'], temp=device['temp'], setpoint=device['setpoint']) +# Infinite loop every 5 minutes, send temperatures to sql +while True: + connection = pyodbc.connect(CONNECTION_STRING); + + try: + client = EvohomeClient(username, password, debug=True) + except ValueError: + try: + client = EvohomeClient(username, password, debug=True) + except ValueError: + print("Error when connecting to internet, please try again") + + + for device in client.temperatures(): + print(device) + insert_zones(thermostat=device['thermostat'], id=device['id'], name=device['name'], temp=device['temp'], setpoint=device['setpoint']) + + connection.close(); -connection.close(); \ No newline at end of file + print ("Going to sleep for 5 minutes") + time.sleep(300) \ No newline at end of file From 4e3222e7b9cbebb0e547d1bec9b689f48f2afac8 Mon Sep 17 00:00:00 2001 From: Sean Holtshousen Date: Tue, 17 Nov 2020 10:22:47 +0000 Subject: [PATCH 4/4] working with unending loop. needed to add a retry with delay when the api returned too many tries error --- .vs/evohome-client/v15/.suo | Bin 40960 -> 47616 bytes evohome_client_implementation.py | 21 +++++++++------------ evohomeclient2/__init__.py | 11 ++++------- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/.vs/evohome-client/v15/.suo b/.vs/evohome-client/v15/.suo index 17eeef54ee26f6992befb7f16b5111ef8f9daca2..99c9cc372ac115e657a2255bf36634c5050c912b 100644 GIT binary patch delta 2248 zcmchXVN6?96oB7-yh01b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