Class: TeslaAPI::ClimateState

Inherits:
Data
  • Object
show all
Defined in:
lib/tesla-api/climate_state.rb

Overview

Defines the climate state of the vehicle.

Instance Method Summary collapse

Methods inherited from Data

#inspect, #ivar_from_data, #method_missing, #respond_to_missing?

Constructor Details

#initialize(data) ⇒ Boolean

Returns if the fan is on.



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/tesla-api/climate_state.rb', line 41

def initialize(data)
  ivar_from_data("inside_temp_celcius",            "inside_temp",            data)
  ivar_from_data("outside_temp_celcius",           "outside_temp",           data)
  ivar_from_data("driver_temp_setting_celcius",    "driver_temp_setting",    data)
  ivar_from_data("passenger_temp_setting_celcius", "passenger_temp_setting", data)
  ivar_from_data("fan_speed",                      "fan_speed",              data)

  @auto_conditioning_on   = !!data["is_auto_conditioning_on"]
  @front_defroster_on     = !!data["is_front_defroster_on"]
  @rear_defroster_on      = !!data["is_rear_defroster_on"]
  @fan_on                 = !data["fan_status"].nil?
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class TeslaAPI::Data

Instance Method Details

#auto_conditioning_on?Boolean

Returns if auto air conditioning is on.

Returns:

  • (Boolean)

    if auto air conditioning is on



# File 'lib/tesla-api/climate_state.rb', line 25

#driver_temp_setting_celciusFloat

Returns Temperature (celcius) the driver has set.

Returns:

  • (Float)

    Temperature (celcius) the driver has set



# File 'lib/tesla-api/climate_state.rb', line 13

#fan_on?Boolean

Returns if the fan is on.

Returns:

  • (Boolean)

    if the fan is on



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/tesla-api/climate_state.rb', line 41

def initialize(data)
  ivar_from_data("inside_temp_celcius",            "inside_temp",            data)
  ivar_from_data("outside_temp_celcius",           "outside_temp",           data)
  ivar_from_data("driver_temp_setting_celcius",    "driver_temp_setting",    data)
  ivar_from_data("passenger_temp_setting_celcius", "passenger_temp_setting", data)
  ivar_from_data("fan_speed",                      "fan_speed",              data)

  @auto_conditioning_on   = !!data["is_auto_conditioning_on"]
  @front_defroster_on     = !!data["is_front_defroster_on"]
  @rear_defroster_on      = !!data["is_rear_defroster_on"]
  @fan_on                 = !data["fan_status"].nil?
end

#fan_speedInteger

Returns 0 to 6 (or nil).

Returns:

  • (Integer)

    0 to 6 (or nil)



# File 'lib/tesla-api/climate_state.rb', line 21

#front_defroster_on?Boolean

Returns if the front defroster is on.

Returns:

  • (Boolean)

    if the front defroster is on



# File 'lib/tesla-api/climate_state.rb', line 29

#inside_temp_celciusFloat

Returns Temperature (celcius) inside the vehicle.

Returns:

  • (Float)

    Temperature (celcius) inside the vehicle



# File 'lib/tesla-api/climate_state.rb', line 5

#outside_temp_celciusFloat

Returns Temperature (celcius) outside the vehicle.

Returns:

  • (Float)

    Temperature (celcius) outside the vehicle



# File 'lib/tesla-api/climate_state.rb', line 9

#passenger_temp_setting_celciusFloat

Returns Temperature (celcius) the passenger has set.

Returns:

  • (Float)

    Temperature (celcius) the passenger has set



# File 'lib/tesla-api/climate_state.rb', line 17

#rear_defroster_on?Boolean

Returns if the rear defroster is on.

Returns:

  • (Boolean)

    if the rear defroster is on



# File 'lib/tesla-api/climate_state.rb', line 33