Fibaro HC3 - Scene activate

Hello dear community, I have been trying to to program a button to activate Scene in Fibaro HC3.
I think I am doing something wrong/misunderstanding.
This what I am doing.
Add button
Create a event trigger
Action is > DataAction > Binding is tvroomtest.Scene
Operator =
Value Execute ( found this on Fibaro forum ) I have also tried Start, ON, Active and some more strange things.
When I go Live I get the error "Response status does not indicate success: 501 (Not Implemented).

I have tried to watch the support videos and other documents and I am unable to find out what I am doing wrong.

Here is a link to Fibaro HC3 API scene discussion.

Attached are image of what I am doing.



This is a problem. The Home Remote handles that internally & will always send “start”. It does exactly what that user is doing in the 1st post. Also looks like the HTTP command now needs to be a POST instead of a GET. I’m honestly not sure what’s the best way to fix this. If possible, I’d like to be able to automatically detect which command needs to be sent. The other day I had you email me the “devices” response. Can you send me the “scenes” response?
http://IPADDRESS/api/scenes

You typically don’t need to supply any value to the DataAction. If you look at the SceneTile.xaml file, the Run button leaves that option blank. This is again going to require an app update.

Hello Bill, thanks for your response.
I have emailed you txt file as requested.

Thanks, I just looked at it. I do see the “type” field is different. For HC2 scenes they are typically “com.fibaro.luaScene”.

Can you test this plugin?

Import it into your project or a new one. It’ll prompt you for your Fibaro IP Address & Id for any one of your scenes. It’ll default to 14 which is your Rigning prufa scene. Then try to trigger it by writing to the Scene attribute.

Does this work?

FibaroHC3_SceneTest.plugin (884 Bytes)

plugin.Name = "FibaroHC3_SceneTest";
plugin.OnChangeRequest = onChangeRequest;
plugin.OnConnect = onConnect;
plugin.OnDisconnect = onDisconnect;
plugin.OnPoll = onPoll;
plugin.OnSynchronizeDevices = onSynchronizeDevices;
plugin.PollingInterval = -1;
plugin.DefaultSettings = { "Host": "192.168.1.100", "SceneId": "14" };

var http = new HTTPClient();

var baseUrl;

function onChangeRequest(device, attribute, value) {
    http.post("http://" + plugin.Settings["Host"] + "/api/scenes/" + device.Id + "/execute", {});
}

function onConnect() {
}

function onDisconnect() {
}

function onPoll() {
}

function onSynchronizeDevices() {
    var scene = new Device();
    scene.Id = plugin.Settings["SceneId"];
    scene.DisplayName = "Fibaro Scene";
    scene.Capabilities = ["Scene"];
    scene.Attributes = [];
    plugin.Devices[scene.Id] = scene;
}

Hello Bill, can you give me more detailed instructions how I can test this?
I am new to this so my skills are basic level.

Might be User and pass problem.

I have added to the plugin user and pass.
Still get the same error as above “401”

Did you update the HTTP POST to include the credentials?

It should look like this:

function onChangeRequest(device, attribute, value) {
    http.post("http://" + plugin.Settings["Username"] + ":" + plugin.Settings["Password"] + "@" + plugin.Settings["Host"] + "/api/scenes/" + device.Id + "/execute", {});
}

I have change the plugin to this.
Notice for this post I have made pw as xxxx

Now I get this error.

image

Here is is the code.

plugin.Name = “FibaroHC3_SceneTest”;
plugin.OnChangeRequest = onChangeRequest;
plugin.OnConnect = onConnect;
plugin.OnDisconnect = onDisconnect;
plugin.OnPoll = onPoll;
plugin.OnSynchronizeDevices = onSynchronizeDevices;
plugin.PollingInterval = -1;
plugin.DefaultSettings = { “Host”: “192.168.1.222”, “SceneId”: “14” };

var http = new HTTPClient();

var baseUrl;

function onChangeRequest(device, attribute, value) {
http.post(“http://” + plugin.Settings[“Username”] + “admin” + plugin.Settings[“Password”] + “XXXXXX” + plugin.Settings[“192.168.1.222”] + “/api/scenes/” + device.Id + “/execute”, {});
}

function onConnect() {
}

function onDisconnect() {
}

function onPoll() {
}

function onSynchronizeDevices() {
var scene = new Device();
scene.Id = plugin.Settings[“SceneId”];
scene.DisplayName = “Fibaro Scene”;
scene.Capabilities = [“Scene”];
scene.Attributes = [];
plugin.Devices[scene.Id] = scene;
}

That’s not using the onChangeRequest revision I shared with you a little bit ago. If you already set the username & password in Settings then there’s no need for you to enter them again in onChangeRequest. From that screenshot you shared with me showed that you had added Username & Password Settings. So I just made a revision to use those new settings you created.

If you don’t want to use plugin Settings then just hardcode the URL like this:

function onChangeRequest(device, attribute, value) {
    http.post("http://admin:XXXXXX@192.168.1.222/api/scenes/" + device.Id + "/execute", {});
}

I think we are getting there.

Now I get this error.

I don’t know. I think we might have to get help from Fibaro on this one. I’m kind of playing the guessing game here. I’ll see if I can get my hands on an HC3 to test. Although it doesn’t look like it is even available here in the US yet.

If it helps I can set up TeamViewer PC for you and you get play along with my HC3.
I have a spair pc that can be running with TeamViewer so you can login when ever it fits you.

Try sending the command in CURL & then post your results in that Fibaro forum. Someone in that community should be able to answer this question or at least be able to direct us to the docs we need.

Can you try this CURL command that I sent @rhalbheer earlier?

It looks like we may have found what data needs to be passed in. Although, he’s seeing a 403 error which is a little different than what you were seeing.

Sorry for my ignorance but I have no Idea how to add the verbose option.
Do I add it to the plugin?
if yes just anywhere or after any other syntax?
and should I replace the username and password to the current one does it pick it up in the “defaultSettings”

If it is not in the plugin, where and how.

I am sorry not knowing how use this :slight_smile:

Just use the Windows Command Prompt

I have send you screen shot of the CMD respond.
It get a error.

{“type”:“ERROR”,“reason”:“JSON_PARSE_ERROR”,“message”:“Invalid value.”}* Connection #0 to host 192.168.1.222 left intact

More details in email screenshoot

You tried to run a scene that doesn’t exist. 25 was from the example I shared with Roger. It looks like 14,63,64,66,67,68,72,73,74,75,etc. Pick 1 of those or try a couple.

I did change it to ID14 just right after… I just send the wrong screensshoot. new one is on the way in email

Sorry . :upside_down_face: