Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating log statement to sync relay no. with server side numbering. #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def request() -> None:
key = f"a_bool_epower_{i}"
value = getRelay(i)
post_fields[key] = str(value)
logging.info(f"set relay {i} to {value}")
logging.info(f"set relay {i+1} to {value}")

# add temperatures to request
for i, sensor_id in enumerate(config["temperature_sensors"]):
Expand All @@ -128,7 +128,7 @@ def request() -> None:
temperature = -42
value = temperature
post_fields[key] = str(value)
logging.info(f"set tempsensor {i} with id {sensor_id} to {temperature}")
logging.info(f"set tempsensor {i+1} with id {sensor_id} to {temperature}")

response = requests.get(url, params=post_fields)

Expand All @@ -148,11 +148,11 @@ def request() -> None:
if relay_key in json_response:
# relay_key is e.g. "epower_0_state"
new_relay_state = int(json_response[relay_key])
logging.info(f"received new target state {new_relay_state} for {relay_key}")
logging.info(f"received new target state {new_relay_state} for relay {i+1}")
setRelay(i, new_relay_state)
else:
logging.warning(
f"relay key {relay_key} for relay idx={i} was expected but not in response. "
f"relay key {relay_key} for relay {i+1} was expected but not in response. "
"This is normal before activation."
)
setRelay(i, 0)
Expand Down