GithubHelp home page GithubHelp logo

connorrigby / my_sensors_mysgw Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 3.0 42 KB

Elixir MySensors Gateway Wrapper

License: MIT License

Makefile 29.12% Elixir 64.12% HTML 6.76%
elixir nerves mysensors

my_sensors_mysgw's Introduction

MySensors.MySGW

What is it?

An Elixir wrapper around [MySensors] (https://github.com/mysensors/MySensors). specifically mysgw. This allows driving the nrf24 chip directly off the SPI bus on Nerves devices.

Why is it?

The default mysgw configure script doesn't easily allow for cross-compilation. (Something that Nerves requires). A couple source file also need to be patched to allow for Erlang to start the program as a port. See these threads for more info on this:

Usage and Configuration

# Disable logs
config :my_sensors_mysgw, MySensors.MySGW.Logger, [
  level: false
]

# Configure meta information
config :my_sensors_mysgw, MySensors.MySGW.Logger, [
  level: :info,
  meta: [:some, "cool", 'info']
]

# Don't start the daemon.
config :my_sensors_mysgw, MySensors.MySGW.Application, [
  daemon: false
]
# Start the daemon later: (this is blocking, spawn it)
MySensors.MySGW.start_gw()

# Configure eeprom + config_file location
config :my_sensors_mysgw, MySensors.MySGW, [
  eeprom_file: "/root/mysensors.eeprom",
  config_file: "/root/mysensors.conf"
]

Raspberry Pi

For Raspberry Pi devices you can follow [the guide provided by mysensors] (https://www.mysensors.org/build/raspberry#wiring)

Beaglebone

There is no wiring guide for beaglebone based devices. Wiring is similar to Raspberry Pi. Match the pin names between the radio and beaglebone. You will also need to set my_sensors_mysgw_spi_dev in your mix.exs project config.

def project do
    [
      # ...
      my_sensors_mysgw_spi_dev: "/dev/spidev1.0",
      # ...
    ]
end

CS, CE, Interrupt

You will probably need to configure your the pins outside of spi_dev.

def project do
    [
      # ...
      my_sensors_mysgw_spi_dev: "/dev/spidevStopCopyPastingThings",
      my_sensors_mysgw_irq_pin: 9000,
      my_sensors_mysgw_cs_pin:  9001,
      my_sensors_mysgw_ce_pin:  9002,
      # ...
    ]
end

Usage with my_sensors

If you are running my_sensors on the same device as my_sensors_mysgw:

iex()> MySensors.Gateway.add_transport(MySensors.Transport.TCP, [])

otherwise:

iex()> MySensors.Gateway.add_transport(MySensors.Transport.TCP, [host: 'nerves.local'])

Building this package

The Makefile in this package requires tar and wget when building as a hex package. This is because the MySensors code is a submodule. PRs welcome.

License Information

THe MySensors code is liscensed under GPLv2, the Elixir code is licensed under MIT.

my_sensors_mysgw's People

Contributors

connorrigby avatar stevenproctor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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