uvejota / edistribucion

Home Assistant custom integration for e-distribución
GNU General Public License v3.0
20 stars 6 forks source link

Option to define SCAN_INTERVAL #8

Closed msanchezt closed 3 years ago

msanchezt commented 3 years ago

Would be nice being able to define SCAN_INTERVAL.

I've currently modified it to SCAN_INTERVAL=1 minute, so I'm able to get more real time info and trigger some almost real time alerts when my Carga actual % goes over 100% for example (I have the 15 minutes delay where I'm allowed to be over 100%).

Not sure how to add this option for the end user, though.

uvejota commented 3 years ago

I believe that the sensor platform allows a scan interval definition at the yml file by default.

Let me check, if not, I can add this option easily :-)

Thank you for your feedback

uvejota commented 3 years ago

I've just tested that you can define a scan interval by adding the option:

scan_interval: seconds

Thank you for the feedback :-)

msanchezt commented 3 years ago

Thanks for the reply. Not sure where I'm supposed to add this.

I have 3 sensors:

All them comes from: custom_components/edistribucion/sensor.py, so I don't really have anything on my sensors.yaml file where I can add "scan_interval: seconds".

msanchezt commented 3 years ago

Tried adding the following line in customize.yaml config file:

sensor.eds_consumo_electrico: scan_interval: 60

The new value shows up but does not seem to be doing any effect:

image

uvejota commented 3 years ago

Tried adding the following line in customize.yaml config file:

sensor.eds_consumo_electrico: scan_interval: 60

The new value shows up but does not seem to be doing any effect:

image

Hello, sorry for explaining myself so bad, you have to add this in the configuration.yaml file, just like:

sensor:
  - platform: edistribucion
    username: 000000000A # username (e.g., dni)
    password: mySecurePassword # password
    scan_interval: 60

or as this, if you are defining your sensors in a different file (sensors.yaml):

############# Edistribucion
- platform: edistribucion
  username: !secret edistribucion_user
  password: !secret edistribucion_password
  scan_interval: 60

But be careful, I tested it for around 12-15 minutes and had some issues when fetching data, maybe I got a temporal ban.

uvejota commented 3 years ago

I am reopening this issue until we are sure this is working.

Please, notice I have had to "copy" the repository to a new one (just in case you want to watch/star the new one) :-)

uvejota commented 3 years ago

Solved https://github.com/uvejota/edistribucion/issues/6#issuecomment-850883310