Controlling the iKettle

Posted on
Fri Apr 15, 2016 8:13 am
mwoodage offline
User avatar
Posts: 174
Joined: Dec 19, 2014
Location: Devon UK

Controlling the iKettle

I set myself a challenge recently and i'm failing badly, so decided after two days of head scratching that i need some help.
My challenge was to have a button on my control page that turned the Wifi Kettle on - it sounded easy but with no coding knowledge, i just fumbling around in the dark.

So, can anyone help? This is where i've got to so far.

The Kettle is like this one - a mark 1 version. https://www.firebox.com/product/6068/iKettle

I've found loads of information on how to control it here:-
http://www.awe.com/mark/blog/tags/ha
https://github.com/lloydwatkin/ikettle.js
https://libraries.io/npm/ikettle.js/1.0.2

Can anyone help with writing a small python script to switch the kettle on, thats all i need it to do.
I've tried this and various versions of it but can't get anything to work, i'm not sure if i'm doing the right thing, but willing to learn.

TCP_IP = '192.168.0.102
TCP_PORT = 2000
BUFFER_SIZE = 10
INITIATE = "HELLOKETTLE\n"
START = "set sys output 0x4\n"

Help please :)

Thanks in advance
Martin

Posted on
Sat Apr 16, 2016 6:56 am
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: Controlling the iKettle

This is interesting to me because I'm trying to make some of the same stuff occur with other devices. I only know in vague ways what's necessary. Has to do with HTTP GET and or POST, right, coders?

The thing is you need to be able to target whatever http controls appear in the iOS app, or better yet: in the web page the kettle also provides. It does that, right?

In theory, there's a button or something on a web page that is a control for "start the kettle now". You need to know what URL that button is, and put it in a curl or PUT or GET command--no idea which, that's why I 'm asking coders. I guess "URL" is the wrong term--whatever command the page sends to the kettle.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Sat Apr 16, 2016 11:29 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Controlling the iKettle

Do we know if those links above only work with the ikettle 1 or do they also work with the ikettle 2?


Sent from my iPad using Tapatalk

Computer says no.

Posted on
Sat Apr 16, 2016 11:54 am
mwoodage offline
User avatar
Posts: 174
Joined: Dec 19, 2014
Location: Devon UK

Re: Controlling the iKettle

Durosity,
I believe the coding is slightly different for the kettle 2 as apposed to the 1, but not sure how - although i think it might be more secure. You could try the following to see if you can talk to your kettle, this is what i did.
Firstly you'll need to find the IP address of your kettle, i did this through trial and error, if you get a response using the following you'll know because you'll get a reply saying HELLOAPP.

Open up Terminal and type.

telnet xxx.xxx.xxx.xxx 2000 - this should reply with "connected to unknown" - (xxx.xxx.xxx.xxx being your kettle's IP address)

then type,

HELLOKETTLE\n

this will then reply with HELLOAPP,

once you get this you can then type the following command:-

set sys output 0x4 - this will turn the kettle on. :)

There are lots of other controls listed here - http://www.awe.com/mark/blog/tags/ha

Let me know what happens......

Cheers
Martin

Posted on
Sat Apr 16, 2016 11:59 am
mwoodage offline
User avatar
Posts: 174
Joined: Dec 19, 2014
Location: Devon UK

Re: Controlling the iKettle

Different Computers wrote:
This is interesting to me because I'm trying to make some of the same stuff occur with other devices. I only know in vague ways what's necessary. Has to do with HTTP GET and or POST, right, coders?

The thing is you need to be able to target whatever http controls appear in the iOS app, or better yet: in the web page the kettle also provides. It does that, right?

In theory, there's a button or something on a web page that is a control for "start the kettle now". You need to know what URL that button is, and put it in a curl or PUT or GET command--no idea which, that's why I 'm asking coders. I guess "URL" is the wrong term--whatever command the page sends to the kettle.



Hi,
I'm not sure that its a URL thats required - the way i'm currently able to a take control of the kettle is through Terminal & the app that comes with the iKettle, but from what i've seen on the web its not controllable with a URL. I could be wrong, i don't really understand it enough to pass comment.

Thanks for your post
Martin

Posted on
Sat Apr 16, 2016 12:29 pm
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: Controlling the iKettle

What sort of commands does it accept in Terminal?

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Sat Apr 16, 2016 12:50 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Controlling the iKettle

Ok, kudos for trying so far, and for doing the ground work.

The best way for this in Indigo would be to use the Cynical Network plugin.

Create a TCP Out device to x.x.x.x port 2000

Probably don't hit the 'auto connect' button - that will cause Indigo to immediately connect, which you don't need to - you only need to connect on the rare occasion you want to boil the kettle.

If you provide a variable, it will populate with any replies from the kettle (eg HELLOAPP).

Then use action groups: Device commands > cynical network > send text (or possibly send script).

Add your commands (eg HELLOKETTLE and set sys output 0x4).

Test...


Sent from my iPhone using Tapatalk

Posted on
Sun Apr 17, 2016 12:56 am
mwoodage offline
User avatar
Posts: 174
Joined: Dec 19, 2014
Location: Devon UK

Re: Controlling the iKettle

Just a quick up date, I tried this late last night and it worked!! :D I need to spend some more time on it and refine what I've set up, but in principle it works.
Thank you so much howartp for your help.
Once I've tested it fully later today, I'll write up on here how it's done so others can follow.

Thanks all
Martin

Posted on
Sun Apr 17, 2016 6:24 am
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: Controlling the iKettle

Awesome!

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Sun Apr 17, 2016 9:23 am
Gusten offline
Posts: 171
Joined: Dec 30, 2015
Location: Sweden, Gothenburg

Re: Controlling the iKettle

