changed entity names
This commit is contained in:
parent
9be78242b7
commit
dd81a4bb5c
@ -446,10 +446,10 @@ update_interval <- 5
|
|||||||
cronjob_interval <- 60
|
cronjob_interval <- 60
|
||||||
power_threshhold <- 5
|
power_threshhold <- 5
|
||||||
# ---- set variables
|
# ---- set variables
|
||||||
entities <- data.frame(name = c("washing machine", "dryer"), entity_id = c("lamp_a_power", "lamp_b_power"))
|
entities <- data.frame(name = c("washing machine", "dryer"), entity_id = c("washing_machine_power", "dryer_power"))
|
||||||
update_data <- function(){
|
update_data <- function(){
|
||||||
run_time <- Sys.time()
|
run_time <- Sys.time()
|
||||||
values <- home_assistant$query('from(bucket: "home_assistant") |> range(start: -7d) |> filter(fn: (r) => r["entity_id"] == "lamp_b_power" or r["entity_id"] == "lamp_a_power") |> filter(fn: (r) => r["_field"] == "value") |> filter(fn: (r) => r["_measurement"] == "W")',
|
values <- home_assistant$query('from(bucket: "home_assistant") |> range(start: -7d) |> filter(fn: (r) => r["entity_id"] == "washing_machine_power" or r["entity_id"] == "dryer_power") |> filter(fn: (r) => r["_field"] == "value") |> filter(fn: (r) => r["_measurement"] == "W")',
|
||||||
POSIXctCol = NULL)
|
POSIXctCol = NULL)
|
||||||
values <- bind_rows(values)
|
values <- bind_rows(values)
|
||||||
values <- values %>%
|
values <- values %>%
|
||||||
|
@ -10,21 +10,21 @@ updated: `r format(Sys.time(), format = "%A %I:%M %p", tz = "America/Chicago")`
|
|||||||
|
|
||||||
this site updates every `r update_interval` minutes
|
this site updates every `r update_interval` minutes
|
||||||
|
|
||||||
## The washing machine is currently: `r current_status[["lamp_a_power"]]`
|
## The washing machine is currently: `r current_status[["washing_machine_power"]]`
|
||||||
|
|
||||||
|
|
||||||
The washer `r ifelse(current_status$lamp_a_power=="on", "started", "ended")` its most recent cycle at `r ifelse(current_status$lamp_a_power=="on", strftime(washer_last_off, format = "%A %I:%M %p", tz = "America/Chicago"), strftime(washer_last_on, format = "%A %I:%M %p", tz = "America/Chicago"))`
|
The washer `r ifelse(current_status$washing_machine_power=="on", "started", "ended")` its most recent cycle at `r ifelse(current_status$washing_machine_power=="on", strftime(washer_last_off, format = "%A %I:%M %p", tz = "America/Chicago"), strftime(washer_last_on, format = "%A %I:%M %p", tz = "America/Chicago"))`
|
||||||
:
|
:
|
||||||
`r ifelse(current_status$lamp_a_power=="on", round(difftime(Sys.time(), washer_last_off, unit = "mins"),0), round(difftime(Sys.time(), washer_last_on, units = "mins"),0))`
|
`r ifelse(current_status$washing_machine_power=="on", round(difftime(Sys.time(), washer_last_off, unit = "mins"),0), round(difftime(Sys.time(), washer_last_on, units = "mins"),0))`
|
||||||
minutes ago
|
minutes ago
|
||||||
|
|
||||||
|
|
||||||
## The dryer is currently: `r current_status[["lamp_b_power"]]`
|
## The dryer is currently: `r current_status[["dryer_power"]]`
|
||||||
|
|
||||||
|
|
||||||
The dryer `r ifelse(current_status$lamp_b_power=="on", "started", "ended")` its most recent cycle at `r ifelse(current_status$lamp_b_power=="on", strftime(dryer_last_off, format = "%A %I:%M %p", tz = "America/Chicago"), strftime(dryer_last_on, format = "%A %I:%M %p", tz = "America/Chicago"))`
|
The dryer `r ifelse(current_status$dryer_power=="on", "started", "ended")` its most recent cycle at `r ifelse(current_status$dryer_power=="on", strftime(dryer_last_off, format = "%A %I:%M %p", tz = "America/Chicago"), strftime(dryer_last_on, format = "%A %I:%M %p", tz = "America/Chicago"))`
|
||||||
:
|
:
|
||||||
`r ifelse(current_status$lamp_b_power=="on", round(difftime(Sys.time(), dryer_last_off, unit = "mins"),0), round(difftime(Sys.time(), dryer_last_on, units = "mins"),0))`
|
`r ifelse(current_status$dryer_power=="on", round(difftime(Sys.time(), dryer_last_off, unit = "mins"),0), round(difftime(Sys.time(), dryer_last_on, units = "mins"),0))`
|
||||||
minutes ago
|
minutes ago
|
||||||
|
|
||||||
---
|
---
|
||||||
|
Loading…
x
Reference in New Issue
Block a user