Skip to content
This repository has been archived by the owner on Jul 23, 2021. It is now read-only.

FR: add model, modelid and type to remotes #177

Open
Mariusthvdb opened this issue Jan 27, 2020 · 3 comments
Open

FR: add model, modelid and type to remotes #177

Mariusthvdb opened this issue Jan 27, 2020 · 3 comments

Comments

@Mariusthvdb
Copy link
Contributor

Mariusthvdb commented Jan 27, 2020

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
Copy link
Contributor Author

Mariusthvdb commented Jan 27, 2020

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?

@robmarkcole
Copy link
Owner

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

@Mariusthvdb
Copy link
Contributor Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants