Hot Tub Gecko inTouch2

Tags: #<Tag:0x00007f616cb2f820>

Hello,

can somebody help me to connect to my hot tub? There are two big companys out there: balboa and gecko. For the balboa someone already made a solution.

gecko controller and android app and here Gecko Intouch

Found a github phyton script
I found the correct MAC address and spa.srccn from my wifi packages.

#!/usr/bin/python
from intouch2 import intouch2
import logging
spa = intouch2(logging.DEBUG)

# Set the MAC address of the device
spa.Mac = 'xx:xx:xx:xx:xx'
# Source Connection (?) value. Obtain this value from an existing communication from the App (using for example Wireshark)
spa.Srccn = 'XXX413c433-b343-4f24-a432-5ed5c53cb152c'

spa.connect()
print 'Channel: %d' % spa.getCurrentChannel()
print 'Setpoint: %d.  Current Temperature: %d.  Lights: %d.  Version: %s.  Base config: %s.' % spa.getStatus()
spa.disconnect()

and

#!/usr/bin/python
import socket
import logging
import re
from struct import *

class Watercare:
        AwayFromHome, Standard, EnergySaving, Supersaver, Weekender = range(0, 5)

class Messages:
	Hello = '<HELLO>%d</HELLO>'
	GetCurrentChannel = '<PACKT><SRCCN>%s</SRCCN><DESCN>%s</DESCN><DATAS>CURCH%d</DATAS></PACKT>'
	GetWatercare = '<PACKT><SRCCN>%s</SRCCN><DESCN>%s</DESCN><DATAS>GETWC%d</DATAS></PACKT>'
	GetStatus = '<PACKT><SRCCN>%s</SRCCN><DESCN>%s</DESCN><DATAS>STATU%d\x00\x00\x02\x00</DATAS></PACKT>'

class intouch2:
	server_address = ('intouch.geckoal.com', 10022)
        sock = None
        sqn = 1
	Srccn = 'dummy'
	Mac = ''

	def __init__(self, level):
		logging.basicConfig(level=level,
                    format='%(asctime)s %(levelname)s %(message)s',
                    filename='intouch2.log')

	def connect(self):
		logging.info('Connecting to %s:%d' % (self.server_address[0], self.server_address[1]))
        	# Create a UDP socket
        	self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        	# We'll wait up to 1 second for a response
        	self.sock.settimeout(1)
		# Starting sequence number
        	self.sqn = 1

	def disconnect(self):
		logging.info('Disconnecting')
        	self.sock.close();

	def sendWithSrccnMacSqn(self, msg, srccn, mac):
		buf = msg % (srccn, mac, self.sqn)
        	self.sqn = self.sqn + 1	
		return self.send(buf)

	def sendWithSqn(self, msg):
        	buf = msg % (self.sqn)
        	self.sqn = self.sqn + 1	
		return self.send(buf)

	def send(self, msg):
		logging.debug('Sending `%s`' % msg)
        	sent = self.sock.sendto(msg, self.server_address)

	def recv(self):
		logging.debug('Waiting to receive data')
		try:
			data, server = self.sock.recvfrom(4096)
		except:
			logging.error('Timeout! No data received')
	 		return None
		logging.debug('Received `%s`' % data)
		return data

	def sendHello(self):
		self.sendWithSqn(Messages.Hello)
		return self.recv()

	def getCurrentChannel(self):
		logging.debug('Sending GetCurrentChannel message')
	 	self.sendWithSrccnMacSqn(Messages.GetCurrentChannel, self.Srccn, self.Mac)
		data = self.recv()
		m = re.search(r'<DATAS>CHCUR(.*)</DATAS>', data, re.DOTALL)
		(channel, rest) = unpack('>bb', m.group(1))
		return channel

	def getCurrentWatercare(self):
		logging.debug('Sending GetWatercare message')
		self.sendWithSrccnMacSqn(Messages.GetWatercare)
		data = self.recv()
		m = re.search(r'<DATAS>WCGET(.*)</DATAS>', data)
		(value) = unpack('b', m.group(1))
		return Watercare(value[0])

	def getStatus(self):
		logging.debug('Sending GetStatus message')
		self.sendWithSrccnMacSqn(Messages.GetStatus, self.Srccn, self.Mac)
		while True:
			data = self.recv()
			m = re.search(r'<DATAS>STATV(.*)</DATAS>', data, re.DOTALL)
			(seq, next, rest) = unpack('>bb{0}s'.format(len(m.group(1))-2), m.group(1))
			logging.debug('Status message: Seq: %s. Next: %s. Length: %s' % (seq, next, len(rest)))
			#print [hex(ord(c)) for c in rest]
			# If next sequence number is 0, that appears to be the end of the messages
			if (next == 0): 
				break;
			# Some interesting fields are present in the 7th message
			if (seq == 7):
				(f1, f2, f3, setpoint, temp, junk1, YT1, YT2, YT3, config, j1, j2, j3, j4, lights, junk2) = unpack('>bbbhh18shbbhbbbbb4s', rest)
				setpoint = setpoint/10.0+32.0
				temp = temp/10.0+32.0
				version = "inYT %s v%s.%s" % (YT1, YT2, YT3)
		return (setpoint, temp, lights, version, config)

