Skip to content

Commit

Permalink
use template sensor for active video calls
Browse files Browse the repository at this point in the history
  • Loading branch information
joelhawksley committed Jan 14, 2025
1 parent ccd1ea8 commit 637315c
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 34 deletions.
8 changes: 0 additions & 8 deletions app/apis/home_assistant_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,6 @@ def low_batteries
out
end

def active_video_call?
entity = data.find { _1[:entity_id] == @config["home_assistant"]["audio_input_in_use"] }

return false unless entity.present?

entity[:state] == "on"
end

def online?
entity = data.find { _1[:entity_id] == @config["home_assistant"]["ping_sensor_entity_id"] }

Expand Down
1 change: 0 additions & 1 deletion app/models/display_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def call(
out[:sonos_status] = home_assistant_api.now_playing
out[:status_icons] << "warehouse" if home_assistant_api.garage_door_open?
out[:status_icons] << "charging-station" if home_assistant_api.car_needs_plugged_in?
out[:status_icons] << "video" if home_assistant_api.active_video_call?

home_assistant_api.problems.each do |problem|
out[:status_icons_with_labels] << [problem[:icon], problem[:message]]
Expand Down
25 changes: 0 additions & 25 deletions test/apis/home_assistant_api_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,31 +282,6 @@ def test_low_batteries
end
end

def test_active_video_call
config = {
"home_assistant" => {
"audio_input_in_use" => "audio_input"
}
}

data = [
{
entity_id: "audio_input",
state: "on"
}
]

api = HomeAssistantApi.new(config)
api.stub :data, data do
assert(api.active_video_call?)
end

api = HomeAssistantApi.new(config)
api.stub :data, {} do
refute(api.active_video_call?)
end
end

def test_online
config = {
"home_assistant" => {
Expand Down

0 comments on commit 637315c

Please sign in to comment.