Hi i tried this on my smarter coffee, i just changed port to 2081 and all i had to do was to send 7 to the device and it started to brew :)


Skickat från min iPhone med Tapatalk

Posted on
Mon Apr 18, 2016 11:45 am
mwoodage offline
User avatar
Posts: 174
Joined: Dec 19, 2014
Location: Devon UK

Re: Controlling the iKettle

Excellent news Gusten. I've got mine to work but having trouble holding the connection, it seams to drop the WiFi connection and then won't connect again. I have to use the app to re-set the iKettle and start over again.
Need to spend a little more time on it to get it right,

Cheers
Martin

Posted on
Wed Apr 20, 2016 4:36 pm
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Controlling the iKettle

mwoodage wrote:
Durosity,
I believe the coding is slightly different for the kettle 2 as apposed to the 1, but not sure how - although i think it might be more secure. You could try the following to see if you can talk to your kettle, this is what i did.
Firstly you'll need to find the IP address of your kettle, i did this through trial and error, if you get a response using the following you'll know because you'll get a reply saying HELLOAPP.

Open up Terminal and type.

telnet xxx.xxx.xxx.xxx 2000 - this should reply with "connected to unknown" - (xxx.xxx.xxx.xxx being your kettle's IP address)

then type,

HELLOKETTLE\n

this will then reply with HELLOAPP,

once you get this you can then type the following command:-

set sys output 0x4 - this will turn the kettle on. :)

There are lots of other controls listed here - http://www.awe.com/mark/blog/tags/ha

Let me know what happens......

Cheers
Martin


Ah, the reason I was asking is that I don't have one yet. I was planning on asking for one as a birthday present from the wife.. But I didn't want to get the ikettle 2 if it only works with the 1. That said I'd prefer the 2 as it can report how much water is in the kettle :)

Computer says no.

Posted on
Thu Apr 28, 2016 2:15 am
mwoodage offline
User avatar
Posts: 174
Joined: Dec 19, 2014
Location: Devon UK

Re: Controlling the iKettle

Now that i have a working control over my WiFi Kettle (iKettle) i thought i'd share with everyone how it's done. Happy to answer any questions, i'll try to help!!

Firstly,
Check that you can talk to your iKettle,
Open up Terminal and type.
telnet xxx.xxx.xxx.xxx 2000 - this should reply with "connected to unknown" - (xxx.xxx.xxx.xxx being your kettle's IP address)
then type,
HELLOKETTLE\n
this will then reply with HELLOAPP,
You're now talking to your kettle!
From this point within terminal you can type the following to get your kettle to turn on or off.
set sys output 0x4 - Turn's iKettle On
set sys output 0x0 - Turn's iKettle Off
There are more control commands here:- http://www.awe.com/mark/blog/tags/ha

Integration into Indigo
For this you'll need to download and install the Cynical Network plugin, thanks to howartp for his help on this & to Perry for writing an excellent Plugin.
Once installed, add a new device and look for "Cynical Network" in device type, then create a TCP Out device to xxx.xxx.xxx.xxx port 2000 (xxx.xxx.xxx.xxx being your kettle's IP address)

Check the 'auto connect' button - this will immediately connect to the iKettle, i had trouble with this section and found it was easier to keep the iKettle connected at all times rather that connecting only when required. I also set the line endings with "Carriage Return"

Now you should have your iKettle as a device within Indigo.... :D

From here you can then take control of your iKettle and set functions.

Control from Indigo

Open a new Action Group and create the following:-
Firstly we need to create a script to tell Indigo to wake the iKettle. (Type, Device Actions, Cynical Network Controls, perform Script) Edit action setting and type,
HELLOKETTLE\n - selecting the iKettle in the device box.

Secondly we need to create a command, click add new and select the following (Type, Device Actions, Cynical Network Controls, send text) Edit action setting and type,
set sys output 0x4 - selecting the iKettle in the device box.

Finally you need to set an off action, the iKettle will switch itself off so you might not need this. But create a new action group as above but use 'set sys output 0x0' instead, this command will turn the iKettle off.

You should now be able to control your iKettle and use these functions to add into Indigo control pages or schedules.

There are lots of other functions you can get the kettle to do, but i've not played around with theses yet, have a look again at http://www.awe.com/mark/blog/tags/ha this will give you loads of commands and iKettle feedback. My most exciting thing is to get my Amazon Echo to turn on the iKettle!!

Enjoy
Martin
Attachments
Screen Shot 2016-04-28 at 09.06.25.png
Screen Shot 2016-04-28 at 09.06.25.png (65.71 KiB) Viewed 6878 times
Screen Shot 2016-04-28 at 09.06.05.png
Screen Shot 2016-04-28 at 09.06.05.png (65.62 KiB) Viewed 6878 times
Screen Shot 2016-04-28 at 09.05.44.png
Screen Shot 2016-04-28 at 09.05.44.png (65.14 KiB) Viewed 6878 times
Screen Shot 2016-04-28 at 08.42.52.png
Screen Shot 2016-04-28 at 08.42.52.png (33.59 KiB) Viewed 6878 times

Posted on
Thu Apr 28, 2016 3:15 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Controlling the iKettle

Did you play with the 'last line read' field?

That, combined with the command values on the page you linked to, will allow you to trigger based on events such as kettle has boiled.


Sent from my iPhone using Tapatalk

Posted on
Thu Apr 28, 2016 4:07 pm
mwoodage offline
User avatar
Posts: 174
Joined: Dec 19, 2014
Location: Devon UK

Re: Controlling the iKettle

No not yet, I'll give it a try and let you know what results I get. Cheers


Sent from my iPhone using Tapatalk

Who is online

Users browsing this forum: No registered users and 1 guest