krahabb / meross_lan

Home Assistant integration for Meross devices
MIT License
415 stars 45 forks source link

Power consumption polling frequency #20

Closed override80 closed 3 years ago

override80 commented 3 years ago

Hi @krahabb,

thanks for providing this, I actually used to manually create sensors/switches with mqtt templates after adding plugs (mss310). Do you believe it would be possible to make state/consumption polling more frequent? I'd like to track power usage every 10-15 seconds?

krahabb commented 3 years ago

Hello @override80, yes that is an option I would like to add even if I'm scared people could 'abuse' it a bit ;) In the meantime if you like to get dirty in python code you could just edit

The first is the interval between energy readings (Wh) and the second is the general interval between polling cycles. Power reading is done at every poll cycle. So you could just set: PARAM_UPDATE_POLLING_PERIOD = 10

I'm not aware of any possible side effects at the moment (maybe the disconnection-status-availability logic could be impacted but not sure) I'm going to restart development in the coming week when new hardware arrives so, to have the polling period available as an option in the UI expect around 2 weeks or so

Thank You!

override80 commented 3 years ago

Hi @krahabb, Thanks for the details, I changed the value you pointed out, it is working perfectly :) FWIW I have been running mqtt sensors on these plugs for months (by publishing a message with mqtt.publish every 15 seconds on the namespace "Appliance.Control.Electricity") and had no issues so far.

Bye!