This object is in archive! 

HIDDEN FEATURE!!! - https link for virtual switch

Attila Hajdu shared this idea 7 years ago
Completed

Hi Everyone,


Today I discovered a hidden feature in the system that I have read lots of topics. We all know that virtual switches don't have https link in the web ui. This feature could be useful in many scenarios.


I have discovered how to get this link. Tutorial:

1. see the sample virtual switch (in my case Onkyo Radio)

1f9338a790610edcef3bd18b3f822331

2. Go to API and Virtual endpoints. Expand the first option (get all virtual endpoints and hit Try it out!

8e8f969d27b9a0d874ab12358e88e944

3. in the response locate the virtual switch and copy the url link

56bca4377bf6a945b6fce295cb876fe2

4. Now past this into the browser and you get a response like this

6c137589f90f9b5066c60c023e2cc474

5. Now copy the URL link in the response and add state 1 or 0 at the end. Paste it in the browser and voila. It works. You get response like this

dac4a99889c50888e7040294eda92913

6. The switch turned on

f6410496c3b0f26325679a1997f76ee3


Please note, for some reason I have another switch but that one does not seem to have a https link for creating state change. That other switch is added to the thermostat as output device where the onkyo radio is not. Not sure whether this have any relation between eachother but just to let you know.


I have created a test virtual switch and can confirm that I was able to locate the url link.


Good luck with this "new" and much demanded functionality.


Give this a vote if you like it.


Happy day.

Replies (11)

photo
1

Great!


...how did to create the link with the onkyo? :)

photo
1

What do you mean?

photo
1

I see a virtual switch to control the volume.

photo
1

That slider is tied to a rule with 7 steps of volume.

photo
1

can you also show the http request please?

photo
1

Sure. But please be aware that I have a nas that is running as a php webserver and is translating the command from zipato to onkyo. My onkyo had 1.10 at the end of my IP. 1.14 is my NAS address.


http://192.168.1.14/onkyo.php?command=MVL¶ms=20 (20 is the desired volume).

photo
1

Attached the php text below. Add this into notepad, change the IP address to your onkyo ip address inside the code and save the file with extension .php. The file is inside a folder in the PHP webserver on my qnap nas.


  1. <?php
  2. $command = $_GET['command'];
  3. $params = $_GET['params'];
  4. $hostname = '192.168.1.10';
  5. $port = 60128;
  6. switch ($command)
  7. {
  8. case 'PWR':
  9. case 'AMT':
  10. case 'NTC':
  11. case 'SLI':
  12. case 'TUN':
  13. $message = '!1' . $command . $params;
  14. break;
  15. case 'MVL':
  16. if ($params > 60)
  17. exit(1);
  18. $message = '!1' . $command . strtoupper(str_pad(dechex($params), 2, '0', STR_PAD_LEFT));
  19. break;
  20. default:
  21. exit(1);
  22. }
  23. print $message;
  24. $fp = pfsockopen($hostname, $port);
  25. $packet = "ISCP\x00\x00\x00\x10\x00\x00\x00" . chr(strlen($message) + 1) . "\x01\x00\x00\x00" . $message . "\x0D";
  26. fwrite($fp, $packet);
  27. fclose($fp);
  28. ?>

photo
1

Thank you, I have an Integra but they use the same control codes.


Works perfekt..

photo
photo
1

You can get exact that same info when you go to MODULE MANAGER - VIRTUAL - SWITCH XYC - STATE - click the settings link and you will see the URL there as well.

photo
1

I don't see this. Only with meters.

photo
1

Exactly. Only sensors have URL link. This is why this is a "hidden feature".

photo
photo
1

Thanks a lot for sharing!!!

photo
1

Attila,

did you really managed to use this with new created virtual switch ?

For me that works only with old virtual switches. I am sure that this functionality was available with first fw versions...

photo
1

Yes I did. I deliberately created a new switch and tested the API. It did have the link and it was working. This was 3 days ago.

Currently my zipatile is offline and when tried to test the functionality, it does not work. I have just now created a switch and did manage to get url link for state change, however when using the link it does not work. I wonder if it because my zipatile is offline or for other reasons. I will be able to report back once I get home.

photo
1

I just created a new switch and looks like the device descriptor changed, now there is no URL. It looks like this;

photo
1

This is indeed very strange. I created a switch and i do get a link. See attached. There must be something different between us Alberto.

nevertheless when I use the link and hit 1 or 0, the change does not go though to the system. Im unsure if this is because my zipatile is currently offline or not, but I will investigate it.


On the other side I have one switch that has same response as you and I dont know what is the difference between the one I have link and the one I have not.

photo
1

I have tried with both my zipatile and zipabox and both switches are missing the url. This indeed is very strange, what firmware are you on??

photo
1

Also all my controllers just went online, maybe Zipato servers are down?

photo
1

Im on 1.1.35. But I think this should not be dependent on the firmware version. Perhaps on the fact on what server you are logged into. I don't know.

Only zipato knows the true story and because this feature is not officially supported, we cannot even get it fixed...

photo
1

Ok Alberto. Now the zipatile is back online. Tested the switch with the link and it works.

On the other hand:

The fact that while zipatile was offline the link did not work (i got positive response as below, but in the web ui was no change) means that the virtual switch is located on zipatile and not in the server. What I dont understand is that: while zipatile was offline, what did respond? and why on the web ui was no change, if there was a response. Or if the switch is on the zipatile, then why there was no change in the web ui if the cloud did respond.... guess only zipato knows the answer.

10534dcfeb46c07d67ed25cbf3739f22

photo
1

Did see the same issue. Tried some of your ideas and it did not work. Only virtual meters do.

photo
1

