Code Monkey home page Code Monkey logo

wavin-ahc-9000-mqtt's Introduction

Wavin-AHC-9000-mqtt

This is a simple Esp8266 mqtt interface for Wavin AHC-9000/Jablotron AC-116, with the goal of being able to control this heating controller from a home automation system.

Hardware

The AHC-9000 uses modbus to communicate over a half duplex RS422 connection. It has two RJ45 connectors for this purpose, which can both be used. The following schematic shows how to connect an Esp8266 to the AHC-9000: Schematic

Components with links to devices on eBay

  • Esp8266. I use a NodeMcu 0.9, mostly because it is very convenient to have the onboard USB interface for programming. Almost anything with an Esp8266 on it will work.
  • 24V to 3v3 switchmode converter. This is only needed if you want to power the Esp8266 from the AHC-9000. A 24V to 5V converter can also be used, if it is connected to the +5V input of the NodeMcu. Please note that not all 3V3 step down converters on eBay supports 24V input
  • MAX3072E for converting the 3V3 serial output from the Esp8266 to RS422. There are many similar IC's from other suppliers, which can also be used. Speed is limited, and cables can be kept short, so this is rather uncritical. Note though, that it should be a 3V3 version. MAX3485 should be compatible, and can be found on eBay.
  • RJ45 connector. This can be omitted by soldering a patch cable directly to the circuit.

Depending on the used Esp8266 board and/or the switchmode converter used, it may be benificial to add a larger capacitor in the range of 100uF between 3V3 and gnd. This will most likely help if you experience WiFi connection/stability issues.

Software

Configuration

src/PrivateConfig.h contains 5 constants, that should be changed to fit your own setup.

WIFI_SSID, WIFI_PASS, MQTT_SERVER, MQTT_USER, and MQTT_PASS.

Compiling

I use PlatformIO for compiling, uploading, and and maintaining dependencies for my code. If you install PlatformIO in a supported editor, building this project is quite simple. Just open the directory containing platformio.ini from this project, and click build/upload. If you use a different board than nodemcu, remember to change the board variable in platformio.ini. You may be able to use the Arduino tools with the esp8266 additions for compiling, but a few changes may be needed, including downloading dependencies manually.

Testing

Assuming you have a working mqtt server setup, you should now be able to control your AHC-9000 using mqtt. If you have the Mosquitto mqtt tools installed on your mqtt server, you can execude:

mosquitto_sub -u username -P password -t heat/# -v

to see all live updated parameters from the controller.

To change the target temperature for a output, use:

mosquitto_pub -u username -P password -t heat/floorXXXXXXXXXXXX/1/target_set -m 20.5

where the number 1 in the above command is the output you want to control and 20.5 is the target temperature in degree celcius. XXXXXXXXXXXX is the MAC address of the Esp8266, so it will be unique for your setup.

Integration with HomeAssistant

If you have a working mqtt setup in HomeAssistant, all you need to do in order to control your heating from HomeAssistant is to enable auto discovery for mqtt in your configuration.yaml.

mqtt:
  discovery: true
  discovery_prefix: homeassistant

You will then get a climate and a battery sensor device for each configured output on the controller.

If you don't like auto discovery, you can add the entries manually. Create an entry for each output you want to control. Replace the number 0 in the topics with the id of the output and XXXXXXXXXXXX with the MAC of the Esp8266 (can be determined with the mosquitto_sub command shown above)

climate wavinAhc9000:
  - platform: mqtt
    name: floor_kitchen
    current_temperature_topic: "heat/floorXXXXXXXXXXXX/0/current"
    temperature_command_topic: "heat/floorXXXXXXXXXXXX/0/target_set"
    temperature_state_topic: "heat/floorXXXXXXXXXXXX/0/target"
    mode_command_topic: "heat/floorXXXXXXXXXXXX/0/mode_set"
    mode_state_topic: "heat/floorXXXXXXXXXXXX/0/mode"
    modes:
      - "heat"
      - "off"
    availability_topic: "heat/floorXXXXXXXXXXXX/online"
    payload_available: "True"
    payload_not_available: "False"
    qos: 0

