-
Notifications
You must be signed in to change notification settings - Fork 44
[Feature Request] Device Components #44
Comments
@andrewsayre Thank you for all your great work on this plugin! I as well would like to be able to see and control device components for my refrigerator (I can't get or set the temperature currently in HomeAssistant). Do you have any suggestions for how to go about adding this feature? Would you be willing to review a PR that attempts to do such? Thanks! |
Are you missing the temperature sensor completely? As for controlling the device take a look at https://github.com/veista/smartthings. I can add the missing functions there with your help. |
The temperature and set point values are "unknown" always
The actual values are nested under "cooler" and freezer" @veista is your package a drop-in replacement for this one? I'd prefer to try to work on enhancing this package if the dev is open to continuing to advance it before switching to a fork, but if this package is not actively developed/supported that's definitely an option |
It's a drop-in replacement for the SmartThings integration in Home Assistant, it utilizes this library. @veista have you considered dropping some PRs into core to upgrade the component? I'll defiantly be giving your component a shot. |
There are only a few minor bugs worth updating. Otherwise they will not be accepted to the main dev. |
You may be as defiant as you wish. I waited a couple of years for these features in vain as did many others. |
lol sorry that was supposed to be "definitely" |
As the maintainer of this library, I'm not sure what you're referring to. I'd welcome PRs to add component support or other mainline features. |
@andrewsayre I am referring to custom. Components and comparable capabilities that you have refused to add to the library due to not being in ST standard. This is good news. This problem indeed is not related directly to previous ones. Can you explain to me two things though.
|
That's my position on adding convenience members for "custom capabilities" (there isn't such a thing as custom components). Capabilities are a dynamic element and "custom" capabilities particularly can be changed at-will, hence why adding convenience methods and constants for them would create too much overhead to maintain. Those constants are just strings and the convenience methods are just wrappers that use strings to access dictionary values or post a device command. The library already provides everything needed to utilize and interact with ANY capability--custom or not.
It is not an overriding or shadowing concept. Each component is essentially a dictionary of values. "main" is the "default" dictionary of attribute values. It's a legacy artifact from before ST had multicomponent devices to treat them as top-level/default attributes (which this library does with the convenience members--another reason not to keep perpetuating this pattern).
It's not ignored. Within each component, there can only be one district value for an attribute (just like a dictionary). Whatever value is set for the attribute will be the value for any capability that has an attribute with the same name in the same component. This does mean you can't have colliding attributes with different values -- updates to them would replace the previous value. This is a legacy behavior, which I'm not sure is true anymore. Attribute values are nested under their component, so it's possible you can have the same attribute name under different capabilities with different values. One suggestion I have would be to study the SmartThings Core SDK. That library exposes the ST concepts properly and is ultimately how this library should be modeled/advanced to. |
Yes. Sorry, I meant custom. Capabilities. I understand this, and that is what I was refering to. I think the problem I ran in previously is anwsered in 2. This is most certainly not true anymore. I have tried to study the SmartThings core. Most issues arise from samsung not using this in their own devices. |
And as for question 1: in firstof9's case he has a null value in temperatureMeasurement showing in HA, but "main" has a valid value for that capability. Im assuming it is overwritten by component "cvroom"'s temperatureMeasurement. I will try to confirm this behaviour. I understood from your code that capabilities from "main" are used. Correct me if I am wrong. |
Also I was refering to my fork of the HA integration. |
Since this is an old dump, the |
Thanks for that update. There dones't appear to be a mystery here. For whatever reason, the device is reporting no value/null and the library and Home Assistant integration are updating accordingly. |
My approach to try to keep backwards compatibility with HA was probably going to be something along the lines of turning each component into its own device. That would "fix" the issue of a single device having the same capability in multiple components, but could introduce issues with duplicate IDs. Alternatively, one could try to truly support multiple components fully under a single device. Would that break Home assistant? |
Yes, I was just assuming as I stated, with the information that was given. Sorry for the confusion. |
Here's a new dump: {
"components": {
"icemaker": {
"custom.disabledCapabilities": {
"disabledCapabilities": {
"value": null
}
},
"switch": {
"switch": {
"value": "on",
"timestamp": "2021-10-31T04:45:37.879Z"
}
}
},
"cooler": {
"contactSensor": {
"contact": {
"value": "closed",
"timestamp": "2022-01-18T20:13:23.156Z"
}
},
"custom.disabledCapabilities": {
"disabledCapabilities": {
"value": [],
"timestamp": "2021-07-27T01:19:43.145Z"
}
},
"temperatureMeasurement": {
"temperature": {
"value": 37,
"unit": "F",
"timestamp": "2022-01-11T01:43:48.635Z"
}
},
"custom.thermostatSetpointControl": {
"minimumSetpoint": {
"value": 34,
"unit": "F",
"timestamp": "2021-07-27T01:19:42.452Z"
},
"maximumSetpoint": {
"value": 44,
"unit": "F",
"timestamp": "2021-07-27T01:19:42.452Z"
}
},
"thermostatCoolingSetpoint": {
"coolingSetpoint": {
"value": 37,
"unit": "F",
"timestamp": "2021-07-27T01:19:42.452Z"
}
}
},
"freezer": {
"contactSensor": {
"contact": {
"value": "closed",
"timestamp": "2022-01-18T19:58:59.613Z"
}
},
"custom.disabledCapabilities": {
"disabledCapabilities": {
"value": [],
"timestamp": "2021-07-27T01:19:43.145Z"
}
},
"temperatureMeasurement": {
"temperature": {
"value": 0,
"unit": "F",
"timestamp": "2021-12-19T05:08:29.876Z"
}
},
"custom.thermostatSetpointControl": {
"minimumSetpoint": {
"value": -8,
"unit": "F",
"timestamp": "2021-07-27T01:19:42.452Z"
},
"maximumSetpoint": {
"value": 5,
"unit": "F",
"timestamp": "2021-07-27T01:19:42.452Z"
}
},
"thermostatCoolingSetpoint": {
"coolingSetpoint": {
"value": 0,
"unit": "F",
"timestamp": "2021-07-27T01:19:42.452Z"
}
}
},
"main": {
"custom.disabledComponents": {
"disabledComponents": {
"value": [
"icemaker-02"
],
"timestamp": "2021-07-27T01:19:43.145Z"
}
},
"contactSensor": {
"contact": {
"value": "closed",
"timestamp": "2022-01-18T20:13:23.156Z"
}
},
"powerConsumptionReport": {
"powerConsumption": {
"value": {
"energy": 1815132,
"deltaEnergy": 34,
"power": 153,
"powerEnergy": 34.42290833294392,
"persistedEnergy": 0,
"energySaved": 0,
"start": "2022-01-18T20:06:20Z",
"end": "2022-01-18T20:20:23Z"
},
"timestamp": "2022-01-18T20:20:23.018Z"
}
},
"samsungce.viewInside": {
"contents": {
"value": [],
"timestamp": "2021-11-11T11:40:55.468Z"
},
"lastUpdatedTime": {
"value": "2022-01-18T20:13:31Z",
"timestamp": "2022-01-18T20:13:32.030Z"
}
},
"refresh": {},
"execute": {
"data": {
"value": {
"payload": {
"rt": [
"x.com.samsung.da.energyconsumption"
],
"if": [
"oic.if.a"
],
"x.com.samsung.da.cumulativePower": "1815132",
"x.com.samsung.da.cumulativeUnit": "Wh",
"x.com.samsung.da.instantaneousPower": "153",
"x.com.samsung.da.instantaneousPowerUnit": "W",
"x.com.samsung.da.monthlyConsumption": "72000",
"x.com.samsung.da.thismonthlyConsumption": "38832"
}
},
"data": {
"href": "/energy/consumption/vs/0"
},
"timestamp": "2022-01-18T20:20:23.018Z"
}
},
"custom.fridgeMode": {
"fridgeModeValue": {
"value": null
},
"fridgeMode": {
"value": null
}
},
"ocf": {
"st": {
"value": "2021-11-25T11:41:19Z",
"timestamp": "2021-12-02T11:41:36.995Z"
},
"mndt": {
"value": "",
"timestamp": "2021-07-27T01:19:42.234Z"
},
"mnfv": {
"value": "20210813.115026",
"timestamp": "2021-08-25T13:20:27.463Z"
},
"mnhw": {
"value": "",
"timestamp": "2021-07-27T01:19:42.234Z"
},
"di": {
"value": "7d3feb98-8a36-4351-c362-5e21ad3a78dd",
"timestamp": "2021-07-27T01:19:42.234Z"
},
"mnsl": {
"value": "",
"timestamp": "2021-07-27T01:19:42.234Z"
},
"dmv": {
"value": "res.1.1.0,sh.1.1.0",
"timestamp": "2021-12-02T11:41:36.995Z"
},
"n": {
"value": "[refrigerator] Samsung (LCD)",
"timestamp": "2021-07-27T01:19:42.234Z"
},
"mnmo": {
"value": "21K_REF_LCD_FHUB6.0|00113141|0002034e051324200103000000000000",
"timestamp": "2021-07-27T01:19:42.234Z"
},
"vid": {
"value": "DA-REF-NORMAL-01001",
"timestamp": "2021-07-27T01:19:42.234Z"
},
"mnmn": {
"value": "Samsung Electronics",
"timestamp": "2021-07-27T01:19:42.234Z"
},
"mnml": {
"value": "",
"timestamp": "2021-07-27T01:19:42.234Z"
},
"mnpv": {
"value": "6.0",
"timestamp": "2021-07-27T01:19:42.234Z"
},
"mnos": {
"value": "Tizen",
"timestamp": "2021-07-27T01:19:42.234Z"
},
"pi": {
"value": "7d3feb98-8a36-4351-c362-5e21ad3a78dd",
"timestamp": "2021-07-27T01:19:42.234Z"
},
"icv": {
"value": "core.1.1.0",
"timestamp": "2021-07-27T01:19:42.234Z"
}
},
"refrigeration": {
"defrost": {
"value": "off",
"timestamp": "2021-07-27T01:19:42.945Z"
},
"rapidCooling": {
"value": "off",
"timestamp": "2021-07-27T01:19:42.715Z"
},
"rapidFreezing": {
"value": "off",
"timestamp": "2021-07-27T01:19:42.715Z"
}
},
"samsungce.powerCool": {
"activated": {
"value": false,
"timestamp": "2021-07-27T01:19:42.715Z"
}
},
"custom.disabledCapabilities": {
"disabledCapabilities": {
"value": [
"custom.deviceReportStateConfiguration"
],
"timestamp": "2021-07-27T01:19:43.145Z"
}
},
"samsungce.driverVersion": {
"versionNumber": {
"value": 21061601,
"timestamp": "2021-11-29T02:07:32.214Z"
}
},
"samsungce.powerFreeze": {
"activated": {
"value": false,
"timestamp": "2021-07-27T01:19:42.715Z"
}
},
"temperatureMeasurement": {
"temperature": {
"value": null
}
},
"custom.deviceReportStateConfiguration": {
"reportStateRealtimePeriod": {
"value": null
},
"reportStateRealtime": {
"value": {
"state": "disabled"
},
"timestamp": "2021-07-27T01:19:42.757Z"
},
"reportStatePeriod": {
"value": "enabled",
"timestamp": "2021-07-27T01:19:42.757Z"
}
},
"custom.waterFilter": {
"waterFilterUsageStep": {
"value": 1,
"timestamp": "2021-11-29T02:21:18.647Z"
},
"waterFilterResetType": {
"value": [
"replaceable"
],
"timestamp": "2021-11-29T02:21:18.647Z"
},
"waterFilterCapacity": {
"value": null
},
"waterFilterLastResetDate": {
"value": null
},
"waterFilterUsage": {
"value": 43,
"timestamp": "2022-01-17T01:48:22.020Z"
},
"waterFilterStatus": {
"value": "normal",
"timestamp": "2021-11-29T02:21:18.647Z"
}
},
"thermostatCoolingSetpoint": {
"coolingSetpoint": {
"value": null
}
}
},
"cvroom": {
"custom.fridgeMode": {
"fridgeModeValue": {
"value": null
},
"fridgeMode": {
"value": "CV_FDR_DELI",
"timestamp": "2021-07-27T01:19:42.702Z"
}
},
"contactSensor": {
"contact": {
"value": "closed",
"timestamp": "2022-01-18T20:01:01.895Z"
}
},
"custom.disabledCapabilities": {
"disabledCapabilities": {
"value": [],
"timestamp": "2021-07-27T01:19:43.145Z"
}
}
},
"icemaker-02": {
"custom.disabledCapabilities": {
"disabledCapabilities": {
"value": null
}
},
"switch": {
"switch": {
"value": null
}
}
}
}
} |
Should be fixed with #77 and home-assistant/core#99924 |
I'd like to be able to manipulate/read the individual device components exposed via the API if possible in Home Assistant.
ie: toggle the icemaker, adjust the freezer/fridge setpoint, monitor the contact sensors separately.
If there's anything I can do to assist please let me know.
Example /v1/devices/{deviceID}/status:
The text was updated successfully, but these errors were encountered: