Closed DubbyMcDubs closed 2 years ago
Hi, I also have a Sonos so may I can debug as well. Please share some prepared code so that I can try it on my own.
But general speaking: It should work 😄
Best regards Christian
Hi,
Thanks for replying. For clarity, I am not trying to control the Sonos, simply I want to get the events from the Symfonisk volume control from Ikea (https://www.ikea.com/au/en/p/symfonisk-sound-remote-white-40370481/)
Here is some rough test code I threw together:
Connecting:
try
{
var LConnectOptions = new CoapClientConnectOptionsBuilder()
.WithHost(INSERT_IP_ADDRESS_HERE)
.WithPort(INSERT_PORT_HERE)
.WithDtlsTransportLayer(o => o.WithPreSharedKey(INSERT_CLIENT_ID_HERE, INSERT_PSK_HERE))
.Build();
FCoapClient.ConnectAsync(LConnectOptions, CancellationToken.None).Wait();
MessageBox.Show("Connection Successful!");
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
Once connected:
class ResponseHandler : ICoapResponseHandler
{
public Form1 FForm1;
Task ICoapResponseHandler.HandleResponseAsync(HandleResponseContext context)
{
FForm1.AppendTextBox(Encoding.Default.GetString(context.Response.Payload));
return Task.CompletedTask;
}
}
public void AppendTextBox(string value)
{
if (InvokeRequired)
{
this.Invoke(new Action<string>(AppendTextBox), new object[] { value });
return;
}
textBox17.Text += value;
}
private void button6_Click(object sender, EventArgs e)
{
ResponseHandler LResponseHandler = new ResponseHandler();
LResponseHandler.FForm1 = this;
var observeOptions = new CoapObserveOptionsBuilder()
.WithPath("15001/" + INSERT_DEVICE_ID_HERE)
.WithResponseHandler(LResponseHandler)
.Build();
var observeResponse = FCoapClient.ObserveAsync(observeOptions, CancellationToken.None).Result;
}
Does this information help? I am guessing that to make it work we need to find the device ID of the gateway and bind the genLevelCtrl or LevelCtrl clusters between the device and gateway?
Sorry but I don't had the time to test it on my own. I hope to have a look at the weekend.
Hi. Any chance you have made any progress on thi? Cheers.
Sorry for the long delay. I do not have this device so I cannot reproduce the issue. But to me is sounds like a regular observation of messages. This feature is indeed supported by the library.
I created a test and subscribed to changes of a Tradfri Bulb and it works. Hope this helps.
Hi,
I have been trying to get the Ikea Tradfri Symfonisk device to report its events via Observe in this library. The device is connected sucessfully and I can ask the gateway for its details and it even send random updates using Observe, however it will not report click and rotation events.
A clue as to why may be in the following comment within the deconz project. The developer says:
"bind the client OnOff cluster to a group. And then the client Level Control cluster. After that, it now behaves normally, waking up to send commands on click and turn. " (https://github.com/dresden-elektronik/deconz-rest-plugin/issues/1898#issuecomment-535090364)
Is there the ability to do this in CoAPnet? I would really love to get this device working. So many uses for it.
Cheers!