sensor wavinBattery:
  - platform: mqtt
    state_topic: "heat/floorXXXXXXXXXXXX/0/battery"
    availability_topic: "heat/floorXXXXXXXXXXXX/online"
    payload_available: "True"
    payload_not_available: "False"
    name: floor_kitchen_battery
    unit_of_measurement: "%"
    device_class: battery
    qos: 0

wavin-ahc-9000-mqtt's People

Contributors

dkjonas avatar noxdk avatar paller avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wavin-ahc-9000-mqtt's Issues

Support magnetic contacts

Hi @dkjonas

So glad I found this project! So cool that I can integrate my floor heating with home assistant. Great - and thanks a bunch.

While waiting for the components to arrive from China, I've setup platformIO and looked around in the source. Being new to home automation, I do not have that many sensors at home - but in fact I have two magnetic sensors connected to the AHC-9000, so it will shut off circuit, when a door or window is opened. I think I could use this information (that the door is actual open) in other ways in my automation setup. So what I'm asking for here, is to add support for this.

As I see it there's two possibilities for reading the status of the magnetic contact:

  1. The correct way
    Iterate through the elements on each channel, and check if NAT ELEM is set and then check if it's ACTIVE. This would mean that we need to change the code to iterate trough the elements. As I see it it's only the first (primary) element that is read in the loop right now.

  2. The more hackish way
    As we already read out the timer event of the current channels primary element. We could check if BLKD is set. If it is - it's blocked by a Magnetic contact.

In any case we should publish a message with the status of the sensor if it's changed. And we would also need to change the discovery code.

My question here is twofold:

  1. do you have any plans on implementing support for the magnetic contacts in the library?
  2. if not - would you prefer having a PR if I try to get my feeds wet in IoT programming? And if so - which of the two alternatives above would you prefer to merge in?

One thermostat to two channels - how to

Hi
I have a house with 6 rooms, with 7 channels/zones, meaning that one Thermostat is controlling two channels/zones.

Everything works great, but this bigger room shows as two seperate climate entities, is it possible to combine theese in a way. Temp reading is always identical, but right now it is possible to set seperate target temperatures, but everything should always be identical for theese two.

Also, i think that hooking up the NodeMCU two the Wavin controller, and playing with target temperatures have messed up the Thermostat binding, so it only controls target temperature for one of the zones now, and not both. Current temp reading is showing on both entities, but only one is changing target temp, when i adjust manually on the thermostat.

Hope my explanation makes sense.

Socket error

Hey And sry for asking. Im trying to get this to work but it keeps saying socket error disconnecting.

Im thinking it could be related to user/password.

Im running my mqtt in docker on synology and im not using user or password.

in the private.sh config file in your script what should the user and password text be. do i just delete you text and leave it like "" // username <-- like this ?

Only send updates to MQTT if values are actually changed

Most of the time updates on MQTT topics will only be sent if values are actually changed. But if the Wifi or MQTT connection is lost, all values will be resent when a new connection is made.

As the MQTT server will notify all clients of the change (even if the values is not changed), this can be a bit annoying. I.e. if you monitor the battery level and get an email when it is below a certain level, you will get notified each time a re-connection occur.

The solution is to read values from the MQTT server on connection, so that only updates will be sent.

Support operating modes

HomeAssistant MQTT HVAC defines operating modes with the mode_command_topic.
In order to control the HVAC using Google Assistant, modes must be defined for the climate device to show up in Google Home.

Adding operating modes "off" and "heat" will make using Google Assistant pnp.

Also, turning off the heat can be useful for other cases, like when a window is open etc.

Support for OTA?

Hi would it be possible to add OTA (over the air updates) support to your code? It would be a nice feature if the ESP is tucked away or mounted in a box.

I dont know if it is possible to do OTA with platformio?

Regards

/Jacob

How to upload

Hi
can you give some hints to the settings of PlatformIO etc? I can't make the upload of the software to the board work...

Issues with d1 Mini (solved)

Hi there

I had some trouble with my d1 Mini that had a very hard time connecting to Wifi... got it running for a day or two, but then it lost connection and 50+ re-powers didn't help.
What did help was a cap across the power rails to the d1 Mini (+3V and GND) I just tried with a 1.000uF which fixed it (a smaller values should also do the trick).
Maybe this is just related to the d1 Mini I'm not sure, but it did the trick.

/Heino

ESP32 boards ???

Hi @dkjonas :) just wondering - would it be possible to use an ESP32 board for this project ? I know it may be overkill but just came to think of it would be possible ?

The interface is not working:(

Hi. I just got the IC MAX3072E with the mail. I tried to attach it to a breadboard with a Wemos D1 mini (instead of a nodemcu - but that should not be a problem).

After I connected the whole thing the system (subscribing the heat/# topic) it just say true / false all the time.

I am unsure if the diagram here on github is correct due to the official MAX3072E https://www.maximintegrated.com/en/products/interface/transceivers/MAX3072E.html

the diagram looks like this :
skaermbillede 2018-11-13 kl 11 54 30

What could I be doing wrong?

It looks like your diagram on the MAX IC is kind of reverse-mirrored?

Maybe not a issue, Decimal on set temperature

On my room sensors I can set the temperature by half degrees, but in the integration I can only set it in full temperatures, have I done something wrong or is it just not possible?

Sporadic fail on readRegisters

Hi @dkjonas

Thanks a lot for the great work you have done with this project. I am using your code with a few small changes on an ESP32-C3. Unfortunately I see sporadic fails when reading registers, is this something you also experience? See mqtt log, where POLL represents the start of reading registers on all channels:
image

Best way to trace if it's not working

I now have the board and everything seems to be connected as described. It's connecting to the wifi and I can ping the IP, but it does not connect to the broker..

I have also tried to flash the nocemcu again.

What is the best way to trace where the problem is?

Note. The logs was cleared on restart so cant provide the full log.

Support for Wavin-AHC-9000 2-zone control unit?

Hey Jonas

This is a very cool project and i'm eagerly trying to get it to work. I have followed all the instructions and looked through all the reported issues to compare, but still no luck.

I have tried to scope the output of the MAX3485 and the signal looks fine. Then I came to wonder, since you are mentioning that there is 16 channels on the Wavin AHC-9000/Jablotron AC-116, but I am trying to use the 2-zone version.

Do you know if the 2-zone Wavin AHC-9000 control unit is compatible with your implementation ?

Kind regards
Jens Nielsen

Wavin AHC 9000 Display Collision?

Hi dkjonas,

Thank you for the great work you have been doing. I was able to connect to my wavin controller, and read out all data on my mqtt server - awesome!

However I encountered an issue when connecting the ESP.
I have a Display connected to my AHC9000 - which will beep from time to time when ESP is connected, have you seen this issue?

Seems to happen on every poll, but also a bit random. Maybe there's some kind of collision between this display and the ESP?

They are both connected with a RJ45 cable.

Do you have any idea if this can be solved without disconnecting one of them? Any pointers would be great for me to start digging.

Display:
https://www.billigvvs.dk/Varmesystemer-Gulvvarme-Wavin--Wavin-AHC-9000-display-m-trykfoelsom-skaerm-718250.html

BR Joakim

Make Discovery option either true or false ?

Hi :)

would it be possible to change the discovery option as a true / false in the config . More so the discovery can be turned off if the user prefers manual setup ?

All the best

Jacob from Denmark

Question regarding the hardware setup

Hi Jonas,

Thank you for sharing the project, it is great to allow home automation systems to control central heating system through MQTT.
I'd very much like to give a try but not sure how to start, I have no experience with the hardware you mentioned and how to connet them. Would it be possible to share some tutorial on how to assemble the device and/or are you interested in selling the device?
Thank you in advance!

Support for Watt values

Hi there,
First of all, thank you for the work you have done so far... I have just soldered it together and of cause it just works :-)

