npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ha4us/adapter

v1.5.1

Published

Base modules for running a ha4us adapter

Downloads

19

Readme

ha4us

Important! This is personal, educational project just for me - you can use it on your own risk!

Starting with a small homematic installation, some years ago I started with ccu.io. As this project was shutdown in favour of iobroker I was really excited about the planned architecture (using a standard message-broker and a standard database), but unfortunately the developer team decided to go back to a file based approach and an internal message bus.

At this time I decided mainly from a educational point, to write my own home automation solution based on MQTT and a document-oriented database (first I choose CouchDb nowadays I switched to MongoDb). But I have to admit, that iobroker is still the most complete and versatile home automation solution I've seen (and i tried a lot) and the guys on the project do a admirable job.

My first approach was to realize a single process with a couple of adapters that were loaded into the main process with gui based on AngularJs, storing all kind of objects in the database. I took me quite a while to achieve a MVP with homematic, sonos, logitech harmony, fritzbox, charting, history, scripts, schedulers and a lot more and I came to the point, that the whole system was getting too complicated and too fragile when replacing one single adapter (a lot of side effects). So I started over again and began a more modular approach following the mqtt-smarthome architecture.

So every adapter is a own process only communicating via mqtt and supplies either a wrapper around a piece of hardware, represents a graphical user interface or capsules a piece of logic.

Content

This repository here is the base class for all adapters in the ha4us-univers and encapsulates following functionality:

  • configuration (via environment variables or command line parameters)
  • database access to mongo db (when needed by the adapter)
  • logging to console
  • yml file access
  • and most important the mqtt handling It standardizes the startup and shutdown behaviour of an adapter and tries to ensure the architectural compliance to the system.

Additionally there are some more helpers (also usable in the web). E.g.:

  • mqtt topic pattern matching
  • mqtt topic manipulation (split, join, insert)
  • value mapping

My personal educational goals

  • learn javascript (more or less done)
  • learn nodejs (for me ok)
  • learn typescript (in progress)
  • learn document-oriented databases (for me ok)
  • learn AngularJs and Angular (still in progress)
  • learn ReactiveX (currently my favorite subject)
  • learn continuos integration (still open)
  • learn docker (in progress)
  • ....

Overview of current and planned adapters with status

| Adapter | Description | Status | | -------------- |:--------------------------------------------------| ------- | | hm | homematic adapter | published | | hue | adapter for philips hue | published | | landroid | adapter for auto mower from landroid | published | | scripts | adapter for logic execution | first version | | history | persisting history of state changes | first version | | gui | angular gui for ha4us | in work | | harmony | Logitech Harmony | in work | | chafon | Adapter for the chafon usb rfid reader/writer | done | | sonos | Sonos System | planned | | fritz | Fritzbox | planned | | blepresence | A bluetooth le adapter to scan beacons | planned | | alexa | Alexa adapter | planned | | homekit | Apple homekit adapter | idea | | telegram | Telegram bot interface | idea | | pm2 | Monitor for pm2 processes| idea | | wiegand | Adapter for a wiegand rasbperry pie rfid reader | idea | | macros/scenes | Create Macros/Scenes a simple scripts | idea |

More features that will be added somewhen / somewhere

  • ~~Groups (Rooms, function groups like switches, blinds....)~~ replaced by tagging of objects (so no groups!)

Getting Started

This package is only used for building new adapters. So please look in the adapter repositories.

Installing

For using the module just install via npm.

npm install ha4us

And start coding

Versioning

I try to use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • ulfalfa - Initial work - Ulfafa

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

I bow down to the especially to hobbyquaker, since he was the main inspiration for this project

  • with creating ccu.io
  • with starting iobroker (and bringing the idea of central bus and database)
  • with leaving iobroker and
  • going with this modular approach mqtt-smarthome architecture