Search code examples
sonos

Sonos SMAPI integration issues


I'm creating the SMAPI service for Sonos and faced a couple of issues that I can't resolve - cannot create the integration with http endpoint and cannot get any traffic at the endpoint even if the integration is successful.

Here are the details:

  1. I cannot create the integration using http endpoint, this is the example of integration settings:
{
  "multi-account-disabled" : false,
  "preinstalled" : false,
  "id" : "c220b753-20c3-4479-90a8-b23fda6e3ddb",
  "availability-restrictions" : {
    "environments" : [ "PROD" ],
    "sonos-accounts" : [ {
      "id" : 119494282,
      "environment" : "PROD"
    } ],
    "regions" : [ ]
  },
  "distribution-type" : "DEVELOPMENT",
  "api-endpoints" : {
    "soap" : {
      "version" : "1.1",
      "route" : "http://djche.synology.me/customradio"
    }
  },
  "resource-types" : [ ],
  "commercial" : false,
  "deprecated-features" : {
    "get-user-info-disabled" : true
  },
  "brand-assets" : {
    "logo" : [ {
      "name" : "Logo-browser_updated_FILL0_wght100_GRAD0_opsz48.svg",
      "image" : "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iNDgiPjxwYXRoIGQ9Ik0zMDgtMTcydi01NGwzMC0zMEgxODZxLTIyLjc3NSAwLTM4LjM4Ny0xNS42MTJRMTMyLTI4Ny4yMjUgMTMyLTMxMHYtNDI0cTAtMjIuNzc1IDE1LjYxMy0zOC4zODhRMTYzLjIyNS03ODggMTg2LTc4OGgzMzR2MjJIMTg2cS0xMiAwLTIyIDEwdC0xMCAyMnY0MjRxMCAxMiAxMCAyMnQyMiAxMGg1ODhxMTIgMCAyMi0xMHQxMC0yMnYtMTMwaDIydjEzMHEwIDIyLjc3NS0xNS42MTIgMzguMzg4UTc5Ni43NzUtMjU2IDc3NC0yNTZINjIybDMwIDMwdjU0SDMwOFptMzM3LTIyMUw0ODQtNTU0bDE2LTE2IDEzNCAxMzZ2LTM1NGgyMnYzNTRsMTM0LTEzNiAxNiAxNi0xNjEgMTYxWiIvPjwvc3ZnPg==",
      "content-type" : "image/svg+xml"
    } ],
    "icon" : [ {
      "max-scale" : {
        "width" : 400,
        "height" : 400
      },
      "name" : "IconSVG-browser_updated_FILL0_wght100_GRAD0_opsz48.svg",
      "image" : "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iNDgiPjxwYXRoIGQ9Ik0zMDgtMTcydi01NGwzMC0zMEgxODZxLTIyLjc3NSAwLTM4LjM4Ny0xNS42MTJRMTMyLTI4Ny4yMjUgMTMyLTMxMHYtNDI0cTAtMjIuNzc1IDE1LjYxMy0zOC4zODhRMTYzLjIyNS03ODggMTg2LTc4OGgzMzR2MjJIMTg2cS0xMiAwLTIyIDEwdC0xMCAyMnY0MjRxMCAxMiAxMCAyMnQyMiAxMGg1ODhxMTIgMCAyMi0xMHQxMC0yMnYtMTMwaDIydjEzMHEwIDIyLjc3NS0xNS42MTIgMzguMzg4UTc5Ni43NzUtMjU2IDc3NC0yNTZINjIybDMwIDMwdjU0SDMwOFptMzM3LTIyMUw0ODQtNTU0bDE2LTE2IDEzNCAxMzZ2LTM1NGgyMnYzNTRsMTM0LTEzNiAxNiAxNi0xNjEgMTYxWiIvPjwvc3ZnPg==",
      "content-type" : "image/svg+xml"
    } ],
    "badge" : [ {
      "name" : "BadgeSVG-browser_updated_FILL0_wght100_GRAD0_opsz48.svg",
      "image" : "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgLTk2MCA5NjAgOTYwIiB3aWR0aD0iNDgiPjxwYXRoIGQ9Ik0zMDgtMTcydi01NGwzMC0zMEgxODZxLTIyLjc3NSAwLTM4LjM4Ny0xNS42MTJRMTMyLTI4Ny4yMjUgMTMyLTMxMHYtNDI0cTAtMjIuNzc1IDE1LjYxMy0zOC4zODhRMTYzLjIyNS03ODggMTg2LTc4OGgzMzR2MjJIMTg2cS0xMiAwLTIyIDEwdC0xMCAyMnY0MjRxMCAxMiAxMCAyMnQyMiAxMGg1ODhxMTIgMCAyMi0xMHQxMC0yMnYtMTMwaDIydjEzMHEwIDIyLjc3NS0xNS42MTIgMzguMzg4UTc5Ni43NzUtMjU2IDc3NC0yNTZINjIybDMwIDMwdjU0SDMwOFptMzM3LTIyMUw0ODQtNTU0bDE2LTE2IDEzNCAxMzZ2LTM1NGgyMnYzNTRsMTM0LTEzNiAxNiAxNi0xNjEgMTYxWiIvPjwvc3ZnPg==",
      "content-type" : "image/svg+xml"
    } ]
  },
  "integration-id" : "org.djche.customradio",
  "websites" : {
    "home" : "https://astv.djche.org"
  },
  "poll-interval-default" : 60,
  "request-header-device-cert" : false,
  "playlist-editing-enabled" : false,
  "page-size-default" : 100,
  "alarm-use-disabled" : false,
  "disabled" : false,
  "name" : "Custom Radio",
  "authentication" : "ANONYMOUS",
  "string-resources" : {
    "en-US" : {
      "common" : {
        "explicit-filter-description" : "We do not filter or restrict any content because it's always provided by user itself",
        "service-promo" : "Welcome to Custom Radio!",
        "service-summary" : "Listen to your favorite radio streams with Custom Radio",
        "service-description" : "Custom Radio allow users to add custom radio streams from URLs. Individual streams and playlists are supported."
      }
    }
  }
}