I can see that some other projects with Wavin reports Watts, which I think the unit can report, so if it is possible I would like to have that added in the future.

PS: With such a simple circuit board it might be worth while hacking something together in some PCB designer and have a bunch of boards created in China... then maybe create a 3D-printable box for it? (If I have the time for it I will let you know...). I know that Wavin is mostly a Danish product, but there are a whole lot of them out there, and the display they provide is just a joke ;-)

I was also thinking that with a little more coding one could make a version which was reachable from a webpage and which stored the collected values to show nice graphs... should be possible as least with the D1 Mini Pro which has more memory...

I have lots of good ideas, but just not enough time to implement them all ;-)

/Heino

Zero readings and different readings with same ID0

Really happy with my AHC 9000 MQTT setup, but I have two different issues with the readings.

Attached is an image illustrating the two problems (MQTT sub dump from my installation)

  1. I get several zero readings - First green box from ID2 ... second green box shows same ID2 but with correct values read

  2. I get different readings with the same ID0 (red boxes)... Clearly it's from different sources, but the ID gets the same number (ID0) so the readings get mixed up

My installation is with 18 floorheating sources.

billede

Hjælp til udvikling af ESPHome component

Hej....

Jeg har igennem noget tid arbejdet på et component til ESPhome til Wavin AHC 9000, hvilken sådanset også er kørende med climate entities i HA og mulighed for at stille temperatur mv.
Det eneste der driller mig er muligheden for at sætte en termostat i standby(off på gamle modeller).
Jeg kan få det til at slå igennem 1 gang, men næste gang componenten opdaterer sætter den termostaten tilbage til on.

Mener ikke jeg havde denne udfordring med mqtt koden du har lavet. Har du mon nogen ide/inputs til hvorfor den opfører sig sådan?

https://github.com/heinekmadsen/esphome_components/tree/main/components/wavinAhc9000

Venlig hilsen
Heine

Question: Use of "ttl to rs485"-circuit without RE/DE-pin?

Hi. First of all thanks for sharing your awesome work! I was also planning to integrate my AHC-9000 and HA, so this comes very convenient!

This is a hardware question more than a issue. I can see from your schematic that D1 is used as RE/DE for the MAX3072E. Now I don't have a MAX3072E/MAX3485 available. But I do have this one, which is based on MAX13487 with "AutoDirection" - so no RE/DE pin:
https://www.amazon.de/DSD-TECH-SH-U12-MAX13487-Raspberry/dp/B07B667STP/ref=sr_1_3?ie=UTF8&qid=1538679557&sr=8-3&keywords=ttl+rs485

My question is, do you think this will be compatiple with your code, and can be wired just ignoring the use of the D1 pin?

PS: I would put a 5/3.3V level converter between the NodeMCU and the RS485 to TTL since it is 5V.

Thanks!

Br.
Niklas

Handle "turn on" at same time as the Wavin product itself

Hi,

Thank you for all the work into the AHC 9000. I'd like just to hear, if you'd done anything to prevent issues in the case of a power outage? All the time I've turned of my grid power, and turned it back on, I don't get any states publiched from the ESP.

The AHC 9000 and ESP turns on at the same time, so I think that's the problem.

Our unit also have a touch screen connected, if that matters.

I'd like to get this fixed somehow, but I'm not that into the Wavin product itself, so I'm not really sure that's the actual problem is.

After I turn on the AHC 9000 (which also powers my ESP and the touch screen), the touch screen does not start up, as i'd expect. I need to turn it off, and on again (remove + replug cable). After that's done, it's working fine, if the ESP are not connected. Else, it's not really working as expected. If the ESP are not in the Wavin unit, it starts up just fine. So, I've personally though about a "cold-period" before the ESP starts to communicate with the Wavin solution... But... I'm not really sure if that's the best work-around?

