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

Multiple thermostats #5

Open
toddeye opened this issue Oct 11, 2015 · 2 comments
Open

Multiple thermostats #5

toddeye opened this issue Oct 11, 2015 · 2 comments

Comments

@toddeye
Copy link

toddeye commented Oct 11, 2015

Hi,
Was wondering in discovery why you check for the case where you get > 1 thermostats but only return the first? Why not just return the thermostats as a list?

if len(thermostats) > 1:
            raise IOError("Found %d thermostats and I don't know which to pick." % len(thermostats))
        return thermostats[0]

Thanks for the library.

Todd

@mhrivnak
Copy link
Owner

I think this was only because there wasn't a good way (or maybe any way) to help the user determine which thermostat is which. The expectation is that the user will have a known hostname or IP address for each thermostat. Otherwise, how do you know which one you're interacting with?

Perhaps if each is a different model, that would give you a way to tell them apart. Seems like an edge case though.

Ideas are welcome. If you want to implement multiple-thermostat discovery, that's fine with me as long as we have a clear user story.

@toddeye
Copy link
Author

toddeye commented Oct 15, 2015

discovery could query the name of the thermostat(s) and return the name, model etc, but personally I think the calling application should be responsible for associating the IP(s) with the location of an individual thermostat.

for index, tstat_host in enumerate(radiotherm.discover.discover_address()):
    tstats.append(radiotherm.get_thermostat(tstat_host))
    print(tstats[index].name)     
{'raw': 'upstairs'}
{'raw': 'downstairs'}

What do you think?

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

No branches or pull requests

3 participants