Hue-sensors-HASS
Hue-sensors-HASS copied to clipboard
FR: add model, modelid and type to remotes
HI,
Since the hardcoded model:RWL should also be possible to extract from the Api response, I tried below config, and hoped to have added modelid and type in 1 go....would be really nice addition to the attributes set of the remotes.
this doesn't work however. Please help me to add this to the remote.py file in a correct syntax?
thanks!
data = {
"model": response["type"], #"RWL",
"name": response["name"],
"type":" response["type"],
"modelid": response["modelid"],
"state": button,
"battery": response["config"]["battery"],
"on": response["config"]["on"],
"reachable": response["config"]["reachable"],
"last_updated": response["state"]["lastupdated"].split("T"),
}
return data
separate post: made it: of course had to add the attributes to the attributes config:
ATTRS = {
"RWL": ["last_updated", "battery", "on", "reachable", "name", "type", "modelid"],
result:
![Schermafbeelding 2020-01-27 om 12 07 31](https://user-images.githubusercontent.com/33354141/73170002-a9545000-40fd-11ea-9252-547ef0eeaceb.png)
![Schermafbeelding 2020-01-27 om 12 07 03](https://user-images.githubusercontent.com/33354141/73170018-b07b5e00-40fd-11ea-9a79-4c956d628eb8.png)
only thing is that the more-info still shows the toggle switch. Is this a bug?
Is this a feature request? If you are suggesting changes to the code please create a PR
sure, I will, if you allow. first thought it wise to ask you if you would accept it as an addition to the feature set ;-)
id suggest doing this for the RWL:
data = {
"model": "RWL",
"state": button,
"on": response["config"]["on"],
"battery": response["config"]["battery"],
"reachable": response["config"]["reachable"],
"last_updated": response["state"]["lastupdated"].split("T"),
"name": response["name"],
"type": response["type"],
"modelid": response["modelid"],
"uniqueid": response["uniqueid"],
}
and this for the Tap ZGP:
data = {
"model": "ZGP",
"name": response["name"],
"state": button,
"last_updated": response["state"]["lastupdated"].split("T"),
"type": response["type"],
"modelid": response["modelid"],
"uniqueid": response["uniqueid"],
}
also tried the swuniqueid, but apparently these sensors don't use those, they errored in my Hue Api