And when I click Send I'm getting message ICS has found errors in your Service Configuration Object with the following details:

{
  "validation-errors" : [ {
    "value" : "http://djche.synology.me/customradio",
    "propertyPath" : "api-endpoints.soap.route",
    "property" : "route",
    "name" : "JsonValidatorPropertyValueError"
  } ],
  "reason" : "An error occurred while validating the service configuration. JSON validation failed",
  "errorCode" : "BadRequestError"
}

If I use https version of the endpoint - integration is accepted immediately, here is the response:

{
  "websites" : {
    "home" : "https://astv.djche.org/"
  },
  "supported-features" : [ ],
  "string-resources" : {
    "en-US" : {
      "common" : {
        "service-promo" : "Welcome to Custom Radio!",
        "service-summary" : "Listen to your favorite radio streams with Custom Radio",
        "service-disabled" : "This service is no longer available. Please remove it from your Sonos app.",
        "service-description" : "Custom Radio allow users to add custom radio streams from URLs. Individual streams and playlists are supported.",
        "explicit-filter-description" : "We do not filter or restrict any content because it's always provided by user itself"
      }
    }
  },
  "stream-quality-badge-options" : [ ],
  "service-id" : "196103",
  "resource-types" : [ ],
  "request-header-device-cert" : false,
  "preinstalled" : false,
  "poll-interval-default" : 60,
  "playlist-editing-enabled" : false,
  "page-size-default" : 100,
  "name" : "Custom Radio",
  "multi-account-disabled" : false,
  "integration-id" : "org.djche.customradio",
  "id" : "c220b753-20c3-4479-90a8-b23fda6e3ddb",
  "distribution-type" : "DEVELOPMENT",
  "disabled" : false,
  "deprecated-features" : {
    "use-manifest-file-disabled" : false,
    "request-header-playerid-disabled" : false,
    "request-header-context-disabled" : false,
    "request-header-auth-disabled" : false,
    "report-playback-duration-enabled" : false,
    "report-playback-complete-enabled" : false,
    "report-playback-context-enabled" : false,
    "report-media-actions-disabled" : false,
    "report-account-creation-disabled" : false,
    "get-user-info-disabled" : true,
    "extended-metadata-streams-disabled" : false,
    "extended-metadata-playlists-disabled" : false,
    "extended-metadata-disabled" : false,
    "explicit-content-filtering-disabled" : false,
    "add-favorites-tracks-enabled" : false,
    "add-favorites-artists-enabled" : false,
    "add-favorites-albums-enabled" : false
  },
  "commercial" : false,
  "brand-assets" : {
    "stream-quality" : [ ],
    "logo" : [ {
      "uri" : "https://integration-image-assets.ws.sonos.com/org.djche.customradio/c220b753-20c3-4479-90a8-b23fda6e3ddb/logo-browser_updated_fill0_wght100_grad0_opsz48.svg",
      "name" : "logo-browser_updated_fill0_wght100_grad0_opsz48.svg",
      "content-type" : "image/svg+xml"
    } ],
    "icon" : [ {
      "uri" : "https://integration-image-assets.ws.sonos.com/org.djche.customradio/c220b753-20c3-4479-90a8-b23fda6e3ddb/iconsvg-browser_updated_fill0_wght100_grad0_opsz48.svg",
      "name" : "iconsvg-browser_updated_fill0_wght100_grad0_opsz48.svg",
      "max-scale" : {
        "height" : 400,
        "width" : 400
      },
      "content-type" : "image/svg+xml"
    } ],
    "badge" : [ {
      "uri" : "https://integration-image-assets.ws.sonos.com/org.djche.customradio/c220b753-20c3-4479-90a8-b23fda6e3ddb/badgesvg-browser_updated_fill0_wght100_grad0_opsz48.svg",
      "name" : "badgesvg-browser_updated_fill0_wght100_grad0_opsz48.svg",
      "content-type" : "image/svg+xml"
    } ]
  },
  "availability-restrictions" : {
    "sonos-accounts" : [ {
      "id" : 119494282,
      "environment" : "PROD"
    } ],
    "regions" : [ ],
    "environments" : [ "PROD" ],
    "beta-groups" : [ ]
  },
  "authentication" : "ANONYMOUS",
  "api-endpoints" : {
    "soap" : {
      "version" : "1.1",
      "route" : "https://djche.synology.me/customradio"
    }
  },
  "alarm-use-disabled" : false
}

Why http endpoint is not accepted?

And here comes the 2nd question:

  1. Both endpoints are accessible, https is using valid Let'sEncrypt certificate, but I'm not getting any traffic from my Sonos system even if the integration is accepted (https mode) - service application log is not showing any incoming requests.

At the same time, requests from SoapUI or just from browser are displayed immediately.

All port mappings and firewall settings are ok. All clients - Sonos, SoapUI, devices with browsers - are in the same network, as well as the SMAPI endpoint.

What can block the traffic from my Sonos system if it's passing ok from other clients?


Solution

  • SSL is now a requirement of the content service API, so you need to provide a HTTPS URL, not a HTTP one.