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

Smartthings Device with 3 Components ==> Missing Switches / Sensors #91892

Closed
thomas-coenen opened this issue Apr 23, 2023 · 34 comments
Closed

Comments

@thomas-coenen
Copy link

The problem

I have a Heat pump with Samsung Wifi Kit. In the Smartthings App everything is working properly. The Heat pump is one device with 3 components. Warm Water, Normal Heating (INDOOR1) and Floor Heating (INDOOR2). In Home assistant I can only see the switch and actual values for the Warm Water. Please find the infos got by SmartthingsCLI below:

Main Info
───────────────────────────────────────────────────────────────
 Label                   Eco Heating System
 Name                    Eco Heating System
 Id                      xxx
 Type                    OCF
 Manufacturer Code       Samsung Electronics
 Location Id             xxx
 Room Id                 xxx
 Profile Id              xxx
 Capabilities            ocf
                         switch
                         temperatureMeasurement
                         thermostatCoolingSetpoint
                         thermostatHeatingSetpoint
                         airConditionerMode
                         powerConsumptionReport
                         demandResponseLoadControl
                         remoteControlStatus
                         refresh
                         execute
                         custom.energyType
                         custom.outingMode
                         custom.thermostatSetpointControl
                         custom.deviceReportStateConfiguration
                         custom.disabledCapabilities
                         samsungce.deviceIdentification
                         samsungce.driverVersion
                         samsungce.sacDisplayCondition
                         samsungce.softwareUpdate
                         samsungce.ehsFsvSettings
                         samsungce.ehsCycleData
                         samsungce.ehsTemperatureReference
                         samsungce.ehsThermostat
 Capabilities (INDOOR1)  switch
                         temperatureMeasurement
                         thermostatCoolingSetpoint
                         airConditionerMode
                         custom.thermostatSetpointControl
                         samsungce.ehsTemperatureReference
                         samsungce.ehsThermostat
                         samsungce.sacDisplayCondition
 Capabilities (INDOOR2)  switch
                         temperatureMeasurement
                         thermostatCoolingSetpoint
                         airConditionerMode
                         custom.thermostatSetpointControl
                         samsungce.ehsTemperatureReference
                         samsungce.ehsThermostat
                         samsungce.sacDisplayCondition
───────────────────────────────────────────────────────────────

