Hue-sensors-HASS icon indicating copy to clipboard operation
Hue-sensors-HASS copied to clipboard

FR: add model, modelid and type to remotes

Open Mariusthvdb opened this issue 4 years ago • 3 comments

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

Mariusthvdb avatar Jan 27 '20 10:01 Mariusthvdb

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 Schermafbeelding 2020-01-27 om 12 07 03

only thing is that the more-info still shows the toggle switch. Is this a bug?

Mariusthvdb avatar Jan 27 '20 11:01 Mariusthvdb

Is this a feature request? If you are suggesting changes to the code please create a PR

robmarkcole avatar Jan 27 '20 11:01 robmarkcole

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

Mariusthvdb avatar Jan 27 '20 11:01 Mariusthvdb