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

Exit when command_classes are missing thermostat Zwave #2824

Merged
merged 1 commit into from
Aug 16, 2016

Conversation

turbokongen
Copy link
Contributor

Description:
Make sure essential values are present. Exit if not.
#2820

@@ -52,6 +52,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
_LOGGER.debug("Remotec ZXT-120 Zwave Thermostat, ignoring")
return

if value.command_class != COMMAND_CLASS_SENSOR_MULTILEVEL and \
value.command_class != COMMAND_CLASS_THERMOSTAT_SETPOINT:
return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, now you're checking if 1 value is equal to 2 different values. I'm assuming those 2 values are not the same so this test will always be false.

Copy link
Contributor Author

@turbokongen turbokongen Aug 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, This is inverted logic. We use the same here:
https://github.com/turbokongen/home-assistant/blob/zwave_fixes/homeassistant/components/garage_door/zwave.py#L28
Or maybe this is or we need? 😕
I see. We need to test each individual not together.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see I need to figure out a different method to do this. Because we pass in only one command_class to begin with.

@turbokongen turbokongen force-pushed the zwave_fixes branch 3 times, most recently from 40e90fa to bbb125d Compare August 14, 2016 20:59
@@ -51,6 +51,11 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
if DEVICE_MAPPINGS[specific_sensor_key] == WORKAROUND_IGNORE:
_LOGGER.debug("Remotec ZXT-120 Zwave Thermostat, ignoring")
return
if not (value.node.get_values_for_command_class(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An empty dict is already falsey while a dict with any info in it is true. So no need to call items() on it.

› python3
Python 3.4.3 (default, Aug 11 2015, 08:57:25)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> bool({})
False
>>> bool({'hello': 1})
True

@balloob balloob merged commit 27e27ee into home-assistant:dev Aug 16, 2016
@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants