Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
HomeAssistant
Core
Commits
efbc3782
Commit
efbc3782
authored
8 years ago
by
John Arild Berentsen
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix temp conversion for nest setpoint (#3373)
* Fix temp conversion for nest setpoint * DEbug
parent
8ba952ee
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
homeassistant/components/climate/nest.py
+11
-4
11 additions, 4 deletions
homeassistant/components/climate/nest.py
with
11 additions
and
4 deletions
homeassistant/components/climate/nest.py
+
11
−
4
View file @
efbc3782
...
@@ -4,15 +4,17 @@ Support for Nest thermostats.
...
@@ -4,15 +4,17 @@ Support for Nest thermostats.
For more details about this platform, please refer to the documentation at
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/climate.nest/
https://home-assistant.io/components/climate.nest/
"""
"""
import
logging
import
voluptuous
as
vol
import
voluptuous
as
vol
import
homeassistant.components.nest
as
nest
import
homeassistant.components.nest
as
nest
from
homeassistant.components.climate
import
(
from
homeassistant.components.climate
import
(
STATE_COOL
,
STATE_HEAT
,
STATE_IDLE
,
ClimateDevice
,
PLATFORM_SCHEMA
)
STATE_COOL
,
STATE_HEAT
,
STATE_IDLE
,
ClimateDevice
,
PLATFORM_SCHEMA
)
from
homeassistant.const
import
(
from
homeassistant.const
import
(
TEMP_CELSIUS
,
CONF_SCAN_INTERVAL
,
ATTR_TEMPERATURE
)
TEMP_CELSIUS
,
CONF_SCAN_INTERVAL
,
ATTR_TEMPERATURE
)
from
homeassistant.util.temperature
import
convert
as
convert_temperature
DEPENDENCIES
=
[
'
nest
'
]
DEPENDENCIES
=
[
'
nest
'
]
_LOGGER
=
logging
.
getLogger
(
__name__
)
PLATFORM_SCHEMA
=
PLATFORM_SCHEMA
.
extend
({
PLATFORM_SCHEMA
=
PLATFORM_SCHEMA
.
extend
({
vol
.
Optional
(
CONF_SCAN_INTERVAL
):
vol
.
Optional
(
CONF_SCAN_INTERVAL
):
...
@@ -22,7 +24,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
...
@@ -22,7 +24,8 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
def
setup_platform
(
hass
,
config
,
add_devices
,
discovery_info
=
None
):
def
setup_platform
(
hass
,
config
,
add_devices
,
discovery_info
=
None
):
"""
Setup the Nest thermostat.
"""
"""
Setup the Nest thermostat.
"""
add_devices
([
NestThermostat
(
structure
,
device
)
temp_unit
=
hass
.
config
.
units
.
temperature_unit
add_devices
([
NestThermostat
(
structure
,
device
,
temp_unit
)
for
structure
,
device
in
nest
.
devices
()])
for
structure
,
device
in
nest
.
devices
()])
...
@@ -30,8 +33,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
...
@@ -30,8 +33,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class
NestThermostat
(
ClimateDevice
):
class
NestThermostat
(
ClimateDevice
):
"""
Representation of a Nest thermostat.
"""
"""
Representation of a Nest thermostat.
"""
def
__init__
(
self
,
structure
,
device
):
def
__init__
(
self
,
structure
,
device
,
temp_unit
):
"""
Initialize the thermostat.
"""
"""
Initialize the thermostat.
"""
self
.
_unit
=
temp_unit
self
.
structure
=
structure
self
.
structure
=
structure
self
.
device
=
device
self
.
device
=
device
...
@@ -134,7 +138,9 @@ class NestThermostat(ClimateDevice):
...
@@ -134,7 +138,9 @@ class NestThermostat(ClimateDevice):
def
set_temperature
(
self
,
**
kwargs
):
def
set_temperature
(
self
,
**
kwargs
):
"""
Set new target temperature.
"""
"""
Set new target temperature.
"""
temperature
=
kwargs
.
get
(
ATTR_TEMPERATURE
)
temperature
=
convert_temperature
(
kwargs
.
get
(
ATTR_TEMPERATURE
),
self
.
_unit
,
TEMP_CELSIUS
)
_LOGGER
.
debug
(
"
Nest set_temperature-input-value=%s
"
,
temperature
)
if
temperature
is
None
:
if
temperature
is
None
:
return
return
if
self
.
device
.
mode
==
'
range
'
:
if
self
.
device
.
mode
==
'
range
'
:
...
@@ -142,6 +148,7 @@ class NestThermostat(ClimateDevice):
...
@@ -142,6 +148,7 @@ class NestThermostat(ClimateDevice):
temperature
=
(
temperature
,
self
.
target_temperature_high
)
temperature
=
(
temperature
,
self
.
target_temperature_high
)
elif
self
.
target_temperature
==
self
.
target_temperature_high
:
elif
self
.
target_temperature
==
self
.
target_temperature_high
:
temperature
=
(
self
.
target_temperature_low
,
temperature
)
temperature
=
(
self
.
target_temperature_low
,
temperature
)
_LOGGER
.
debug
(
"
Nest set_temperature-output-value=%s
"
,
temperature
)
self
.
device
.
target
=
temperature
self
.
device
.
target
=
temperature
def
set_operation_mode
(
self
,
operation_mode
):
def
set_operation_mode
(
self
,
operation_mode
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment