Skip to content

Commit

Permalink
chore: Add commentary to the TIMINGS constants
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrapan committed Aug 16, 2024
1 parent ed1f652 commit a1fe849
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions custom_components/solarman/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,30 @@
DEFAULT_DIGITS = 6

AUTO_RECONNECT = True
ACTION_ATTEMPTS = 5
ACTION_ATTEMPTS_MAX = ACTION_ATTEMPTS * 6

# Data are requsted in most cases in different invervals:
# - from 5s for power sensors for example
# - to up to 5m or 10m for static valus like Serial Number, etc.
#
# Changing of this value does not affects the amount of stored data by HA in any way
# HA's Recorder is controlling that using its sampling rate (default is 5m)
# On the contrary changing this value can break:
# - Request scheduling according "update_interval" properties set in profiles
# - Inverter configuring flows
# - Behavior of integration services
#
TIMINGS_INTERVAL = 5
TIMINGS_UPDATE_INTERVAL = td(seconds = TIMINGS_INTERVAL)
TIMINGS_INTERVAL_SCALE = 1
TIMINGS_UPDATE_INTERVAL = td(seconds = TIMINGS_INTERVAL * TIMINGS_INTERVAL_SCALE)
TIMINGS_UPDATE_TIMEOUT = TIMINGS_INTERVAL * 6
TIMINGS_SOCKET_TIMEOUT = TIMINGS_INTERVAL * 4 - 1
TIMINGS_WAIT_SLEEP = 0.2
TIMINGS_WAIT_FOR_SLEEP = 1

# Constants also tied to TIMINGS_INTERVAL to ensure maximum synergy
ACTION_ATTEMPTS = 5
ACTION_ATTEMPTS_MAX = ACTION_ATTEMPTS * 6

ATTR_FRIENDLY_NAME = "friendly_name"

REQUEST_UPDATE_INTERVAL = "update_interval"
Expand Down

0 comments on commit a1fe849

Please sign in to comment.