Skip to content

Commit

Permalink
office monitor day and night scenes
Browse files Browse the repository at this point in the history
  • Loading branch information
danwetherald committed Dec 10, 2020
1 parent 0b9cd04 commit c6535a2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 34 deletions.
6 changes: 3 additions & 3 deletions hammerspoon/brightness.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ appWatcher = nil
function appChanged(appName, eventType, appObject)
hour = tonumber(os.date("%H"))

if hour > 18 or hour < 7 then
if hour > 21 or hour < 7 then
if (eventType == hs.application.watcher.activated) then
if (appName == "kitty") then
-- hs.brightness.set(30)
hs.brightness.set(30)
else
-- hs.brightness.set(1)
hs.brightness.set(1)
end
end
end
Expand Down
12 changes: 8 additions & 4 deletions hammerspoon/monitors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ local headers = {
["Content-Type"] = "application/json"
}

local payload = [[ {"entity_id":"scene.officenightwork"} ]]
local day_payload = [[ {"entity_id":"scene.officedaywork"} ]]
local night_payload = [[ {"entity_id":"scene.officenightwork"} ]]

screenWatcher = nil

Expand All @@ -18,9 +19,12 @@ function screenChanged(watcher)

-- Checkout that its night
hour = tonumber(os.date("%H"))
if hour >= 18 or hour < 7 then
-- Turn on Home Assistant Scene
hs.http.post(path, payload, headers)

-- Turn on Home Assistant Scene
if hour >= 16 or hour < 7 then
hs.http.post(path, night_payload, headers)
else
hs.http.post(path, day_payload, headers)
end
end
end
Expand Down
27 changes: 0 additions & 27 deletions hammerspoon/status.lua

This file was deleted.

0 comments on commit c6535a2

Please sign in to comment.