Skip to content

Commit

Permalink
switch the scale
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanSST committed Aug 1, 2023
1 parent ed9a262 commit 7dcd498
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This code will run on a Raspberry PI in a chicken barn. There are scales under t

### Epic v1: Chicken scale recognizes weight change and sends message about state (which chicken, an egg) via Whatsapp

* Story: env values via applicatoin.yaml
* Story: get current weight and calculate the "state" (chicken, egg)

* Story: using Lombok to log
Expand Down
1 change: 1 addition & 0 deletions raspi/docker-chicken-farm.service
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ExecStartPre=-/usr/bin/docker rm chicken-farm
ExecStartPre=-/usr/bin/docker pull stephanst/chicken-farm:latest
ExecStart=/usr/bin/docker run -d --restart unless-stopped \
-p 8080:8080 --network="host" \
--env THREEMA_FROM=xxxxx --env THREEMA_TO=xxxxx --env THREEMA_SECRET=xxxxx \
--name chicken-farm stephanst/chicken-farm:latest
ExecStop=/usr/bin/docker stop chicken-farm
TimeoutSec=300
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/ch/stephan/chickenfarm/timer/ScaleObserver.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.slf4j.LoggerFactory;
import org.slf4j.helpers.MessageFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import ch.stephan.chickenfarm.messenger.MessengerService;
Expand All @@ -25,9 +26,9 @@ public class ScaleObserver {
@Autowired
private MessengerService whatsappService;

// @Scheduled(fixedRate = 5000)
@Scheduled(fixedRate = 10000)
public void measureWeights() {
String uid = "ZUw";
String uid = "23yp";
int weight = scaleService.measureWeight(uid);

if (weight > 1000) { // chicken in the box
Expand Down

0 comments on commit 7dcd498

Please sign in to comment.