There was a similar issue (#83136), but it has been closed by the bot.

What version of Home Assistant Core has the issue?

core-2023.4.6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

SmartThings

Link to integration documentation on our website

https://www.home-assistant.io/integrations/smartthings/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

Hey there @andrewsayre, mind taking a look at this issue as it has been labeled with an integration (smartthings) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of smartthings can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign smartthings Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


smartthings documentation
smartthings source
(message by IssueLinks)

@thomas-coenen
Copy link
Author

@andrewsayre
Hey Andrew,

Do you have any idea how to solve this issue? I would appreciate your contribution.

Best regards,
Thomas

@andrewsayre
Copy link
Member

Device Components are not currently supported in the integration. This isn't an issue, but a feature request.

@TheSimpleZ
Copy link

I have a similar setup, except I only use one of the zones called INDOOR which is also missing.
I'm also missing the ability to control any of the setpoints or modes on the main component. I can only read the values.
Could you consider this issue a feature request or would you like for us to open a thread in the forums?

@dwradcliffe
Copy link
Contributor

I have a PR which adds support for components: #99924

@moebis
Copy link

moebis commented Sep 12, 2023

I have a PR which adds support for components: #99924

Hi David, is there a way I could install/test this now? They are saying on the discord it could take months for the PR.

@dwradcliffe
Copy link
Contributor

Hi David, is there a way I could install/test this now? They are saying on the discord it could take months for the PR.

Yep, I'm doing that. I placed my version of the smartthings component directory in my custom_components directory and also my version of pysmartthings in my root config directory. It should just pick them up and work. Let me know if you have any issues.

@mrkaqz
Copy link

mrkaqz commented Sep 12, 2023

Hi David, is there a way I could install/test this now? They are saying on the discord it could take months for the PR.

Yep, I'm doing that. I placed my version of the smartthings component directory in my custom_components directory and also my version of pysmartthings in my root config directory. It should just pick them up and work. Let me know if you have any issues.

Sorry, can you explain more on the step to put pysmartthings in the root config directory. I cannot find the file called pysmartthings anywhere else in your version. I have put smartthings directory in my custom_components and restart HA but it seem noting happen.

@dwradcliffe
Copy link
Contributor

The pysmartthings library with my changes is andrewsayre/pysmartthings#77
Note that it's not the whole repo, but just the inner pysmartthings directory.

@TheSimpleZ
Copy link

TheSimpleZ commented Sep 13, 2023

I tried your fork, but I'm getting this error in the logs and the integration won't start:

Error setting up entry Home for smartthings
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 388, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/smartthings/__init__.py", line 125, in async_setup_entry
    token = await api.generate_tokens(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/pysmartthings/smartthings.py", line 209, in generate_tokens
    result = await self._service.generate_tokens(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/pysmartthings/api.py", line 424, in generate_tokens
    raise APIInvalidGrant(data.get("error_description"))
pysmartthings.errors.APIInvalidGrant: Empty scope (either the client or the user is not allowed the requested scopes)

EDIT: It seem like the error was fixed by removing the smartthings integration and setting it up again through the homeassistant ui. However, I still don't see the sensors from any other component but the main one.
It also seems like the manifest is missing the "version" property which prevents the integration from loading. Just add any dummy version in the manifest and you should be good to go!

@mrkaqz
Copy link

mrkaqz commented Sep 13, 2023

I tried your fork, but I'm getting this error in the logs and the integration won't start:

Error setting up entry Home for smartthings
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 388, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/smartthings/__init__.py", line 125, in async_setup_entry
    token = await api.generate_tokens(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/pysmartthings/smartthings.py", line 209, in generate_tokens
    result = await self._service.generate_tokens(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/pysmartthings/api.py", line 424, in generate_tokens
    raise APIInvalidGrant(data.get("error_description"))
pysmartthings.errors.APIInvalidGrant: Empty scope (either the client or the user is not allowed the requested scopes)

EDIT: It seem like the error was fixed by removing the smartthings integration and setting it up again through the homeassistant ui. However, I still don't see the sensors from any other component but the main one. It also seems like the manifest is missing the "version" property which prevents the integration from loading. Just add any dummy version in the manifest and you should be good to go!

Yeap, mine works now, need to add version to the manifest file. Thanks. So far it show up correctly. Hope this PR will merge soon.

@thomas-coenen
Copy link
Author

Hi @dwradcliffe,

nice to hear that you have a solution. Putting the smart things folder to custom_components will atumatically "override" the original? Where exactly do I have to put the "pysmartthings". Directly under "config" into folder "pysmartthings"? The complete repository or just the files you changed? Will it also override the original? Is there a nice way to do so, or do I have to download the code and copy it?

Thank you for help.
Regards,
Thomas

@mrkaqz
Copy link

mrkaqz commented Sep 18, 2023 via email

@thomas-coenen
Copy link
Author

I managed to get it working. All sensors are now available. Well done. Unfortunately all temperature set points are also only sensors which cannot be set. Any ideas for that?

@thomas-coenen
Copy link
Author

Hi @dwradcliffe ,

i have another issue. My Heatpump is integrated as an Airconditioner but does not support FAN Mode. I removed it from the list of necessary features. That worked. Unfortunately I can control only the temperature of the first component. Now my question:
Can you extend for Pullrequest to also support the climate entity with multiple components. If I saw correct you added for sensors, binary_sensors and switches. That would be awesome.

Best regards,
Thomas

@dwradcliffe
Copy link
Contributor

Can you extend for Pullrequest to also support the climate entity with multiple components. If I saw correct you added for sensors, binary_sensors and switches. That would be awesome.

In theory yes but as I don't have anything like that to test locally it's more difficult for me. I may attempt it after I get the first round merged or maybe someone else can pick it up.

@moebis
Copy link

moebis commented Oct 4, 2023

How soon will these get merged in? Samsung fridge sensors have been broken in Home Assistant for years (I've found no less than 5 threads going back 2-3 years, multiple pages). Is there a way I can just use this now? Please, thank you.

@mrkaqz
Copy link

mrkaqz commented Oct 6, 2023

How soon will these get merged in? Samsung fridge sensors have been broken in Home Assistant for years (I've found no less than 5 threads going back 2-3 years, multiple pages). Is there a way I can just use this now? Please, thank you.

Yep, manually install the fix in following the instruction in above comment. Mine works for weeks now.

@adamlc
Copy link

adamlc commented Oct 20, 2023

Sadly I haven't had much luck with this custom component. I'm getting the following error. I did try removing and re-adding the integration in home assistant.

I have 2 TVs, 1 Soundbar, 1 Air con and 1 Robot vacuum if that helps

homeassistant  | 2023-10-20 14:31:20.532 ERROR (MainThread) [homeassistant.components.switch] Error while setting up smartthings platform for switch
homeassistant  | Traceback (most recent call last):
homeassistant  |   File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
homeassistant  |     await asyncio.shield(task)
homeassistant  |   File "/config/custom_components/smartthings/switch.py", line 28, in async_setup_entry
homeassistant  |     if component in device.status.disabled_components:
homeassistant  |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | AttributeError: 'DeviceStatus' object has no attribute 'disabled_components'
homeassistant  | 2023-10-20 14:31:20.535 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up smartthings platform for binary_sensor
homeassistant  | Traceback (most recent call last):
homeassistant  |   File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
homeassistant  |     await asyncio.shield(task)
homeassistant  |   File "/config/custom_components/smartthings/binary_sensor.py", line 60, in async_setup_entry
homeassistant  |     if component in device.status.disabled_components:
homeassistant  |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | AttributeError: 'DeviceStatus' object has no attribute 'disabled_components'
homeassistant  | 2023-10-20 14:31:20.536 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up smartthings platform for sensor
homeassistant  | Traceback (most recent call last):
homeassistant  |   File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
homeassistant  |     await asyncio.shield(task)
homeassistant  |   File "/config/custom_components/smartthings/sensor.py", line 565, in async_setup_entry
homeassistant  |     if component in device.status.disabled_components:
homeassistant  |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | AttributeError: 'DeviceStatus' object has no attribute 'disabled_components'

@elad-bar
Copy link

Integration is working with main device only, found the issue and working on PR,
Managed to add all components related to devices for binary sensor, now working on other ha components.

@contemplator1998
Copy link

Just in case, here is a fixed (at least for me) SmartThings you can install via HACS: https://github.com/contemplator1998/smartthings

(Pulled #99924 and wrapped into a HACS repo)

It makes everything accessible, even sensors/controls that are always unavailable (just disable them in the HA).

@ColinSainsbury
Copy link

Thanks for the work you have done @contemplator1998 in my configuration I was only seeing Indoor 1 (Flow Temperature to Radiators) temperature and set point. I lost the Domestic Hot Water temperature and set point measurements. This is not to be critical, it is to assist @elad-bar in their efforts to develop a pull request that enables all features/sensors of the ASHP which is clearly a complex task. Here's hoping that the relevant entities can be presented to show thermostats even if they are not used as such.

@elad-bar
Copy link

I have a solution that should be adopted into the smartthing package, since it's big change (details below) i guess it will take time to deliver it, problem with the approach to open all components without looking into which components are disabled and to have hard-coded mapping of capabilities is that even if additional components will get opened, there will be continous need to update the package,
what i'm suggesting is more dynamic approach relaying on the api samiliar to the mobile app, mapping to complex HA components should be done in the level of HA component and not the package.

below are the main focus of what i have done and shared in my repo elad-bar/dynamic-smart-things.

General functionality representing the integration dyanmically:

  • Importing all devices, components, capabilities and attributes
  • Importing locations and rooms
  • Importing capabilities and their details
  • Performing commands including validation (all capabilities with commands are supported)
  • Future support of additional capabilities and attributes
  • Excluding components and capabilities marked as disabled
  • Diagnostic details for debugging available over function (HA can use it for diagnostic of integration)

Functionality that should be available for HA:

  • Dynamically mapping simple entities to binary_sensor, sensor, number, switch, select
  • Dynamically mapping complex entities to climate, fan, media_player, light, lock

@ColinSainsbury
Copy link

ColinSainsbury commented Jan 18, 2024 via email

@elad-bar
Copy link

sure, you can download the code and run it locally, all you need to setup is your token as environment variable and run it,
It will generate (huge) json file of diagnostics,
One of it's properties is the entities it recommends to create in HA

I can work on custom integration so it will be also available in HACS but i will need few more days for that once i will have time for it, hopefully in 2 weeks.

Pls let me know how it works for you

@ePiccio
Copy link

ePiccio commented Jan 31, 2024

Ciao @elad-bar
first of all many thanks for your help in this! much appreciated!
I have same issue above as Mr ColinSainsbury, before i used to see only hot water, now i only see Indoor 1, and not even properly I would say.
have you had any luck on working on that HACS integration you mentioned?

i'm not familiar with how to run your python code so a bit lost on required steps.
how could I run the code you posted in my HA? anyone that could please help me by sharing a noob-proof step by step guide?
i'm running HA supervised on a Debian Dell mini pc. (and before you ask me how did I get there, i'll say I have been copy/pasting s**tloads of commands blindly :D )
many thanks!!!

@elad-bar
Copy link

elad-bar commented Feb 1, 2024

Hi @ePiccio, didn't get to create custom integration out of that code yet, bit overloaded now, but will work on it as soon as I will be able to promote it,
Current integration is great but limited for main component, it requires lot of changes because it has different data model than the API which makes it limited and all actions are pretty hard coded while definitions are part of the API,
On the other hand, it supports webhooks to get updates while my code doesn't support it, so that will be the main challenge, will keep you posted once it works

@moebis
Copy link

moebis commented Apr 16, 2024

Hi @ePiccio, didn't get to create custom integration out of that code yet, bit overloaded now, but will work on it as soon as I will be able to promote it, Current integration is great but limited for main component, it requires lot of changes because it has different data model than the API which makes it limited and all actions are pretty hard coded while definitions are part of the API, On the other hand, it supports webhooks to get updates while my code doesn't support it, so that will be the main challenge, will keep you posted once it works

Is this available via HACS now? I would love to test this as the other one by @contemplator1998 doesn't work with power reading on the Samsung Fridges. So we have 2 half solutions. The official HA will report power usage but not temps or set-points and @contemplator1998 HACS plugin will report temps but not power. And if you try to remove one and install the other you end up with a bunch of orphaned or broken entities. Been looking for a solution for over a year now.

@Dorf66
Copy link

Dorf66 commented May 5, 2024

I have a PR which adds support for components: #99924

Hi, can you please write me the exact procedure to get all Smartthings entities in Home Assistant? When I use the integration from HA, I only see the options for hot water from the heat pump, when I copy the smartthings folder to the custom_components folder, I only see the entities related to the 2 heating circuits, but again I don't see the hot water options.

@wawyed
Copy link

wawyed commented May 8, 2024

Hi, I just had a ASHP installed and I've love to create automations on it with hot water and heating. Are there any options to support this?

EDIT: For anyone interested I've managed to use the Smartthings API and the Restful sensor/Restful commands home assistant integration to create my own sensors and climate entity to control the samsung heat pump.

@fotodorf
Copy link

Hi, can you please write the exact instructions? Thank you.

@wawyed
Copy link

wawyed commented May 16, 2024

Hi, can you please write the exact instructions? Thank you.

I posted them here #101265 (comment)

@Dorf66
Copy link

Dorf66 commented May 25, 2024

Again:
Hi, can you please write me the exact procedure to get all Smartthings entities in Home Assistant? When I use the integration from HA, I only see the options for hot water from the heat pump, when I copy the smartthings folder to the custom_components folder, I only see the entities related to the 2 heating circuits, but again I don't see the hot water options.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@issue-triage-workflows issue-triage-workflows bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 30, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.