sasu-drooz / Domoticz-AwoxSMP

Domoticz Awox Smartplug plugin
1 stars 0 forks source link

Always Retrieving SmartPlug Consumption #1

Open Clem- opened 6 years ago

Clem- commented 6 years ago

First: great work!!! Thank you so much for the script.

I have a question thought. Why does the script always try to get the smart plug consumption even if the SmartPlug Conso device is not used?

It would be great to only get this data from the smartplug if this devise is used. It would avoid a lot of logging and useless communication with the smartplug.

Thanks!

zaraki673 commented 6 years ago

Hi !!

yes you right, I didn't think about it, will update this :D

;)

2018-02-12 6:45 GMT+01:00 Clément E. notifications@github.com:

First: great work!!! Thank you so much for the script.

I have a question thought. Why does the script always try to get the smart plug consumption even if the SmartPlug Conso device is not used?

It would be great to only get this data from the smartplug if this devise is used. It would avoid a lot of logging and useless communication with the smartplug.

Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sasu-drooz/Domoticz-AwoxSMP/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AHGF7HxYUn_jXtnxuYahlfFNfSYoHxlhks5tT9AQgaJpZM4SBuKx .

zaraki673 commented 6 years ago

in fact, if i want to do this, I will need to re write Smartplug python librairie :(

when i ask if it on or off, I ask in the same time for its consumption

Clem- commented 6 years ago

Back to this question...

If only the first device (Command) is used, we can simply add if (not Devices[2].Used): return False at the beginning of onHeartbeat callback.

In that way, only users using the 2nd device (Consumption) have both status and consumption fetched every 20 sec.