Skip to content

Commit

Permalink
Merge pull request #83 from cdesouza71/master
Browse files Browse the repository at this point in the history
Fix station triggering and sensor deletion
  • Loading branch information
cdesouza71 authored May 18, 2024
2 parents 81314fd + 5f664d5 commit 0b481bd
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions moisture_sensor_control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ following values:

## Version information

- v0.0.4
- Fix issue with too many stations being triggered
- v0.0.3
- Fix renamed sensor not being saved
- v0.0.2
Expand Down
4 changes: 4 additions & 0 deletions moisture_sensor_control/moisture_sensor_control-docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ <h2>For developers</h2>
<h2>Version information</h2>

<ul>
<li>v0.0.4
<ul>
<li>Fix issue with too many stations being triggered</li>
</ul></li>
<li>v0.0.3
<ul>
<li>Fix renamed sensor not being saved</li>
Expand Down
7 changes: 6 additions & 1 deletion moisture_sensor_control/moisture_sensor_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def trigger_run_once(sensor, value):

settings = moisture_sensor_settings["settings"]

sensor_key = f"sensor{station_index}"
mins_key = f"i_mins{station_index}"
secs_key = f"i_secs{station_index}"
enable_key = f"i_enable{station_index}"
Expand All @@ -74,7 +75,11 @@ def trigger_run_once(sensor, value):

# If no threshold has been configured for the station or the
# sensor has not been enabled take not action
if (threshold_key not in settings) or (enable_key not in settings):
if (
(sensor_key not in settings)
or (settings[sensor_key] != sensor)
or (enable_key not in settings)
):
continue

threshold, mins, secs, pause = validate_int(
Expand Down
2 changes: 2 additions & 0 deletions moisture_sensor_data_mqtt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ week.

## Version information

- v0.0.6
- Fix issue with deleting sensors with current reading
- v0.0.5
- Fix issue with processing reading with float timestamp
- v0.0.4
Expand Down
4 changes: 4 additions & 0 deletions moisture_sensor_data_mqtt/moisture_sensor_data_mqtt-docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ <h2>Retention period</h2>
<h2>Version information</h2>

<ul>
<li>v0.0.6
<ul>
<li>Fix issue with deleting sensors with current reading</li>
</ul></li>
<li>v0.0.5
<ul>
<li>Fix issue with processing reading with float timestamp</li>
Expand Down
1 change: 1 addition & 0 deletions moisture_sensor_data_mqtt/moisture_sensor_data_mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ def GET(self):
# Case: Delete sensor
stop_mqtt_reader(old_sensor)
msd_signal.send("delete", data={"sensor": f"{old_sensor}"})
last_reading.pop(old_sensor, None)
if os.path.isfile(old_file):
# missing_ok=True
os.remove(old_file)
Expand Down

0 comments on commit 0b481bd

Please sign in to comment.