Please check if you can change state of any newly created virtual sensor after upgrade to 1.1.35. All sensors I created recently show guid in web browser but no sensor state change works. In the same time sensors created few weeks ago work fine. So maybe it's not a matter of switch but general failure of virtual devices created after firmware upgrade 1.1.35

photo
1

Yes I confirm that method described above works. You can change state of virtual switches from outside zipabox using URL. But it doesn't work for switches created since firmware update 1.1.35 as no virtual devices work after that update and all all rules that act on those devices are terminated.

photo
1

Can you please elaborate on "since firmware update 1.1.35 no virtual devices work and all rules that act on those devices are terminated", as this may help me understand why some rules seem not to be working as expected.

photo
1

I have several virtual devices - switches and sensors. Since I upgraded to FW 1.1.35 about 1 week ago, no virtual devices created since that time work. I can turn them on i web ui but with no result in the box, ie. after reloading web ui they are still off, no STATE history is registered for them and no rules are triggered by them. In other words this state change is fake as zipabox doesn't do anything except move slider from OFF to ON after click.


Second symptom is that when you use such virtual device in a rule it makes rule fail on action block with that virtual device - such rule is terminated. But rules on devices created on previous firmware 1.1.17 still work.

If you have such symptoms, open the ticket. I have done it, but the more people report problem the better chance they will fix that. This is serious problem.

photo
1

To be more specific with "rules are terminated" - if the rule consists of steps:


When motion sensor is Active

1. Turn on light

2. Turn on a virtual device created after 1.1.35 upgrade

3. Do HTTP request with notification

4. Move up a shutter


Then result you get is a light turned on but no notification, shutter still closed and no virtual device state change.

photo
photo
1

@Alberto indeed there is strange thing, as I have created two http ONOFF devices and one of them has URL attribute and second doesn't. Second one has been created more recently, so Zipato probably removed URL property from virtual switches in FW 1.1.17. This is very unfortunate as previously created switches still have this possibility (of which I didn't know) and now we still have to create 2 devices (sensor and actuator) and build rules to sync them together instead of having one switch with possibility to turn it remotely via URL.

photo
1

Just to confirm the score on my end. I upgraded zipatile to 1.1.38 this morning. I can see that I have as it shows on the dashboard (I had 1.1.35 before).

Just created a switch and it has the link. I have even tried to turn it on and off and it works. So this cannot be a simple firmware related thing.

photo
1

It's been almost a month since I can't operate (change state) newly created virtual endpoints and I don't see new posts related to this issue on this forum - are there many people who contacted support or have this issue resolved by Zipato support? Please comment how you resolved that issue.

photo
1

I confirm a pattern of old switches having the URL and newer ones not having it.

photo
1

Just sharing what I tried without success :(


If I look up a virtual switch that is working with a get /virtualEndpoints/{uuid}/config, the response is

{ "className": "com.zipato.network.virtual.http.HttpEndpoint", "hidden": false, "descriptorFlags": null, "description": "", "type": null, "uuid": "fac5bf56-b229-444b-aa4c-535c07b1799c", "room": null, "tags": null, "hiddenRules": false, "uiData": "{\"attributes\":{\"STATEurl\":[{\"name\":\"https://my.zipato.com/zipato-web/v2/virtualEndpoints/fac5bf56-b229-444b-aa4c-535c07b1799c/remoting/attribute/set?apiKey=xxxxxxxx&serial=xxxxxxxxxxx&ep=fac5bf56-b229-444b-aa4c-535c07b1799c&STATE=\"}],\"apiKeys\":{\"xxxxxxxxxxx\":\"\"},\"state\":[{\"name\":\"STATE\"}]}}", "name": "Maison occupée", "category": null, "status": null, "order": null}


If I look up a virtual switch that is NOT working with a get /virtualEndpoints/{uuid}/config, the response is

{ "className": "com.zipato.network.virtual.http.HttpEndpoint", "hidden": false, "descriptorFlags": null, "description": "", "type": null, "uuid": "a2639f5a-a5bc-4ea8-a5cd-5db29281e3a2", "room": 50120, "tags": null, "hiddenRules": false, "uiData": "{\"attributes\":{\"apiKeys\":{\"xxxxxxxx\":\"\"}}}", "name": "Ampli", "category": null, "status": null, "order": null}


There is a difference in uiData as the working swith has a url and not the non working one.

If I try then to do a put on the wrong switch by reusing the response of the working switch and the URL I am told to use from the non working swich, I am successfully able to update the config of the non working virtual switch to be aligned with the config of the working switch, but it still doesn't work !

This is the JSON I put for my non working switch

{

"className": "com.zipato.network.virtual.http.HttpEndpoint",

"hidden": false,

"descriptorFlags": null,

"description": "",

"type": null,

"uuid": "a2639f5a-a5bc-4ea8-a5cd-5db29281e3a2",

"room": 50120,

"tags": null,

"hiddenRules": false,

"uiData": "{\"attributes\":{\"STATEurl\":[{\"name\":\"https://my.zipato.com/zipato-web/v2/virtualEndpoints/a2639f5a-a5bc-4ea8-a5cd-5db29281e3a2/remoting/attribute/set?apiKey=xxxxxxxxxx&serial=xxxxxxxx&ep=a2639f5a-a5bc-4ea8-a5cd-5db29281e3a2&STATE=\"}],\"apiKeys\":{\"xxxxxxxxxxxxxxx\":\"\"},\"state\":[{\"name\":\"STATE\"}]}}",

"name": "Ampli",

"category": null,

"status": null,

"order": null

}


I suspect the solution is to change the settings of AttributeUrls, so that will be my next investigation. I need to find the rigth API for that.

photo
photo
1

I'm just trying this out now to set up IFTTT -> Alexa -> Zipato


For state, are only "on" and "off" valid, or also "toggle", or something like that?

Leave a Comment
 
Attach a file