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

add Automation time tracking #190

Merged
merged 16 commits into from
Oct 16, 2024
Merged

add Automation time tracking #190

merged 16 commits into from
Oct 16, 2024

Conversation

Johannes-Thiel
Copy link
Contributor

There is a Timetracker. But it seams to be used for Time on a specific field.
I made a tracker to track all the time in automations. This Tacker works for all weeding implements and the Recorder. It can be seen in the status drawer.
image

@Johannes-Thiel Johannes-Thiel added this to the 0.4.0 milestone Oct 7, 2024
@Johannes-Thiel
Copy link
Contributor Author

At the moment the time is in seconds, we should talk about the correct format of the data.

@Johannes-Thiel
Copy link
Contributor Author

The tracking was moved to the base implement. The unnecessary Kpis were removed and are no longer shown in the UI.
The working Hours can be seen in the Status drawer on the right side of the UI.

@Johannes-Thiel Johannes-Thiel marked this pull request as ready for review October 9, 2024 11:05
Copy link
Contributor

@pascalzauberzeug pascalzauberzeug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should talk about what we really want to track. Going by these changes the time when changing rows won't be tracked because the implements are deactivated during that.

Comment on lines 63 to 66
self.start_time = rosys.time()
self.start_time = rosys.time()
self.start_time = rosys.time()
self.start_time = rosys.time()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.start_time = rosys.time()
self.start_time = rosys.time()
self.start_time = rosys.time()
self.start_time = rosys.time()
self.start_time = rosys.time()

What happened here? 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I Have no idea 😄

@Johannes-Thiel
Copy link
Contributor Author

maybe we could put this tracking into the navigation?

Comment on lines 79 to 96
def increment_all_time_kpi(self, indicator: str) -> None:
self.increment(indicator)
if getattr(self.all_time_kpis, indicator) is None:
new_value = 1
else:
new_value = getattr(self.all_time_kpis, indicator)+1
setattr(self.all_time_kpis, indicator, new_value)
self.invalidate()
return

def get_time_kpi(self) -> str:
total_seconds = self.all_time_kpis.time
hours = total_seconds // 3600
minutes = (total_seconds % 3600) // 60
seconds = total_seconds % 60
return f'{hours:02}:{minutes:02}:{seconds:02}'

def increment_weeding_kpi(self, indicator: str) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather increment by a given value because the passed time is not always exactly 1 second.

Comment on lines 11 to 13
def __init__(self, name: str, system:'System') -> None:
self.name = name
self.system = system
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed

Comment on lines 24 to 30

async def prepare(self) -> bool:
return True

async def finish(self) -> None:
await super().finish()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed anymore

@@ -49,6 +49,8 @@ def __init__(self, plant_provider: PlantProvider) -> None:
self.WEEDING_KPIS_UPDATED = rosys.event.Event()
"""one of the KPIs of the running weeding automation has been updated."""

self.all_time_kpis: KPIs = KPIs()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other KPIs can be deleted due to their inactivity.

@LukasBaecker LukasBaecker merged commit 60784e3 into main Oct 16, 2024
1 check passed
@LukasBaecker LukasBaecker deleted the Automation-time branch October 16, 2024 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants