Comments (19)
Based on the great input from @Ubiquitous-X above I will implement the switch and release a new beta so you can test and see what works or not :)
Will try to get that sorted during the weekend.
from sector.
Not really as I don't have Sector anymore and therefore no plugs either so unless I can work with someone who has and can borrow their account it's not being possible... And since it's an alarm we are taking about I feel pretty sure the chance someone handing their account to me is pretty slim.
from sector.
Thanks for your reply. I'm currently trying to develop this myself now with your code as base.
from sector.
If you learn which url's is used with parameters to control them then let me know and it's quite simple to add into the code as the switch platform.
from sector.
The url for checking plugs and get their ID´s and status is https://mypagesapi.sectoralarm.net/SmartPlugs/GetsmartPlugsForPanel
The url for switching them is https://mypagesapi.sectoralarm.net/SmartPlugs/SwitchSmartPlug
where you can send the id of the plug with the parameter on
or off
.
I made a fork from the sectoralarmlib by peroyvind where I get the ID´s of the plugs and switch them on or off. Maybe that is some help. https://github.com/Ubiquitous-X/sectoralarmlib
I should add that I am no programmer. I got it to work by copy/paste until it worked, so to say.
from sector.
thanks for the URL. Can't get it to work with aiohttp thou.
There are some differences between your (Ubiquitous-X) script and the (gjohansson-ST) custom component that I cannot figure out how it works
The base url is https://mypagesapi.sectoralarm.net vs https://mypagesapi.sectoralarm.net/api
/User/Login vs /Login/Login
If I access https://mypagesapi.sectoralarm.net and login and then uses the same browser session to access https://mypagesapi.sectoralarm.net/SmartPlugs/GetsmartPlugsForPanel?id=xxxxx it works.
When I try to access it thru aiohttp after successful login thru, https://mypagesapi.sectoralarm.net/api/Login/Login (I get 200 OK and auth token back), I can get tempratures and FullPanel eg everything except the SmartPlugs.
If I try https://mypagesapi.sectoralarm.net/SmartPlugs/GetsmartPlugsForPanel?id=xxxxx I get 401 unauthorized as response. There is no api/SmartPlugs/GetsmartPlugsForPanel?id=xxxxx.
Any tips on this?
Sorry if this is the wrong forum to discuss this.
from sector.
from sector.
Based on the great input from @Ubiquitous-X above I will implement the switch and release a new beta so you can test and see what works or not :) Will try to get that sorted during the weekend.
Wow! Many Thanks @gjohansson-ST !!!!
If of any use here is the Json response when accessing https://mypagesapi.sectoralarm.net/SmartPlugs/GetsmartPlugsForPanel?id=xxxxx&WithStatus=true
from sector.
Hi guys
Looking at this your lib that you refer too is using the webpage and not the api (which I am using).
Is there any chance you can do a MITM and see which url's and content is used when using the app instead?
Personally I use Charles but it cost money but also used https://docs.mitmproxy.org/stable/ in the past which is free (but more difficult to use).
Other alternative is of course to switch completely to use your lib instead and publish it as such.
What do you think?
from sector.
I believe I managed to sniff out the api call from the Sector app on my iPhone.
A GET request is made from the iOS app to https://mypagesapi.sectoralarm.net/api/Panel/GetSmartplugStatus?panelId=xxxxxxxx
. In the response the Id
SerialNo
and Status
of the smartplug(s) are delivered.
When I turn on the smartplug in the Sector app, a POST request is made to https://mypagesapi.sectoralarm.net/api/Panel/TurnOnSmartplug?switchId=xxxxxxx&panelId=xxxxxxxx
. The switchId
is the the same as the Id
in the first GET request.
And when I turn off the smartplug a POST request is made to https://mypagesapi.sectoralarm.net/api/Panel/TurnOffSmartplug?switchId=xxxxxxx&panelId=xxxxxxxx
Hope this makes it one step closer
from sector.
I believe I managed to sniff out the api call from the Sector app on my iPhone. A GET request is made from the iOS app to
https://mypagesapi.sectoralarm.net/api/Panel/GetSmartplugStatus?panelId=xxxxxxxx
. In the response theId
SerialNo
andStatus
of the smartplug(s) are delivered.When I turn on the smartplug in the Sector app, a POST request is made to
https://mypagesapi.sectoralarm.net/api/Panel/TurnOnSmartplug?switchId=xxxxxxx&panelId=xxxxxxxx
. TheswitchId
is the the same as theId
in the first GET request.And when I turn off the smartplug a POST request is made to
https://mypagesapi.sectoralarm.net/api/Panel/TurnOffSmartplug?switchId=xxxxxxx&panelId=xxxxxxxx
Hope this makes it one step closer
Lovely. Only thing missing is the json you get back. Did you get that?
from sector.
The json that is sent back after the GET request is:
[
{
"Consumption": "-1",
"DisplayScenarios": false,
"Id": "9xxxxx0",
"Label": "Smartplug",
"PanelId": null,
"SerialNo": "2xxxxxxxxxE",
"Scenarios": null,
"Status": "On",
"TimerActive": false,
"TimerEvents": null,
"TimerEventsSchedule": null
}
]
The panelId is null, as you see, but this is the returned call after a successful poll of status. The plugs aren't a part of the panel per se, and maybe thats why it is listed as null.
from sector.
The json that is sent back after the GET request is:
[ { "Consumption": "-1", "DisplayScenarios": false, "Id": "9xxxxx0", "Label": "Smartplug", "PanelId": null, "SerialNo": "2xxxxxxxxxE", "Scenarios": null, "Status": "On", "TimerActive": false, "TimerEvents": null, "TimerEventsSchedule": null } ]
The panelId is null, as you see, but this is the returned call after a successful poll of status. The plugs aren't a part of the panel per se, and maybe thats why it is listed as null.
Perfect. All I need.
Will get it sorted now.
Thanks
from sector.
Hi both
I have now released a new beta that should (if all works) introduce the switch platform.
I have rewritten so much of the code and since I can not test it I hope that you will. Please raise new issues for everything that doesn't work.
@Ubiquitous-X given that it seems you can get out what is sent etc. to Sector and based on above it seems as Sector has changed quite a bit on their api e.g. introducing new end-points.
Is it possible for you to provide a new full set of:
- url
- message header on post and get commands
- return json on post and get commands
You can send per e-mail if you wish and can do it.
Thanks
from sector.
AWSOME! I will start testing asap!
from sector.
I'm sure it will spit out all kind of errors I made all along the way here so obviously the best is if you check the logs, correct the code as you go and then feedback to me (either as issues or simply make a PR 😄 )
Thanks
from sector.
@gjohansson-ST I sent you an email with what I believe should be the complete json needed
from sector.
@gjohansson-ST I sent you an email with what I believe should be the complete json needed
Cool. Will check and get back to you.
from sector.
Solved in latest release v0.3.4
from sector.
Related Issues (20)
- email used as "changed_by" HOT 4
- Upgraded to latest release and now the integration is not working HOT 1
- Feature request: add doors and windows sensor status
- Feature request: Add smoke detector status
- Door lock HOT 1
- False arming/disarming. HOT 13
- Integration stuck in "Pending" HOT 2
- Attribute changed_by not updated on state change
- Platform sector does not generate unique IDs.
- Retrying setup HOT 1
- Sector Alarm's API called too often! HOT 10
- Sector Yale: Failed to call lock/unlock HOT 13
- Two alarm system on same email/login account HOT 2
- Problems with retrieving temperature readings HOT 1
- Get Temperature HOT 1
- QuickArm without code HOT 8
- Setting up connection with temp sensors fail
- Entity None - Warning
- Need to reconfigure after 24h HOT 1
- New alarm system from Sector does not show alarm status HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sector.