Skip to content

Commit

Permalink
Upped version number, fixed ruff errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Big-Tree committed Jan 3, 2024
1 parent 767e7ed commit 16231ec
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion custom_components/optispark/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

NAME = "Optispark"
DOMAIN = "optispark"
VERSION = "0.0.7"
VERSION = "0.0.8"
ATTRIBUTION = "Data provided by http://jsonplaceholder.typicode.com/"

LAMBDA_TEMP = 'temps'
Expand Down
11 changes: 6 additions & 5 deletions custom_components/optispark/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(
self._user_hash)

def convert_sensor_from_farenheit(self, entity, temp):
"""Ensure that the sensor returns values in Celcius
"""Ensure that the sensor returns values in Celcius.
Only works with sensor entities
If the sensor uses Farenheit then we'll need to convert Farenheit to Celcius
Expand All @@ -85,10 +85,10 @@ def convert_sensor_from_farenheit(self, entity, temp):
# Convert temperature from Celcius to Farenheit
return (temp-32) * 5/9
else:
raise ValueError(f'Heat pump uses unkown units ({heat_pump_unit})')
raise ValueError(f'Heat pump uses unkown units ({sensor_unit})')

def convert_climate_from_farenheit(self, entity, temp):
"""Ensure that the heat pump returns values in Celcius
"""Ensure that the heat pump returns values in Celcius.
Only works with climate entity
If the heat_pump uses Farenheit then we'll need to convert Farenheit to Celcius
Expand All @@ -103,10 +103,11 @@ def convert_climate_from_farenheit(self, entity, temp):
raise ValueError(f'Heat pump uses unkown units ({heat_pump_unit})')

def convert_climate_from_celcius(self, entity, temp):
"""Ensure that the heat pump is given a temperature in the correct units
"""Ensure that the heat pump is given a temperature in the correct units.
Only works with climate entities.
If the heat_pump uses Farenheit then we'll need to convert Celcius to Farenheit"""
If the heat_pump uses Farenheit then we'll need to convert Celcius to Farenheit
"""
heat_pump_unit = entity.temperature_unit
if heat_pump_unit == homeassistant.const.TEMP_CELSIUS:
return temp
Expand Down
3 changes: 1 addition & 2 deletions custom_components/optispark/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import json
from .const import LOGGER
from . import const
from . import get_entity


class OptisparkGetHistoryError(Exception):
Expand Down Expand Up @@ -67,7 +66,7 @@ def get_user_info(hass, heat_pump_entity_id):
def climate_history(hass, climate_entity_id, state_changes):
"""Climate history.
Home assistant logs the temperature states in whatever unit is set by the user (not the heat
Home assistant logs the temperature states in whatever unit is set by the user (not the heat
pump entity). We only need to convert the temperature to °C if the user is using hh in °F mode.
If the user toggles the hh temperature units, the past logs will be messed up. The units will be
Expand Down
2 changes: 1 addition & 1 deletion custom_components/optispark/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"documentation": "https://github.com/Big-Tree/HomeAssistant-OptiSpark",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/Big-Tree/HomeAssistant-OptiSpark/issues",
"version": "0.0.7"
"version": "0.0.8"
}

0 comments on commit 16231ec

Please sign in to comment.