Skip to content

Commit

Permalink
Merge pull request #1892 from SmartThingsCommunity/main
Browse files Browse the repository at this point in the history
Rolling Main to Beta 23-Jan
  • Loading branch information
lelandblue authored Jan 23, 2025
2 parents aa4ea43 + 7171fd3 commit e8cac23
Show file tree
Hide file tree
Showing 12 changed files with 1,225 additions and 48 deletions.
2 changes: 0 additions & 2 deletions drivers/SmartThings/jbl/profiles/jbl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ components:
enabledValues:
- 'playing'
- 'paused'
- 'stopped'
- key: "{{enumCommands}}"
enabledValues:
- 'play'
- 'pause'
- 'stop'
- id: mediaTrackControl
version: 1
- id: audioMute
Expand Down
11 changes: 10 additions & 1 deletion drivers/SmartThings/jbl/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ local function device_init(driver, device)

refresh(driver, device, nil)
device:set_field(fields._INIT, true, { persist = false })

device:emit_event(capabilities.mediaPlayback.supportedPlaybackCommands({
capabilities.mediaPlayback.commands.play.NAME,
capabilities.mediaPlayback.commands.pause.NAME,
}))

device:emit_event(capabilities.mediaTrackControl.supportedTrackControlCommands({
capabilities.mediaTrackControl.commands.nextTrack.NAME,
capabilities.mediaTrackControl.commands.previousTrack.NAME,
}))
end

local lan_driver = Driver("jbl",
Expand All @@ -204,7 +214,6 @@ local lan_driver = Driver("jbl",
[capabilities.mediaPlayback.ID] = {
[capabilities.mediaPlayback.commands.play.NAME] = jbl_capability_handler.playback_play_handler,
[capabilities.mediaPlayback.commands.pause.NAME] = jbl_capability_handler.playback_pause_handler,
[capabilities.mediaPlayback.commands.stop.NAME] = jbl_capability_handler.playback_stop_handler,
},
[capabilities.audioNotification.ID] = {
[capabilities.audioNotification.commands.playTrack.NAME] = jbl_capability_handler.audioNotification_handler,
Expand Down
3 changes: 2 additions & 1 deletion drivers/SmartThings/jbl/src/jbl/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local log = require "log"
local json = require "st.json"
local RestClient = require "lunchbox.rest"
local utils = require "utils"
local st_utils = require "st.utils"
local cosock = require "cosock"

local jbl_api = {}
Expand Down Expand Up @@ -68,7 +69,7 @@ function jbl_api.new_device_manager(bridge_ip, bridge_info, socket_builder)

return setmetatable(
{
headers = ADDITIONAL_HEADERS,
headers = st_utils.deep_copy(ADDITIONAL_HEADERS),
client = RestClient.new(base_url, socket_builder),
base_url = base_url,
}, jbl_api
Expand Down
5 changes: 0 additions & 5 deletions drivers/SmartThings/jbl/src/jbl/capability_handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ local function smartthings_playback_capability_handler(driver, device, capabilit
local st_status_to_jbl_playback_status_table = {
paused = "pause",
playing = "play",
stopped = "stop",
}

local conn_info = device:get_field(fields.CONN_INFO)
Expand All @@ -34,10 +33,6 @@ function capability_handler.playback_pause_handler(driver, device, args)
smartthings_playback_capability_handler(driver, device, "paused")
end

function capability_handler.playback_stop_handler(driver, device, args)
smartthings_playback_capability_handler(driver, device, "stopped")
end

function capability_handler.next_track_handler(driver, device, args)
local conn_info = device:get_field(fields.CONN_INFO)
log.info(string.format("media_track_control.next_track_handler : dni = %s", device.device_network_id))
Expand Down
1 change: 0 additions & 1 deletion drivers/SmartThings/jbl/src/jbl/device_manager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ end
local jbl_playback_state_to_smartthings_playback_status_table = {
paused = "paused",
playing = "playing",
stopped = "stopped",
}

function device_manager.handle_status(driver, device, status)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ test.register_message_test(
nil, -- creator_fabric_index
nil, -- last_modified_fabric_index
20, -- next_credential_index
nil, -- credential_data
im.InteractionResponse.Status.FAILURE
),
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: 3-button-battery-temperature-humidity
components:
- id: main
capabilities:
- id: temperatureMeasurement
version: 1
- id: relativeHumidityMeasurement
version: 1
- id: battery
version: 1
- id: firmwareUpdate
version: 1
- id: refresh
version: 1
categories:
- name: TempHumiditySensor
- id: button1
capabilities:
- id: button
version: 1
categories:
- name: RemoteController
- id: button2
capabilities:
- id: button
version: 1
categories:
- name: RemoteController
- id: button3
capabilities:
- id: button
version: 1
categories:
- name: RemoteController
preferences:
- preferenceId: tempOffset
explicit: true
- preferenceId: humidityOffset
explicit: true
deviceConfig:
dashboard:
states:
- component: main
capability: temperatureMeasurement
version: 1
group: main
composite: true
- component: main
capability: relativeHumidityMeasurement
version: 1
group: main
values:
- label: " {{humidity.value}} {{humidity.unit}}"
composite: true
actions: []
basicPlus: []
detailView:
- component: main
capability: temperatureMeasurement
version: 1
- component: main
capability: relativeHumidityMeasurement
version: 1
- component: main
capability: battery
version: 1
- component: main
capability: refresh
version: 1
- component: button1
capability: button
version: 1
- component: button2
capability: button
version: 1
- component: button3
capability: button
version: 1
automation:
conditions:
- component: main
capability: temperatureMeasurement
version: 1
- component: main
capability: relativeHumidityMeasurement
version: 1
- component: main
capability: battery
version: 1
- component: button1
capability: button
version: 1
- component: button2
capability: button
version: 1
- component: button3
capability: button
version: 1
actions: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: light-power-energy-powerConsumption
components:
- id: main
capabilities:
- id: switch
version: 1
- id: powerMeter
version: 1
- id: energyMeter
version: 1
- id: powerConsumptionReport
version: 1
- id: firmwareUpdate
version: 1
- id: refresh
version: 1
categories:
- name: Light
Loading

0 comments on commit e8cac23

Please sign in to comment.