cr3ative / homebridge-aqualisa

God help me I will Homekit enable my shower.
Apache License 2.0
13 stars 0 forks source link

Installation #4

Open garethcook opened 2 years ago

garethcook commented 2 years ago

Oh my days. This Aqualisa shower was touted as being smart and it's as thick as s***. The app is next to hopeless and profiles have been removed from the controller. Sigh.

What do I want? I want to know when the shower is on or off, or the bath is on or off (the secondary valve) as then I can kick off magical events. I'd love to help test this with you and using HomeBridge and therefore into Home Assistant to make it actually useful.

THANKYOU!

cr3ative commented 2 years ago

lol yeah tell me about it. This plugin is "on hold" for two reasons basically:

  1. Aqualisa has a firmware bug which I'm trying to get fixed with them before proceeding; if you set a bath to run for 20 minutes, it'll stop running after 12 because the anti-overflow code kicks in, and the timer code doesn't overrule it. This is silly.
  2. Homekit doesn't like the valve setup for the dual filler very much. I've got a prototype going to correctly display the valves, timer and temperature in Homekit (presenting a very nice little layout) but Home does not like changing between valves very much at all (i.e, swap shower output for bath output) - it often won't register a change. I might have to wait a few seconds between changes, or put them in a "Stopping"/"Starting" state in sequence which is just a ball ache.
  3. Homekit doesn't support the idea of a "only one at a time" valve setup like we have. It thinks all valves should be independently controlled (i.e, bath and shower can both run at once), which isn't possible, the output is on a sliding track between outlets as you'll have guessed. This throws up a bunch of UI problems.

2 is the main one - it makes the valve display unreliable and the state within Homekit gets all wonky. I hope to find time to fix that up, and the API clues in the README will let any dev with more time do it faster than me, but that's basically where we're at.

I think the other reason I was a bit discouraged is that I haven't figured out how to locally control the shower on the network. At the moment I have to communicate via Aqualisa servers, and I don't like that - I'd prefer to have local network control.

Anyway, thanks for the comment, it might spur me in to action soon!

garethcook commented 2 years ago

With regards to the two valves, is there an intermediate solution. Perhaps one switch to show if the system is active or not, then a second switch showing if the shower or bath valve is on - off for shower, on for bath. We can then use that in any logic commands.

I did a port scan, yes it's very basic, but there were no open ports that I could see to get a handle on it locally, not even to respond to any MQTT commands. Unless that can be exposed through another config of course.

My current plan is to chop into the pipes and insert some flow sensors, so at least I can locally detect when there's some water action happening so I can then kick off all the logic I need - extractor, heating, hot water on, lighting, etc.

cr3ative commented 2 years ago

I don't know much about MQTT, but have you fired any at port 49153? I mention it in the README, it... appears to receive things, and there's the aqualisa repo about it. But I haven't been able to get any good results from it.

garethcook commented 2 years ago

As an MQTT client, it will need to connect to a MQTT broker with credentials, likely the .st domain. Pointing MQTT Explorer at 49153 gets rejected, also tried using my AQ credentials, rejected.

One could have the router redirect traffic bound for the .st domain to my local MQTT broker, but unless we know either the credentials, or how to change them, this may not get too far.

Dantenz commented 2 years ago

Help us cr3ative - you're our only hope!

But seriously, thanks for running with this. I don't have the technical knowledge to pull this all apart and make the progress you have. If you need someone to test/validate please give me a shout - I have an Optic Q Shower/Drench and a Unity Q bath filler, with seem to use the exact same mixer unit, albeit with slightly different "controllers". All of my homeauto stuff (well, almost) is integrated via openhab with homebrew devices firing MQTT.

garethcook commented 2 years ago

Have you looked at port 1935? Possibly rtmp

cr3ative commented 2 years ago

@Dantenz Noted! At the moment, full disclosure, the cloud service is so shitty that I'm not going to proceed with this at the moment actively. If we can gain local control, I'll be the first person on this - that would be incredibly exciting.

@garethcook Port is closed on mine:

PORT     STATE  SERVICE
1935/tcp closed rtmp

nmap is just noting that 1935 is traditionally rtmp

qsgithub1 commented 2 years ago

WoooHoo, I just ordered the Q Optic and I was praying there is a HomeBridge solution. But reading the comments here has got me nervous!

How are we looking Smart Tech family? Am I set for disappointment, should I get a basic mixer? I was hoping the other solution would be for Siri to speak to Alexa to get the shower on. Not sure if that is an idea, if this does not work.

I would love to help with the coding, but I just about manage setting up smart lights lol

chriswunsch00 commented 2 years ago

I have just bought a new house and got one of these installed. I'm willing to test this plugin and help where I can. How can I get it installed onto my home bridge setup ?

cr3ative commented 2 years ago

Still the case that this plug-in is exploratory documentation only at the moment. The cloud service is so shockingly bad that I have no interest in integrating it at the moment. If local network control becomes available I'll absolutely reconsider.

chriswunsch00 commented 2 years ago

So no way for me to try myself via homebridge?

cr3ative commented 2 years ago

Not at the moment. I think the extent of the info on the API and how it works is in this repo (I've written it down as best I can) but there are no working homebridge plugins yet.

chriswunsch00 commented 2 years ago

Ill fire up the node server and take a peak - what is their mobile app like ?

cr3ative commented 2 years ago

Fairly dire. I got the endpoints by debugging their Android app. You won't find any more than is in the Postman collection in this repo, it'll save you a lot of time.

Joezo commented 1 year ago

First, thanks for putting this together @cr3ative!

I just spoke to Aqualisa support about the state of the app. I'm not sure if everyone else has the same problem, but mine just times out when requesting the shower to turn on, from both app and alexa. Then ~5-10 minutes later it'll switch on.

Anyway, they said they are aware of issues with the app and they're working to fix them. They couldn't give me a timeline though. They mentioned that they're changing the team that's working on it. So, maybe that's a good sign that things might change soon.

Fingers crossed they sort it out 🤞

cr3ative commented 1 year ago

Thanks for the update @Joezo , that's exactly the same problem I have too.

I'm quietly suspicious that EVERYONE has this problem and they just don't know it. Their messaging queue slows down to the point it can't reply to actions, then things happen X minutes later. It's a horrible mess.

I've offered them my services as a developer of apps/embedded stuff, but they never seem to reach out more than once. Requests to have the app person call me back fall on deaf ears.

Ah well. I'm very glad to hear they're changing the team. I just hope it's back-end not front-end, as faffing about with how the app looks won't fix this!

serf2 commented 1 year ago

I agree everyone must be having this problem. I ended up soldering some wires to the official remote (£86 from Amazon) and connecting it to my Pi. Very easy to do. Works perfectly, locally, and even tells me when the shower is warmed up!

qsgithub1 commented 1 year ago

I agree everyone must be having this problem. I ended up soldering some wires to the official remote (£86 from Amazon) and connecting it to my Pi. Very easy to do. Works perfectly, locally, and even tells me when the shower is warmed up!

This sounds like an idea. Could you post a picture please and what components are needed apart from the remote? Cheers

serf2 commented 1 year ago

aqualisa1

On the Raspberry Pi I use the Domoticz home automation system, so for the integration with Alexa there are quite a few elements of software and configuration to set up, which I don't cover here.

The below hardware gives your Pi control of the shower, and some simple python code to make it work.

Buy the official Aqualisa Optic Q shower remote from Amazon for £86. Pair it with the shower using the included instructions. Open it up (2 small screws). Remove the switch push-plate (it's just held on by a clear sticky thing) and solder a wire to each of the two parts of the switch (they are really good surfaces for solder). Drill (or use your soldering iron.. I'm lazy) a couple of holes out of which to pass the wires. Screw it back together (leave out the switch push-plate thing).

In the picture, the parts are plugged in to a breakout board to make it easier to demonstrate. The remote is left open so you can see where I've soldered the wires. (Apologies for the shadows).

The remote switch wires are connected to the relay board. The relay board power is connected to 0V and 5V directly from the Pi. In my example, the relay control is connected to the Pi on GPIO 18, and is activated by python.

A light-dependent resistor (LDR) is blu-tac'd over the white LED on the remote. (in the picture, it's on the end of the blue and yellow wires, hanging in mid-air just to the left of the white LED. It should be stuck right over the white LED (which looks green in the picture..) It works with the switch cover screwed back on, and the LED blu-tac'd on top of the case)

The LDR forms the top part of a voltage divider between 0V and 3.3V on the Pi. The bottom part is a 220k resistor LDR(leg 1)->3.3V, 220k(leg 1)->0V, LDR(leg 2)&220k(leg 2)->GPIO pin.

In my example, GPIO pin 17 reads the signal from the voltage divider. When the white LED is lit, the light falling on the LDR reduces its resistance from several meg to about 20k, which raises the voltage at the centre of the divider to around 3V which is enough to trigger the GPIO pin.

When the shower is started by activating the relay, the white LED flashes regularly until the shower reaches operating temperature, at which point it stops flashing. (it was a little erratic during testing however, see below). (the instructions say the LED stays on for 5 seconds once the temperature is reached, but mine doesn't seem to do that).

The python program detects the "warming" flashes, and then assumes "ready" when the flashing stops, at which point I get my Echo to say that the shower is ready.

Parts: Any Raspberry Pi - in the picture is my test Pi Zero W - £10 ish but they seem to be sold out in most places. Can maybe get one for double the price on ebay. One relay board - 10 for £14.99 https://smile.amazon.co.uk/gp/product/B08MTD5BPJ One 220k resistor - anything around 300k or thereabouts should work, my 220k one came from this pack: https://smile.amazon.co.uk/gp/product/B07P1GWKSJ One light-dependent resistor (LDR) - https://www.ebay.co.uk/itm/114833522481 Some connector cables. I use this to make them: https://smile.amazon.co.uk/gp/product/B07V5FVSYL

The code is a first draft and has no error trapping whatsoever. The flashes on the remote whilst I was testing became a little erratic. It may work just fine from cold as I think this was due to me constantly turning the shower on and off. The comments show what was going on.

When I "preview" this comment, the code seems to have lost its indentation.. let's hope publishing it doesn't..

Cheers! Steve Prior.

`import RPi.GPIO as GPIO from time import sleep import datetime

GPIO.setmode(GPIO.BCM) #use Pi pin numbers, not board pin numbers GPIO.setup(17, GPIO.IN) #LDR signal in GPIO.setup(18, GPIO.OUT) #relay control out

switch the relay

GPIO.output(18,GPIO.HIGH) sleep(0.5) GPIO.output(18,GPIO.LOW)

warmedup=0 #set to 1 when flashing ends last=0 #used to determine if this is a change of LED state flashing=0 #set to 1 when flashing is detected lts=0 #timestamp of the last change of state

while not warmedup: gpin=GPIO.input(17) if gpin==1: if last==0: print("On") ts=datetime.datetime.now().timestamp() tdiff=ts-lts #calculate the time since the end of the last flash lts=ts print(tdiff) last=1
else: if last==1: print("Off") ts=datetime.datetime.now().timestamp() tdiff=ts-lts #calculate the length of this flash lts=ts print(tdiff) if tdiff<1 and flashing==0: #we have the end of the first short flash, so flashing has started flashing=1 print("Flashing started..")
if tdiff>1 and tdiff<10: #sometimes it only flashes once, for a 3 or 4 seconds print("Long flash, could be either already warm, recently turned on, or being turned off.. exitting") warmedup=1
last=0

ts=datetime.datetime.now().timestamp() tdiff=ts-lts #check if there hasn't been a flash for a while if tdiff>2 and flashing==1: #no flashes for over a 2 seconds so assume warmed up warmedup=1 sleep(0.1)

print("Shower (probably) warmed up, or you're using this program to turn it off :)")

run some code to here to get Alexa to speak "Your shower is ready"

GPIO.cleanup()

`

serf2 commented 1 year ago

Yeah, no indentation... but it shows when I edit it... odd. ideas?

serf2 commented 1 year ago

Ok forget all of that flashing-light rubbish. It is just terribly inconsistent. This is still very useful to start, stop and change outlets. My shower takes less than a minute to warm up, so I've added a timer in to my Alexa routine before it tells me it's ready. At that point I switch outlets with a longer switch of the relay because I start with the rainfall, but I also want the wall shower to be warmed up.

The circuit is much simpler, as is the code:

`import RPi.GPIO as GPIO from time import sleep

GPIO.setmode(GPIO.BCM) #use Pi pin numbers, not board pin numbers GPIO.setup(18, GPIO.OUT) #relay control out

switch the relay

GPIO.output(18,GPIO.HIGH) sleep(0.5) GPIO.output(18,GPIO.LOW)

GPIO.cleanup()

`

qsgithub1 commented 1 year ago

Ok forget all of that flashing-light rubbish. It is just terribly inconsistent. This is still very useful to start, stop and change outlets. My shower takes less than a minute to warm up, so I've added a timer in to my Alexa routine before it tells me it's ready. At that point I switch outlets with a longer switch of the relay because I start with the rainfall, but I also want the wall shower to be warmed up.

The circuit is much simpler, as is the code:

`import RPi.GPIO as GPIO from time import sleep

GPIO.setmode(GPIO.BCM) #use Pi pin numbers, not board pin numbers GPIO.setup(18, GPIO.OUT) #relay control out

switch the relay GPIO.output(18,GPIO.HIGH) sleep(0.5) GPIO.output(18,GPIO.LOW)

GPIO.cleanup()

`

Thanks for this it’s useful. Not sure if I’ll be able to figure this out. I’ve purchased the remote; maybe thinking keep it simple with a switch bot?

cr3ative commented 1 year ago

@serf2 This is ridiculously impressive. Thank you for the detailed notes!

Speaking of the remote, it's BTLE apparently. Someone on my Twitter is looking in to the protocol, but as I don't have a BTLE sniffer, I can't help much there. It'd be a really neat implementation though if it were decoded.

elgerg commented 1 year ago

If we do get the Bluetooth interface decoded I'd be really interested. This could then be handled by an esp32 and MQTT.. Looking forward to any updates :)

serf2 commented 1 year ago

Ok forget all of that flashing-light rubbish. It is just terribly inconsistent. This is still very useful to start, stop and change outlets. My shower takes less than a minute to warm up, so I've added a timer in to my Alexa routine before it tells me it's ready. At that point I switch outlets with a longer switch of the relay because I start with the rainfall, but I also want the wall shower to be warmed up. The circuit is much simpler, as is the code: `import RPi.GPIO as GPIO from time import sleep GPIO.setmode(GPIO.BCM) #use Pi pin numbers, not board pin numbers GPIO.setup(18, GPIO.OUT) #relay control out

switch the relay GPIO.output(18,GPIO.HIGH) sleep(0.5) GPIO.output(18,GPIO.LOW)

GPIO.cleanup() `

Thanks for this it’s useful. Not sure if I’ll be able to figure this out. I’ve purchased the remote; maybe thinking keep it simple with a switch bot?

I tried a switchbot but it doesn't have enough oomph as the button press is quite stiff. You could possibly replace the buttony-bit with perhaps some silver foil? It may be tricky to get the contact to spring back though, so perhaps a thinner-than-the-original conductive strip? Just thinking out loud..

serf2 commented 1 year ago

I do have a sniffer but I can't for the life of me get anything from either the remote or the shower.. it doesn't seem to be presenting any MAC address at all! But I am no expert..

serf2 commented 1 year ago

But it is a Nrf51822 chip inside....