Giter Site home page Giter Site logo

shurikas / zigstargw-fw Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xyzroe/zigstargw-fw

0.0 0.0 0.0 15.32 MB

ZigStar LAN Gateway - Firmware

License: GNU General Public License v3.0

Shell 0.06% JavaScript 1.28% C++ 8.16% Python 21.23% C 51.14% CSS 17.89% HTML 0.24%

zigstargw-fw's Introduction

Stand With Ukraine

GitHub version GitHub download License

ZigStar LAN Gateway - Firmware

This firmware delevoped to use with ZigStar LAN Gateway

Functions

  • Zigbee UART port forwarding using socket LAN connection
  • MQTT connection to view states and contorl ESP32
  • Restarting Zigbee and enabling Zigbee BSL via webpage and MQTT
  • ESP32 firmware update via webpage
  • Automatic switching to Wi-Fi network when RJ45 is disconnected - "Emergency mode"
  • If no Wi-Fi network is available, the hotspot will be configured


MQTT

Topics

ZigStarGW-XXXX/avty

Contains the current state of the gateway connection to the MQTT broker.
When a connection is established, the payload online is published.

Using the Last Will and Testament (LWT) mechanism, if the connection is broken,
the MQTT broker will publish offline payload within 30 seconds.

ZigStarGW-XXXX/state

Contains information about the gateway. Publish every N seconds. It is set in the MQTT setting - "Update interval".
Payload example:
{"uptime":"0 d 00:00:08","temperature":"45.67","ip":"10.0.10.130","emergencyMode":"ON","hostname":"ZigStarGW"}

ZigStarGW-XXXX/cmd

Publishing messages to this topic allows you to control your gateway via MQTT. Possible commands:
{cmd:"rst_zig"} - restart Zigbee module
{cmd:"rst_esp"} - restart ESP32
{cmd:"enbl_bsl"} - enable BSL in Zigbee module

ZigStarGW-XXXX/io/rst_zig, rst_esp, enbl_bsl, emrgncMd

Status topics contain the current state of various operating modes of the gateway.
Possible states: ON or OFF



Auto Discovery

There is also a MQTT AutoDiscovery function. The following entities are available:

  • homeassistant/sensor/*
    • Uptime
    • IP
    • CPU temperature
    • Hostname
  • homeassistant/binary_sensor/*
    • Socket
    • Emergency mode
  • homeassistant/switch/*
    • Restart ESP
    • Restart Zigbee
    • Enable BSL

In the Home Assistant, in the device information section, the board model and software version will also be available.


Development

Project's build environment is based on PlatformIO. So just open platformio.ini using it.

After build PlatformIO will generate 2 file in bin folder: ZigStarGW_v*...full.bin - with integrated bootloader and partitions table bin/ZigStarGW.bin - just firmware.

Version increment made automatically by using version_increment_pre.py calling from PlatformIO and version_increment_post.py calling while Git pre commit. Use make_git_hook.sh to made it automatically.

You can not simply edit Web UI files because you will need to convert them to C arrays, which can be done automatically by a gulp script that can be found in tools/webfilesbuilder directory.

If you want to edit Web UI you will need:

  • NodeJS
  • npm (comes with NodeJS installer)
  • Gulp (can be installed with npm)

Gulp script also minifies CSS and JS files and compresses (gzip) them.

To minify and compress the frontend, enter the folder tools/webfilesbuilder and:

  • Run npm install to install dependencies
  • Run npx gulp to compress the web UI to make it ready for the ESP
    cd

Like โ™ฅ๏ธ?

"Buy Me A Coffee"

Thanks

Base code was taken from ZiGate-Ethernet

Some ideas and code snippets was taken from esp-rfid

zigstargw-fw's People

Contributors

diddlik avatar fairecasoimeme avatar mercenaruss avatar xyzroe 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.