Skip to content

Commit

Permalink
Merge pull request #82 from cdesouza71/bugfixes-1
Browse files Browse the repository at this point in the history
Bugfixes 1
  • Loading branch information
cdesouza71 authored Apr 17, 2024
2 parents 3c32817 + 31253a9 commit 81314fd
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 4 deletions.
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.5
- Fix issue with processing reading with float timestamp
- v0.0.4
- Fix datetime serialization issue
- v0.0.3
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.5
<ul>
<li>Fix issue with processing reading with float timestamp</li>
</ul></li>
<li>v0.0.4
<ul>
<li>Fix datetime serialization issue</li>
Expand Down
7 changes: 4 additions & 3 deletions moisture_sensor_data_mqtt/moisture_sensor_data_mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def mqtt_reader(client, msg):
if driest is None or wettest is None:
return

ts_secs = gv.now
ts_secs = int(gv.now)
ts = datetime.datetime.fromtimestamp(ts_secs)
if interval is not None and sensor in last_reading:
if last_reading[sensor]["ts"] + datetime.timedelta(minutes=interval) > ts:
Expand Down Expand Up @@ -213,7 +213,8 @@ def truncate_data_files(neme, **kw):

for line in input:
fields = line.split(",")
if int(fields[0]) + retention > now:
# timestamp can be float or int
if int(float(fields[0])) + retention > now:
output.write(line)

try:
Expand All @@ -235,7 +236,7 @@ def load_moisture_data_mqtt_settings():
# If file does not exist return default value
settings = {
"sensors": {},
"last_truncate": gv.now,
"last_truncate": int(gv.now),
}


Expand Down
2 changes: 2 additions & 0 deletions monthly_adjust_per_station/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ The plugin does not currently respect the option "Ignore Plugin adjustments".

## Version information

- v0.0.3
- Fix UI hanging schedules issue
- v0.0.2
- Ignore RUN ONCE programs
- v0.0.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ <h2>Limitations</h2>
<h2>Version information</h2>

<ul>
<li>v0.0.3
<ul>
<li>Fix UI hanging schedules issue</li>
</ul></li>
<li>v0.0.2
<ul>
<li>Ignore RUN ONCE programs</li>
Expand Down
7 changes: 6 additions & 1 deletion monthly_adjust_per_station/monthly_adjust_per_station.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ def notify_station_scheduled(station, **kw):
station_settings["default"],
]
)
if default is None or default == 100:

if default is None:
return
else:
adjustment = default
Expand All @@ -104,6 +105,10 @@ def notify_station_scheduled(station, **kw):
duration = math.ceil(duration * adjustment / 100)
gv.rs[station_index][1] = gv.rs[station_index][0] + duration
gv.rs[station_index][2] = duration
if duration == 0:
gv.ps[station_index] = [0, 0]
else:
gv.ps[station_index][1] = duration


scheduled_signal = signal("station_scheduled")
Expand Down

0 comments on commit 81314fd

Please sign in to comment.