Tried to run the script but I get no response.

Traceback (most recent call last):
File “./spa.py”, line 15, in
print ‘Setpoint: %d. Current Temperature: %d. Lights: %d. Version: %s. Base config: %s.’ % spa.getStatus()
File “/etc/openhab2/html/gecko/intouch2.py”, line 91, in getStatus
m = re.search(r’STATV(.*)’, data, re.DOTALL)
File “/usr/lib/python2.7/re.py”, line 146, in search
return _compile(pattern, flags).search(string)

and logging file:
2018-12-01 16:56:14,064 INFO Connecting to intouch.geckoal.com:10022
2018-12-01 16:56:14,065 DEBUG Sending GetStatus message
2018-12-01 16:56:14,065 DEBUG Sending <PACKT><SRCCN>XXX413c433-b343-4f24-a432-5ed5c53cb152c/SRCCN><DESCN>xx:98:f4:a1:d0:4b</DESCN><DATAS>STATU1 </DATAS></PACKT>
2018-12-01 16:56:14,264 DEBUG Waiting to receive data
2018-12-01 16:56:29,280 ERROR Timeout! No data received

appreciate any help
Michael

Well, this is fun. Here I am, the one that first decoded the Balboa protocol - and now I (unknowingly) find myself with an inTouch2 controller (in my Mr. Steam shower steam generator, of all things!). https://github.com/chicago6061/in.touch2/issues/1 actually has a lot more details about how the protocol works, and how to control stuff. I’ve captured my steamer getting controlled (it uses a STEAMLINX app, not Gecko, but it’s the same protocol), and things match up with what’s in that issue. Unfortunately, controlling my steamer is pretty far down on my list of things to automate, and this is a far more opaque protocol than other things I’m looking at at the moment, so it will be a while before I get around to writing something more functional than that python script. Just wanted to ping this thread though, and note that I do hope to get around to it eventually.

Has anyone made any progress on finding a solution for the Gecko in.touch system. At a minimum I would simply like to monitor water temp.

After a lot of time I was revisiting the github page again.
There is an update https://github.com/chicago6061/in.touch2

Nevertheless Im just unable to get a stable connection.
A couple of times I was able to get the reminders when I was opening the app at the same time. so maybe the .py was sniffing the data from the port without really connecting?

Are there any news about binding of in.touch2 to openhab? Unfortunately I only found some scripts with trials to catch the communication in the app. I’m not an expert of this, I cannot use or develop it further.

I’m sure there is some interest to bind in.touch2 to openhab.

Minimum could be to read the temperature of the spa, this would helo already a lot.

have you found other scripts than the github link I posted?

Unfortunately not. For Balboa it seems to exist more. But I decidedfor gecko, thinking that there will be a script.
But I do not have the skill to adapt your skill accordingly that it is working