Skip to content

Commit

Permalink
Climate and sensor report as not available when grill is offline
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenpapierski committed Feb 13, 2021
1 parent f5eaba2 commit 24cc1fb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions custom_components/traeger/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ def grill_update(self):
self.schedule_update_ha_state()

# Generic Properties
@property
def available(self):
"""Reports unavailable when the grill is powered off"""
if self.grill_state is None:
return False
else:
return True if self.grill_state["connected"] == True else False

@property
def name(self):
"""Return the name of the grill"""
Expand Down
16 changes: 16 additions & 0 deletions custom_components/traeger/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ def grill_update(self):
self.schedule_update_ha_state()

# Generic Properties
@property
def available(self):
"""Reports unavailable when the grill is powered off"""
if self.grill_state is None:
return False
else:
return True if self.grill_state["connected"] == True else False

@property
def name(self):
"""Return the name of the sensor."""
Expand Down Expand Up @@ -106,6 +114,14 @@ def grill_update(self):
self.schedule_update_ha_state()

# Generic Properties
@property
def available(self):
"""Reports unavailable when the grill is powered off"""
if self.grill_state is None:
return False
else:
return True if self.grill_state["connected"] == True else False

@property
def name(self):
"""Return the name of the sensor."""
Expand Down

0 comments on commit 24cc1fb

Please sign in to comment.