Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current temperature and battery cannot be read out on sense_control thermostat units #5

Open
DrBlokmeister opened this issue Oct 27, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@DrBlokmeister
Copy link

Great integration! I was thinking of improving my python skills and writing my own, but then I found this. Really happy with it! 😊

After installing and setting up, I could only change the temperature setpoint, not the current temperature or battery settings. After a few hours of digging, I managed a containment by modifying const.py and base_coordinator.py. The changes are below:

const.py changed to:

from homeassistant.const import Platform

DOMAIN = "alpha_innotec"

MANUFACTURER = "Alpha Innotec"

PLATFORMS = [
    Platform.SENSOR,
    Platform.CLIMATE,
]

MODULE_TYPE_FLOOR = "floor"
MODULE_TYPE_SENSOR = "sense_control" #changed from sensor

MODULE_TYPES = [
    MODULE_TYPE_FLOOR,
    MODULE_TYPE_SENSOR
]

base_coordinator.py changed line 43:

if module_details["type"] == MODULE_TYPE_SENSOR:
    current_temperature = module_details["currentTemperature"] #changed from actualTemperature
    battery_percentage = module_details["battery"]
@arjenbos arjenbos linked a pull request Oct 27, 2023 that will close this issue
@arjenbos
Copy link
Owner

Hi @DrBlokmeister,

Thanks for sharing! I created a pull request based on your information. Why did you changed the value of constant "MODULE_TYPE_SENSOR"? I think your change will break the integration for others. So, I added an extra else if in base_coordinator.py. Also, you say that you changed the key currentTemperature from actualTemperature, but it looks like key was already currentTemperature.

Please check the linked pull request and maybe test it in your home assistant installation?

@DrBlokmeister
Copy link
Author

Oops! The change was in ccontroller_api.py, line 126.

I agree that my change will likely break the integration for others. I'll have a look next week to see if it works.

@arjenbos arjenbos added the enhancement New feature or request label Oct 30, 2023
@arjenbos
Copy link
Owner

Created a new PR - #14

@DrBlokmeister
Copy link
Author

DrBlokmeister commented Nov 11, 2023

Just updated to the latest version and modified the files in the PR (moved the code change to coordinator.py instead of base_coordinator.py). The integration won't load anymore. A log entry is attached below (I redacted my home address):

2023-11-11 08:50:19.906 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry <HOME ADDRESS REDACTED> for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 557, in async_unload
    result = await component.async_unload_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 136, in async_unload_entry
    return await component.async_unload_entry(entry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 202, in async_unload_entry
    raise ValueError("Config entry was never loaded!")
ValueError: Config entry was never loaded!
2023-11-11 08:50:19.915 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry <HOME ADDRESS REDACTED> for binary_sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 557, in async_unload
    result = await component.async_unload_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 175, in async_unload_entry
    return await component.async_unload_entry(entry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 202, in async_unload_entry
    raise ValueError("Config entry was never loaded!")
ValueError: Config entry was never loaded!
2023-11-11 08:50:19.925 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry <HOME ADDRESS REDACTED> for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 557, in async_unload
    result = await component.async_unload_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 201, in async_unload_entry
    return await component.async_unload_entry(entry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 202, in async_unload_entry
    raise ValueError("Config entry was never loaded!")
ValueError: Config entry was never loaded!

I rolled back to the previous version and modified the files in the PR. This works. I can view the current temperature and battery percentage with my sense control units.

So the PR works as intended, however not with the current version anymore.

@arjenbos
Copy link
Owner

I do not think that this error is related to any change I made recently. I need to update the PR before I can merge it, but nice to know that the initial changes work as intended. In that case I can safely deploy the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants