Simple iOS On/Off app for SonOff

I had some time, so I decided to make an on/off program for my SonOff switch that I want to use to turn on / off the boiler heating at my house ( I use the stronger one, that has support for 16A load). My SonOff is pre-configured already with ESPEasy and rules.

What I will be making is a very simple iOS app that has a toggle button on it. First, some basics:

Reading the current state:

http://192.168.88.171/control?cmd=status,gpio,12

Changing the current state:

http://192.168.88.171/control?cmd=event,TurnOn

and

http://192.168.88.171/control?cmd=event,TurnOff

So, what I need is a simple app that will need to:

a) Manually set / change the IP address of the controller.
b) Read the state of the GPIO from the controller ( JSON output ).
c) Visually change the button state to reflect the on/off state.
d) Send the new state to the controller when the button is pressed.

Well, the app creation itself took around 1 hour. I will not go into details, if you want – you can check it out yourself from GitHub. I’ve used SwiftyJSON and Alamofire – two wonderful libraries, to handle JSON result from the controller and to send requests.

That’s the primary screen of the app:

As you can see, it’s very simple, but gets the job done 🙂 You can tweak it as you wish, just checkout the GitHub repository.

Leave a reply:

Your email address will not be published.

Site Footer

Sliding Sidebar