Skip to content

Commit

Permalink
Report error when room is not ok and small bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
arjenbos committed Nov 2, 2023
1 parent 4ed6284 commit 1db3046
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions custom_components/alpha_innotec/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ def _handle_coordinator_update(self) -> None:
@property
def current_temperature(self) -> float | None:
"""Return the current temperature."""
return self.thermostat.current_temperature if isinstance(self.thermostat.current_temperature, float) else None
return self.thermostat.current_temperature if isinstance(self.thermostat.current_temperature, (float, int)) else None

@property
def target_temperature(self) -> float:
"""Return the temperature we try to reach."""
return self.thermostat.desired_temperature if isinstance(self.thermostat.desired_temperature, float) else None
return self.thermostat.desired_temperature if isinstance(self.thermostat.desired_temperature, (float, int)) else None

async def async_set_temperature(self, **kwargs) -> None:
"""Set new target temperature."""
Expand Down
3 changes: 3 additions & 0 deletions custom_components/alpha_innotec/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ async def _async_update_data(self) -> dict[str, list[Valve | Thermostat]]:
current_temperature = module_details["currentTemperature"]
battery_percentage = module_details["battery"]

if room.get('status', 'problem') == 'problem':
_LOGGER.error("According to the API there is a problem with: %s", room['name'])

thermostat = Thermostat(
identifier=room_id,
name=room['name'],
Expand Down
2 changes: 1 addition & 1 deletion custom_components/alpha_innotec/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def name(self) -> str | UndefinedType | None:

@property
def native_value(self):
return self.thermostat.battery_percentage if self.thermostat.battery_percentage != "unknown" else None
return self.thermostat.battery_percentage if isinstance(self.thermostat.battery_percentage, (float, int)) else None

@callback
def _handle_coordinator_update(self) -> None:
Expand Down

2 comments on commit 1db3046

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HA Alpha Innotec Coverage

HA Alpha Innotec
FileStmtsMissCoverMissing
__init__.py21957%19–20, 22, 27, 29, 34, 36–37, 39
api.py44295%48, 51
binary_sensor.py50500%2, 4–5, 7, 9–13, 16–19, 21, 24, 27, 29, 31, 33, 35–36, 42, 45, 48, 50–52, 54–55, 57, 65–67, 69–70, 72, 74–76, 78–80, 82–87, 89, 91
climate.py62620%2, 4–5, 7, 11–16, 18–20, 22, 25, 28, 30, 32, 34, 36–37, 43, 46, 49–51, 55, 57–59, 61–62, 64, 72–73, 75, 77–79, 81–82, 84–86, 88, 90, 93–94, 96, 98–99, 101, 103, 105–107, 109–110, 112, 114–115, 118
config_flow.py371559%24–25, 27–30, 32–35, 57–61
const.py70100% 
controller_api.py786121%17–18, 20–21, 23–26, 28, 30–33, 35, 38, 40, 43, 45, 50, 52–55, 57, 59–60, 62, 64, 71, 73, 75, 82, 84–85, 87, 89, 91, 93, 95–96, 98, 101, 104–105, 107–110, 112, 115, 118, 124, 126–130, 142–144, 146
coordinator.py51510%1–2, 4–6, 8–11, 13, 16, 18, 20, 22, 29–30, 32–35, 37–38, 40–42, 44–45, 47–49, 51, 53–55, 57–58, 60, 72, 74–75, 77–78, 80–81, 83, 85–87, 89, 99, 101
gateway_api.py604525%17–19, 21–23, 26–27, 29–30, 32–35, 37, 39–42, 44, 47, 49, 52, 54, 59, 61, 63–65, 67, 69–70, 72, 74, 77, 79–80, 82, 85, 87, 90, 93–95, 97
sensor.py49490%2, 4–6, 8, 10–14, 16–18, 20, 23, 26, 28, 30, 32, 34–35, 41, 44, 47–48, 50, 53–55, 57–58, 60, 68–69, 71, 73–75, 77–79, 81–86, 88, 90
structs
   Thermostat.py11918%8–16
TOTAL47035324% 

Tests Skipped Failures Errors Time
3 0 💤 0 ❌ 0 🔥 0.652s ⏱️

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HA Alpha Innotec Coverage

HA Alpha Innotec
FileStmtsMissCoverMissing
__init__.py21957%19–20, 22, 27, 29, 34, 36–37, 39
api.py44295%48, 51
binary_sensor.py50500%2, 4–5, 7, 9–13, 16–19, 21, 24, 27, 29, 31, 33, 35–36, 42, 45, 48, 50–52, 54–55, 57, 65–67, 69–70, 72, 74–76, 78–80, 82–87, 89, 91
climate.py62620%2, 4–5, 7, 11–16, 18–20, 22, 25, 28, 30, 32, 34, 36–37, 43, 46, 49–51, 55, 57–59, 61–62, 64, 72–73, 75, 77–79, 81–82, 84–86, 88, 90, 93–94, 96, 98–99, 101, 103, 105–107, 109–110, 112, 114–115, 118
config_flow.py371559%24–25, 27–30, 32–35, 57–61
const.py70100% 
controller_api.py786121%17–18, 20–21, 23–26, 28, 30–33, 35, 38, 40, 43, 45, 50, 52–55, 57, 59–60, 62, 64, 71, 73, 75, 82, 84–85, 87, 89, 91, 93, 95–96, 98, 101, 104–105, 107–110, 112, 115, 118, 124, 126–130, 142–144, 146
coordinator.py51510%1–2, 4–6, 8–11, 13, 16, 18, 20, 22, 29–30, 32–35, 37–38, 40–42, 44–45, 47–49, 51, 53–55, 57–58, 60, 72, 74–75, 77–78, 80–81, 83, 85–87, 89, 99, 101
gateway_api.py604525%17–19, 21–23, 26–27, 29–30, 32–35, 37, 39–42, 44, 47, 49, 52, 54, 59, 61, 63–65, 67, 69–70, 72, 74, 77, 79–80, 82, 85, 87, 90, 93–95, 97
sensor.py49490%2, 4–6, 8, 10–14, 16–18, 20, 23, 26, 28, 30, 32, 34–35, 41, 44, 47–48, 50, 53–55, 57–58, 60, 68–69, 71, 73–75, 77–79, 81–86, 88, 90
structs
   Thermostat.py11918%8–16
TOTAL47035324% 

Tests Skipped Failures Errors Time
3 0 💤 0 ❌ 0 🔥 0.450s ⏱️

Please sign in to comment.