Giter Club home page Giter Club logo

php-fhz's Introduction

scy/fhz

This is a PHP package to access the FHZ 1000 family of SRD860 transceivers and parse messages from sensors.

At least that's what it currently does. The features are limited to what the author currently needs:

  • connect to a FHZ 1000 PC from Linux (tested on WSL as well)
  • receive temperature and humidity readings from several HMS100T and HMS100TF sensors and make them available as PHP objects

Installation

composer require scy/fhz should be sufficient. In case you want to try the example script, make sure you install the development dependencies. Recent versions of Composer do that automatically, older ones need the --dev switch.

Usage

Create a new Connection, passing the path to the serial device your FHZ is connected to as a parameter. You can optionally supply a PSR-3 logger as the second parameter.

Calling read($seconds) on the resulting object will listen for incoming transmissions and return the first incoming message. If no messages arrived after $seconds (a float), the method will return false. Messages that arrive while your read() is not running will be buffered by your operating system's IO buffer and returned one by one when you call read() the next time. (That buffer is limited, so don't get too crazy.)

The message is returned as a a Message object or a subclass of it.

Currently, only one subclass is implemented: TemperatureMessage. It represents a single reading of a HMS100T (temperature) or HMS100TF (temperature/humidity) sensor. Use methods like getTemperature() to access the data.

You can also have a look at some example code, which probably explains it better.

Status

I'm currently integrating this library into a management and logging interface for my van. The API isn't stable, but shouldn't change too much either.

Documentation, error handling and code structure could use some improvements.

Meta

This library is free software released under the terms of the MIT license. It is written and maintained by Tim Weber and its source code is hosted at https://github.com/scy/php-fhz.

php-fhz's People

Contributors

scy avatar

Watchers

 avatar  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.