made 'ended 14 minutes ago' units dynamic

This commit is contained in:
Ben Varick 2023-11-21 08:25:42 -06:00
parent b2c25dbc39
commit b525de95d3
Signed by: ben
SSH key fingerprint: SHA256:jWnpFDAcacYM5aPFpYRqlsamlDyKNpSj3jj+k4ojtUo
3 changed files with 31 additions and 13 deletions

View file

@ -1,9 +1,3 @@
View(values %>%
filter(entity_id %in% sensors) %>%
filter(time > time_start,
time < time_end))
values %>%
filter(entity_id %in% sensors) %>%
filter(time > time_start,
time < time_end) %>%
group_by(time_rounded, entity_id) %>%
@ -444,7 +438,7 @@ token = token,
org = org)
update_interval <- 5
cronjob_interval <- 60
power_threshhold <- 5
power_threshhold <- 10
# ---- set variables
entities <- data.frame(name = c("washing machine", "dryer"), entity_id = c("washing_machine_power", "dryer_power"))
update_data <- function(){
@ -505,7 +499,13 @@ render("laundry_status.Rmd",
output_dir = "html",
output_file = "index.html")
}
for(i in 1:(cronjob_interval/update_interval)){
# for(i in 1:(cronjob_interval/update_interval)){
# message(Sys.time())
# update_data()
# Sys.sleep(60*update_interval)
# }
continue <- TRUE
while(continue){
message(Sys.time())
update_data()
Sys.sleep(60*update_interval)