Skip to content

Commit

Permalink
fix: Added modelName to status json
Browse files Browse the repository at this point in the history
Fixed: #124
  • Loading branch information
svrooij committed Dec 18, 2020
1 parent 6aa6e2a commit c2fd6b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/sonos-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Track, ChannelValue } from '@svrooij/sonos/lib/models'
*/
export interface SonosState extends SonosStateBase {
readonly uuid: string;
readonly model: string;
ts: number;
name: string;
groupName: string;
Expand Down
5 changes: 3 additions & 2 deletions src/sonos-to-mqtt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ export class SonosToMqtt {
* Will setup event handlers from sonos devices, and what to publish
*/
private setupSonosEvents(): void {
this.sonosManager.Devices.forEach(d => {
this.states.push({uuid: d.Uuid, name: d.Name, groupName: d.GroupName, coordinatorUuid: d.Coordinator.Uuid})
this.sonosManager.Devices.forEach(async (d) => {
const deviceDescription = await d.GetDeviceDescription();
this.states.push({uuid: d.Uuid, model: deviceDescription.modelName, name: d.Name, groupName: d.GroupName, coordinatorUuid: d.Coordinator.Uuid})
d.Events.on(SonosEvents.AVTransport, (data) => {
this.updateStateWithAv(d.Uuid, data);
this.mqtt.publish(`status/${this.topicId(d.Name, d.Uuid)}/avtransport`,data)
Expand Down

0 comments on commit c2fd6b9

Please sign in to comment.