MQTT feedback of set temperature missing?

Hello.
First of all i want to thank you for all the effort put into this task, it's truly great. I've been wanting this for a long time, good I had a friend who pointed me to this commit.

I seem to have everything working now with your setup (great guide!), except 1 thing.
I can't seem to figure out how to fix it though!

When I change the temperature in a thermostat card inside Home Assistant (Or even go to the developer screen and set state) it sends the MQTT command as it should, the AHC9000 receives the data (as I can see the physical thermostat targeted updates into the correct "target temperature" set)... But I do not seem to get any feedback on this (is this as intended)? Instead i see the temperature in thermostat card in HA resets/changes back to whatever it was previously. And when looking into the climate class for the given sensor the temperature is unchanged (Even if i restart HA the temperature is not updated to whatever I send (But as mentioned the physical thermostat is!)

image

My setup:

  1. Nodemcu1.0 (changed that in your build file)

  2. Using MQTT Broker in HA (Using automatic discovery mode, without it I can't seem to get it work even with your example...)

  3. Follow your circuit board, but i do not have the 24V divider to 3V3 yet, so made the circuit without and powering the ESP via USB.

  4. Network connection seems fine, even tried putting a rather long network cable to the AHC9000 to get it closer to the router..

  5. Just to make sure I've explained it right I'll try to give an example:

  6. I Open thermostat card in HA, change temperature from 20°C --> 22°C

  7. The thermostat card temperature turns red while i change it (leaving it at 22°C), after 1-2 seconds it turns black (Stays at 22°C), around 2-3 seconds after that it just flips back to 20°C...

  8. I also have the issue if I change the temperature from the physical thermostat, it doesn't seem to update into HA or being transmitted...

  9. I've tracked the MQTT broker in HA sending the correct info, see next point

  10. image

Another note, as you can see in the first attachment the "target_temp_step: 1", a step size of 1°C is rather high, so that's why i tried to add it manually to change that to 0.5, but without luck so far as mentioned.

Hope you can help me out or have any idea why this behavior could happen.
Thank you in advance.

Command for reading status of heating on/off

Is it possible to manually add a command/syntax to get the state of the floor heating actually heating or not?

Auto discovery doesn't work for me, so I manually configured the sensors (working fine), but not for the status on floor heating or not.

Using this syntax right now, but lacking heating status:

    current_temperature_topic: "heat/floorXXXXXXXXXXXX/0/current"
    temperature_command_topic: "heat/floorXXXXXXXXXXXX/0/target_set"
    temperature_state_topic: "heat/floorXXXXXXXXXXXX/0/target"

Compatible with Wavin Sentio?

Hi,

Have this been testing with the Wavin Sentio system?

Not sure how to check if it is compatible, but Sentio also have modbus interface.

Looking forward to hear from you!

Not an issue but more a feature request

Hi.

Would it be possible to add / define som pins in the code for to use as led indicators? More if a box for the print is made, it would be nice to have some LED´s which shows - MQTT connected (and MQTT activity) and maybe a LED for WIFI connected?

Support IR sensor on thermostat.

Hi,

Great job on making the AHC9000 work with HomeAssistant, is there any change of you adding support for the IR temperatur sensor? This would give feedback of the floor temperatur.

How to find other units information

Hi, this is not an issue but I need help nonetheless.
I own a mechanical ventilation system by wavin. A RDCD 3.0 SH to be precise.
It has an RJ45 but it's not the classica LAN port. The device actually turns off if I plug a normal ethernet cable.
I suspect it the same connector described here, and I'd like to know more about it.
Do you have any guidance on how/where I can get more info?
I don't have a manual or a referente to the technician who installed it. Wavin is totally useless too, I tried to contact them but it was a dead end.
Thanks for your time and your effort on this peoject!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.