Skip to content

Commit

Permalink
Support for seat/steering wheel heater requests (#116)
Browse files Browse the repository at this point in the history
* Add set_seat_heater and set_steering_wheel_heater

* Add tests for seat and steering wheel heaters
  • Loading branch information
jor-dan authored and timdorr committed Feb 24, 2019
1 parent b7f6fa9 commit 9c42c88
Show file tree
Hide file tree
Showing 4 changed files with 220 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/tesla_api/vehicle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ def cancel_software_update
command('cancel_software_update')['response']
end

def set_seat_heater(heater, level)
command('remote_seat_heater_request', body: {heater: heater, level: level})['response']
end

def set_steering_wheel_heater(on)
command('remote_steering_wheel_heater_request', body: {on: on})['response']
end

private

def data_request(name)
Expand Down
100 changes: 100 additions & 0 deletions spec/cassettes/vehicle-seat_heater_request.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

100 changes: 100 additions & 0 deletions spec/cassettes/vehicle-steering_wheel_heater_request.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions spec/lib/tesla_api/vehicle_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -317,4 +317,16 @@
expect(vehicle.cancel_software_update['result']).to eq(true)
end
end

describe '#seat_heater_request', vcr: {cassette_name: 'vehicle-seat_heater_request'} do
it 'turns off the driver seat heater' do
expect(vehicle.set_seat_heater(1, 0)['result']).to eq(true)
end
end

describe '#steering_wheel_heater_request', vcr: {cassette_name: 'vehicle-steering_wheel_heater_request'} do
it 'turns off the steering wheel heater' do
expect(vehicle.set_steering_wheel_heater(false)['result']).to eq(true)
end
end
end

0 comments on commit 9c42c88

Please sign in to comment.