GithubHelp home page GithubHelp logo

tanelvakker / nibe Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yozik04/nibe

0.0 0.0 0.0 414 KB

Library for communication with Nibe heatpumps.

License: GNU General Public License v3.0

Python 16.06% Jupyter Notebook 83.94%

nibe's Introduction

Nibe library

Library for communication with Nibe heatpumps.

Supported heatpump models

  • F1145
  • F1155
  • F1245
  • F1255
  • F1345
  • F1355
  • F370
  • F470
  • F730
  • F750
  • SMO20
  • SMO40
  • VVM225
  • VVM310
  • VVM320
  • VVM325
  • VVM500

Connection methods

  • RS485 hardwired using NibeGW on Arduino or RPi. NibeGW was developed by Pauli Anttila for Openhab's integration.
  • (Not yet tested) TCP Modbus for S Models
  • (Not yet tested) Serial Modbus for Nibe Modbus 40)

NibeGW

For this connection method to work you will need to connect an Arduino with special firmware that will act as a proxy between Heatpump RS485 and this library. Some details regarding how this method works can be found here.

NibeGW firmware for Arduino or RPi can be download here.

  • Library will open 9999 UDP listening port to receive packets from NibeGW.
  • For read commands library will send UDP packets to NibeGW port 9999.
  • For write commands library will send UDP packets to NibeGW port 10000.

Ports are configurable

import asyncio
import logging

from nibe.coil import Coil
from nibe.connection.nibegw import NibeGW
from nibe.heatpump import HeatPump, Model

logger = logging.getLogger("nibe").getChild(__name__)

def on_coil_update(coil: Coil):
    logger.debug(f"{coil.name}: {coil.value}")

async def main():
    heatpump = HeatPump(Model.F1255)
    # heatpump.word_swap = False  # uncomment if you have word swap disabled in 5.3.11 service menu
    await heatpump.initialize()

    heatpump.subscribe(HeatPump.COIL_UPDATE_EVENT, on_coil_update)

    connection = NibeGW(heatpump=heatpump, remote_ip="192.168.1.2")
    await connection.start()

if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG)

    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())
    loop.run_forever()

TCP Modbus

With S series heatpumps

import asyncio
import logging

from nibe.coil import Coil
from nibe.connection.modbus import Modbus
from nibe.heatpump import HeatPump, Model

logger = logging.getLogger("nibe").getChild(__name__)

def on_coil_update(coil: Coil):
    logger.debug(f"on_coil_update: {coil.name}: {coil.value}")

async def main():
    heatpump = HeatPump(Model.F1255)
    # heatpump.word_swap = False  # uncomment if you have word swap disabled in 5.3.11 service menu
    await heatpump.initialize()

    heatpump.subscribe(HeatPump.COIL_UPDATE_EVENT, on_coil_update)

    connection = Modbus(heatpump=heatpump, url="tcp://192.168.1.2:502", slave_id=1)

    coil = heatpump.get_coil_by_name('bt50-room-temp-s1-40033')
    await connection.read_coil(coil)

    logger.debug(f"main: {coil.name}: {coil.value}")

if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG)

    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())
    loop.run_forever()

Serial Modbus

With NIBE MODBUS 40

import asyncio
import logging

from nibe.coil import Coil
from nibe.connection.modbus import Modbus
from nibe.heatpump import HeatPump, Model

logger = logging.getLogger("nibe").getChild(__name__)

def on_coil_update(coil: Coil):
    logger.debug(f"on_coil_update: {coil.name}: {coil.value}")

async def main():
    heatpump = HeatPump(Model.F1255)
    # heatpump.word_swap = False  # uncomment if you have word swap disabled in 5.3.11 service menu
    await heatpump.initialize()

    heatpump.subscribe(HeatPump.COIL_UPDATE_EVENT, on_coil_update)

    connection = Modbus(heatpump=heatpump, url="serial:///dev/ttyS0", slave_id=1, conn_options={"baudrate": 9600})

    coil = heatpump.get_coil_by_name('bt50-room-temp-s1-40033')
    await connection.read_coil(coil)

    logger.debug(f"main: {coil.name}: {coil.value}")

if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG)

    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())
    loop.run_forever()

Model auto detection

With NibeGW it is possible to auto identify heatpump model. Heatpump sends information about model every 15 seconds.

heatpump = HeatPump()  # Note that we do not specify model here

# ...

connection = NibeGW(heatpump=heatpump, remote_ip="192.168.1.2")
await connection.start()
heatpump.product_info = await connection.read_product_info()
await heatpump.initialize()

Disclaimer

Nibe is registered mark of NIBE Energy Systems.

The code was developed as a way of integrating personally owned Nibe heatpump, and it cannot be used for other purposes. It is not affiliated with any company, and it doesn't have commercial intent.

The code is provided AS IS and the developers will not be held responsible for failures in the heatpump operation or any other malfunction.

HOWTOs for developers

How to capture and replay traffic from NibeGW

Requirements

APT:

  • tcpdump
  • tcpreplay

On recipient device run:

sudo tcpdump -i eth0 udp port 9999 -w nibe-9999.pcap

tcprewrite --infile=nibe-9999.pcap --outfile=nibe-9999rw.pcap --dstipmap=192.168.1.3:192.168.1.2 --enet-dmac=CC:CC:CC:CC:CC:CC --fixcsum

sudo tcpreplay --intf1=eth0 nibe-9999rw.pcap

You will need to replace IP addresses for rewrite and Mac address of new recipient device

nibe's People

Contributors

yozik04 avatar elupus avatar dependabot[bot] avatar tanelvakker avatar

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.