From 80ba59cdb2939d53033f0ef5b2aa68f822f685b0 Mon Sep 17 00:00:00 2001 From: Patrick McDonagh Date: Thu, 9 Feb 2017 18:32:43 -0600 Subject: [PATCH] V2 of driver with sleep function and larger deltas for data collection Trying to use less energy --- abbflow.py | 18 +- config.txt | 2 +- modbusMap.p | 846 ++++++++++++++++++++++++++-------------------------- 3 files changed, 430 insertions(+), 436 deletions(-) diff --git a/abbflow.py b/abbflow.py index b797358..efd91aa 100644 --- a/abbflow.py +++ b/abbflow.py @@ -2,23 +2,31 @@ import threading import time from device_base import deviceBase - +from datetime import datetime class start(threading.Thread, deviceBase): - def __init__(self, name=None, number=None, mac=None, Q=None, mcu=None, companyId=None, offset=None, mqtt=None, Nodes=None): + def __init__(self, name=None, number=None, mac=None, Q=None, mcu=None, + companyId=None, offset=None, mqtt=None, Nodes=None): threading.Thread.__init__(self) - deviceBase.__init__(self, name=name, number=number, mac=mac, Q=Q, mcu=mcu, companyId=companyId, offset=offset, mqtt=mqtt, Nodes=Nodes) + deviceBase.__init__(self, name=name, number=number, mac=mac, Q=Q, + mcu=mcu, companyId=companyId, offset=offset, + mqtt=mqtt, Nodes=Nodes) self.daemon = True self.version = "1" self.finished = threading.Event() threading.Thread.start(self) + self.sleep_minutes = 25 - # this is a required function for all drivers, its goal is to upload some piece of data + # this is a required function for all drivers + # its goal is to upload some piece of data # about your device so it can be seen on the web def register(self): self.channels["status"]["last_value"] = "" def run(self): - pass + while (true): + t = datetime.now() + if (t.minute == 5 or t.minute == 35): + self.mcu.sleep(self.sleep_minutes * 60) diff --git a/config.txt b/config.txt index e7d0fff..24ae8ca 100644 --- a/config.txt +++ b/config.txt @@ -3,7 +3,7 @@ "driverFileName":"abbflow.py", "deviceName":"abbflow", "driverId":"0110", -"releaseVersion":"1", +"releaseVersion":"2", "files": { "file1":"abbflow.py", "file2":"modbusMap.p" } diff --git a/modbusMap.p b/modbusMap.p index aeeecaa..5ce54df 100644 --- a/modbusMap.p +++ b/modbusMap.p @@ -46,14 +46,14 @@ V3600 p24 sVla p25 -F243.523 +F51.145000000000006 sVchn p26 Vvolume_flow p27 -sVun +sVr p28 -V1 +V0-5000 p29 sVdn p30 @@ -61,49 +61,49 @@ Vabbflow p31 sVda p32 -g29 -sVlrt +V1 p33 -F1481742563.7065589 -sVa +sVlrt p34 -V4003 +F1486686157.69757 +sVa p35 -sVc +V4003 p36 -V5 +sVc p37 -sVmisc_u +V20.0 p38 -VMCF/Day +sVmisc_u p39 -sVf +VMCF/Day p40 -V4 +sVf p41 -sVmrt +V4 p42 -V60 +sVmrt p43 -sVm +V60 p44 -Vnone +sVm p45 -sVm1ch +Vnone p46 +sVm1ch +p47 g11 sVmv -p47 -V0 p48 -sVs +V0 p49 -VOn +sVs p50 -sVr +VOn p51 -V0-5000 +sVun p52 +g33 sVt p53 Vfloat @@ -120,7 +120,7 @@ sVbytary p59 NsVal p60 -g14 +g49 sVvn p61 VToday Volume @@ -139,55 +139,55 @@ V3600 p68 sVla p69 -F53.55 +F11.007999999999999 sVchn p70 Vtoday_volume p71 -sVun +sg28 +V0-1000 p72 -g29 -sVdn +sVun p73 -Vabbflow +g33 +sVdn p74 -sVda +Vabbflow p75 -g29 -sVlrt +sVda p76 -F1481742500.6362921 -sg34 -V4005 +g33 +sVlrt p77 -sg36 -V10 +F1486686158.4710568 +sg35 +V4005 p78 -sVmisc_u +sg37 +V10.0 p79 -VMCF +sVmisc_u p80 -sg40 -g41 -sVmrt +VMCF p81 -V60 +sg41 +g42 +sVmrt p82 -sg44 -Vnone +V60 p83 -sVm1ch +sg45 +Vnone p84 -g56 -sVmv +sVm1ch p85 -g48 -sg49 +g56 +sg50 VOn p86 -sg51 -V1-1000000 +sVmv p87 +g49 sg53 Vfloat p88 @@ -222,55 +222,55 @@ V3600 p102 sVla p103 -F13.805 +g14 sVchn p104 Vbattery_voltage p105 sVun p106 -g29 +g33 sVdn p107 Vabbflow p108 sVda p109 -g29 +g33 sVlrt p110 -F1481742567.338939 -sg51 -V0-50 -p111 -sg34 +F1481739138.1118399 +sg35 V4001 +p111 +sg37 +V5 p112 -sg36 -V0.1 -p113 sVmisc_u -p114 +p113 VV -p115 -sg40 -g41 +p114 +sg41 +g42 sVmrt -p116 +p115 V60 -p117 -sg44 +p116 +sg45 Vnone -p118 +p117 sVm1ch -p119 +p118 g90 -sg49 +sVmv +p119 +g49 +sg50 VOn p120 -sVmv +sg28 +V0-50 p121 -g48 sg53 Vfloat p122 @@ -286,7 +286,7 @@ sVbytary p127 NsVal p128 -g14 +g49 sVvn p129 VLast Calc. Period Volume @@ -305,41 +305,41 @@ V86400 p136 sVla p137 -F166.835 +F30.056 sVchn p138 Vlast_calculation_period_volume p139 -sVun +sg28 +V0-1000000 p140 -g29 sVdn p141 Vabbflow p142 sVda p143 -g29 +g33 sVlrt p144 -F1481742504.3396151 -sg34 +F1486686019.8056409 +sg35 V4011 p145 -sg36 +sg37 V10 p146 sVmisc_u p147 VSCF p148 -sg40 -g41 +sg41 +g42 sVmrt p149 V60 p150 -sg44 +sg45 Vnone p151 sVm1ch @@ -347,13 +347,13 @@ p152 g124 sVmv p153 -g48 -sg49 +g49 +sg50 VOn p154 -sg51 -V0-1000000 +sVun p155 +g33 sg53 Vfloat p156 @@ -369,7 +369,7 @@ sVbytary p161 NsVal p162 -g14 +g49 sVvn p163 VDifferential Pressure @@ -388,510 +388,496 @@ V3600 p170 sVla p171 -F9.759 +F0.0 sVchn p172 Vdifferential_pressure p173 -sVun +sg28 +V0-500 p174 -g29 -sVdn +sVun p175 -Vabbflow +g33 +sVdn p176 -sVda +Vabbflow p177 -g29 -sVlrt +sVda p178 -F1481742570.8669549 -sg34 -V4013 +g33 +sVlrt p179 -sg36 -V0.5 +F1486684603.377617 +sg35 +V4013 p180 +sg37 +g112 sVmisc_u p181 VInH20 p182 -sg40 -g41 +sg41 +g42 sVmrt p183 V60 p184 -sg44 +sg45 Vnone p185 sVm1ch p186 g158 -sVmv -p187 -g48 -sg49 +sg50 VOn +p187 +sVmv p188 -sg51 -V0-500 -p189 +g49 sg53 Vfloat -p190 +p189 sVvm -p191 +p190 NssV2-4 -p192 -(dp193 +p191 +(dp192 Vah -p194 +p193 g14 sVbytary -p195 +p194 NsVal -p196 -g14 +p195 +g49 sVvn -p197 +p196 VYesterday Volume -p198 +p197 sVct -p199 +p198 Vnumber -p200 +p199 sVle -p201 +p200 V32 -p202 +p201 sVgrp -p203 +p202 V86400 -p204 +p203 sVla -p205 -F170.599 +p204 +F0.152 sVchn -p206 +p205 Vyesterday_volume +p206 +sg28 +V0-1000 p207 sVun p208 -g29 +g33 sVdn p209 Vabbflow p210 sVda p211 -g29 +g33 sVlrt p212 -F1481742508.0071199 -sg34 +F1486680992.5114951 +sg35 V4007 p213 -sg36 -V10 +sg37 +V10.0 p214 sVmisc_u p215 VMCF p216 -sg40 -g41 +sg41 +g42 sVmrt p217 V60 p218 -sg44 +sg45 Vnone p219 sVm1ch p220 -g192 -sVmv +g191 +sg50 +VOn p221 -g48 -sg49 -VOn +sVmv p222 -sg51 -V0-1000000 +g49 +sg53 +Vfloat p223 -sg53 -Vfloat +sVvm p224 -sVvm -p225 NssV2-5 -p226 -(dp227 +p225 +(dp226 Vah +p227 +g14 +sVbytary p228 -g14 -sVbytary +NsVal p229 -NsVal +g49 +sVvn p230 -g14 -sVvn -p231 VAccumulated Volume +p231 +sVct p232 -sVct +Vnumber p233 -Vnumber +sVle p234 -sVle +V32 p235 -V32 +sVgrp p236 -sVgrp +V3600 p237 -V3600 +sVla p238 -sVla +F11.028 +sVchn p239 -F688121.375 -sVchn -p240 Vaccumulated_volume -p241 -sVun -p242 -g29 -sVdn -p243 -Vabbflow -p244 -sVda -p245 -g29 -sVlrt -p246 -F1481742509.916935 -sg34 -V4009 -p247 -sg36 -V10 -p248 -sVmisc_u -p249 -VMCF -p250 -sg40 -g41 -sVmrt -p251 -V60 -p252 -sg44 -Vnone -p253 -sVm1ch -p254 -g226 -sVmv -p255 -g48 -sg49 -VOn -p256 -sg51 +p240 +sg28 V0-1000000 +p241 +sVdn +p242 +Vabbflow +p243 +sVda +p244 +g33 +sVlrt +p245 +F1486684604.89034 +sg35 +V4009 +p246 +sg37 +V10 +p247 +sVmisc_u +p248 +VMCF +p249 +sg41 +g42 +sVmrt +p250 +V60 +p251 +sg45 +Vnone +p252 +sVm1ch +p253 +g225 +sVmv +p254 +g49 +sg50 +VOn +p255 +sVun +p256 +g33 +sg53 +Vfloat p257 -sg53 -Vfloat +sVvm p258 -sVvm -p259 NssV2-8 -p260 -(dp261 +p259 +(dp260 Vah +p261 +g14 +sVbytary p262 -g14 -sVbytary +NsVal p263 -NsVal +g49 +sVvn p264 -g14 -sVvn -p265 VStatic Pressure -p266 +p265 sVct -p267 +p266 Vnumber -p268 +p267 sVle -p269 +p268 V32 -p270 +p269 sVgrp -p271 +p270 V3600 -p272 +p271 sVla -p273 -F27.351 +p272 +F33.138 sVchn -p274 +p273 Vstatic_pressure -p275 -sg51 -V0-250 -p276 +p274 sVun -p277 -g29 +p275 +g33 sVdn -p278 +p276 Vabbflow -p279 +p277 sVda -p280 -g29 +p278 +g33 sVlrt -p281 -F1481742576.4637631 -sg34 +p279 +F1486684605.811446 +sg28 +V0-250 +p280 +sg35 V4015 -p282 -sg36 -V0.5 -p283 +p281 +sg37 +g112 sVmisc_u -p284 +p282 VPSIA -p285 -sg40 -g41 +p283 +sg41 +g42 sVmrt -p286 +p284 V60 -p287 -sg44 +p285 +sg45 Vnone -p288 +p286 sVm1ch -p289 -g260 -sg49 +p287 +g259 +sg50 VOn -p290 +p288 sVmv -p291 -g48 +p289 +g49 sg53 Vfloat -p292 +p290 sVvm -p293 +p291 NssV2-9 -p294 -(dp295 +p292 +(dp293 Vah -p296 +p294 g14 sVbytary -p297 +p295 NsVal +p296 +g49 +sVvn +p297 +VTemperature p298 +sVct +p299 +Vnumber +p300 +sVle +p301 +V32 +p302 +sVgrp +p303 +V3600 +p304 +sVla +p305 +F76.523 +sVchn +p306 +Vtemperature +p307 +sVun +p308 +g33 +sVdn +p309 +Vabbflow +p310 +sVda +p311 +g33 +sVlrt +p312 +F1486684606.5676731 +sg28 +V0-300 +p313 +sg35 +V4017 +p314 +sg37 +g112 +sVmisc_u +p315 +Vdeg F +p316 +sg41 +g42 +sVmrt +p317 +V60 +p318 +sg45 +Vnone +p319 +sVm1ch +p320 +g292 +sg50 +VOn +p321 +sVmv +p322 +g49 +sg53 +Vfloat +p323 +sVvm +p324 +NssV2-10 +p325 +(dp326 +Vah +p327 +g14 +sVbytary +p328 +NsVal +p329 g14 sVvn -p299 -VTemperature -p300 +p330 +VCharger Voltage +p331 sVct -p301 +p332 Vnumber -p302 +p333 sVle -p303 +p334 V32 -p304 +p335 sVgrp -p305 +p336 V3600 -p306 +p337 sVla -p307 -F63.987 +p338 +g14 sVchn -p308 -Vtemperature -p309 -sg51 -V0-300 -p310 +p339 +Vcharger_voltage +p340 sVun -p311 -g29 +p341 +g33 sVdn -p312 +p342 Vabbflow -p313 +p343 sVda -p314 -g29 +p344 +g33 sVlrt -p315 -F1481742578.2815808 -sg34 -V4017 -p316 -sg36 -V0.5 -p317 +p345 +g49 +sg35 +V4019 +p346 +sg37 +g112 sVmisc_u -p318 -Vdeg F -p319 -sg40 -g41 +p347 +g114 +sg41 +g42 sVmrt -p320 +p348 V60 -p321 -sg44 +p349 +sg45 Vnone -p322 +p350 sVm1ch -p323 -g294 -sg49 -VOn -p324 +p351 +g325 sVmv -p325 -g48 +p352 +g49 +sg50 +VOn +p353 +sg28 +V0-50 +p354 sg53 Vfloat -p326 -sVvm -p327 -NssV2-10 -p328 -(dp329 -Val -p330 -g14 -sVah -p331 -g14 -sVbytary -p332 -NsVvm -p333 -NsVvn -p334 -VCharger Voltage -p335 -sVct -p336 -Vnumber -p337 -sVle -p338 -V32 -p339 -sVgrp -p340 -V3600 -p341 -sVla -p342 -NsVchn -p343 -Vcharger_voltage -p344 -sVun -p345 -V1 -p346 -sVdn -p347 -Vabbflow -p348 -sVda -p349 -g346 -sVlrt -p350 -V0 -p351 -sVr -p352 -V0-50 -p353 -sVa -p354 -V4019 p355 -sVc +sVvm p356 -V0.5 +NssssS'f' p357 -sVmisc_u -p358 -VV -p359 -sVf -p360 -V4 -p361 -sVmrt -p362 -V60 -p363 -sVm -p364 -Vnone -p365 -sS'm1ch' -p366 -g328 -sVs -p367 -VOn -p368 -sVmv -p369 -g351 -sVt -p370 -Vfloat -p371 -ssssS'f' -p372 VOff -p373 +p358 sS'p' -p374 +p359 g14 sS's' -p375 -g346 +p360 +g33 ssS'2' -p376 -(dp377 +p361 +(dp362 g3 VM1-232 -p378 +p363 sg5 V9600 -p379 +p364 sg7 -(dp380 -sg372 +(dp365 +sg357 VOff -p381 -sg374 +p366 +sg359 g14 -sg375 -g346 +sg360 +g33 ss. \ No newline at end of file