Git Product home page Git Product logo

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

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zigstargw-fw's Issues

ZigStar Ethernet GW: get MQTT socket state and reboot cmd

Hello.

I have bought your ZigStar Ethernet GW which is working very well and I really appreciate it (it's working inside a DIN rail box).
It is absolutely worth the money. Great work!

Even the MQTT functionality (sending information of the GW itself) comes in very handy.
I have noticed the following behavior while having the GW running:

  1. socket report over MQTT
    When the GW was started and zigbee2mqtt is online, the GW reports socket as ON. Unfortunately after almost 5 days the GW reports socket OFF, but zigbee2mqtt is still online. Even when I check the ZigstarGW web interface, it states there socket is online by a green check mark.
    When I restart zigbee2mqtt or the GW it reports socket ON again. But 5 days later it reports socket OFF.
    All other MQTT reports, e.g. temperature, are still working fine.

  2. Web interface of the GW
    About ten days after the socket is reported as OFF the web interface of the GW becomes unreachable.

I tried to reboot the GW be sending out "ZigStarGW-9549/cmd {cmd:"rst_esp"}" but it didn't help in both cases. I have to power it off and on to get the web interface back and I have to restart zigbee2mqtt to get the socket state.

  1. restart Zigbee module
    Because of 1) and 2) I even tried the MQTT command ZigStarGW-9549/cmd {cmd:"rst_zig"} to restart the Zigbee module. I tested it several times and after that the Zigbee system stopped its communication. I had to take off the GW's power again.

Could you please help me with these questions:
Is it possible to implement:

  • a MQTT set command what reboots the entire GW?
    So I could be able to reboot it periodically.
  • a MQTT get command which gets the actual socket state?
    So I could send it out of my smart home system periodically and pull the information actively.
  • What does the MQTT command "{cmd:"rst_zig"} - restart Zigbee module" exactly do?

Thank you very much and kind regards

---------- some screenshots ---------------------------
socket state in ZigStar webif
ZigstarGW_MQTT_state_in_smarthome

socket state in my smart home system
ZigstarGW_webif

Ability to disable emergency mode

Some people have problems with false activation of emergency mode when their local internet gateway does not respond to ping from ZigStar.

Add the ability to disable ping control or completely disable emergency mode.

Ability to reset login password

Unfortunately, it always happens that you assign a password and forget it. Without resetting the device, it would be good to have the possibility to reset it.

DS18B20 sensor is not queried

On the new Olizig POE, DS18b20 sensor is not polled. Most likely it is due to the configuration,
the OliZig gets borad id = 1, but when querying the sensor, board id = 2 is expected. See below:

grafik

grafik

Issue with starting z2m after addon last update

Hi. Faced with a problem - addon z2m does not start after its last update. The settings of the addon are not changed. It's standard: port: tcp://ip:6638. All available to me ways to fix the problem did not help. I checked the connection on a clean HA instance with a clean z2m addon with a new network on a new channel. I cleared NVRAM of the device/ Re-flashed it with the latest firmware. The result is always the same.

[10:24:26] INFO: Preparing to start...
[10:24:27] INFO: Socat not enabled
[10:24:27] INFO: Starting Zigbee2MQTT...
Zigbee2MQTT:info 2024-01-22 10:24:28: Logging to console and directory: '/config/zigbee2mqtt/log/2024-01-22.10-24-28' filename: log.txt
Zigbee2MQTT:info 2024-01-22 10:24:28: Starting Zigbee2MQTT version 1.35.1 (commit #unknown)
Zigbee2MQTT:info 2024-01-22 10:24:28: Starting zigbee-herdsman (0.30.0)
Error: Reset error: Error: {"sequence":-1} after 10000ms
at /app/node_modules/zigbee-herdsman/src/adapter/ezsp/driver/uart.ts:299:23
at Queue.executeNext (/app/node_modules/zigbee-herdsman/src/utils/queue.ts:32:32)

How can I fix it?

Two indentical coordinators conflict

I'm using 2 LAN POE coordinators in my 2 Z2M instances. Changed their hostnames and topics, but the ESP32 MQTT monitor is under conflict because it claims the device is already conected (see the broker log)

It seems it keeps using the standard device name "ZigStarGW-7348" for both disregarding the change in hostnames

image

First coordinator
image
image

Second one
image
image

'dict object' has no attribute 'ow_temperature' when rendering '{{ value_json.ow_temperature }}'

It looks like ow_temperature is only conditionally set here:

ZigStarGW-FW/src/mqtt.cpp

Lines 111 to 114 in 542995c

if (OWWstrg != "0.00" && OWWstrg != "255")
{
root["ow_temperature"] = OWWstrg;
}

But it's always sending this: https://github.com/xyzroe/ZigStarGW-FW/blob/main/src/mqtt.cpp#L409

I think that's what is ultimately causing this to bubble up in home assistant:

Logger: homeassistant.helpers.template
Source: helpers/template.py:1822
First occurred: 2:10:43 PM (163 occurrences)
Last logged: 4:52:47 PM

Template variable warning: 'dict object' has no attribute 'ow_temperature' when rendering '{{ value_json.ow_temperature }}'

I'm not positive what the fix is, but it seems we shouldn't be publishing that template value when it's not present in value_json

Include BTHome gateway

Hi.

I think it could be really useful to have support for BTHome (passive reporting of BLE advertising packets), since the ESP32 RF remains otherwise unused.
In ESPHome it's really easy to add:

esp32_ble_tracker:

bluetooth_proxy:
  active: true

but IIUC ESPHome support is discouraged.

Tks,
Diego

UZG01 stopped working until Zigbee module restart

Hello,

I bought the Zigstar UZG01 to stabilize my zigbee network.
So far, things are better but not perfect yet as I had a few hic-hups.
Since my automation rely on some zigbee device, I want to tend to zero fault which is why I will spend time reporting problems in the hope to improve the product hence my network stability.

All of a sudden my zigbee network stopped working.
I checked the Z2M logs and all lines going on error at one point in time (2024-03-22 15:03:06).

info  2024-03-22 15:02:01: MQTT publish: topic 'zigbee2mqtt/Oven', payload '{"child_lock":"UNLOCK","current":0,"energy":187.96,"indicator_mode":"off/on","last_seen":"2024-03-22T14:02:01.824Z","linkquality":51,"power":0,"power_outage_memory":"on","state":"ON","update":{"installed_version":-1,"latest_version":-1,"state":null},"update_available":null,"voltage":
238}'
info  2024-03-22 15:02:02: MQTT publish: topic 'zigbee2mqtt/Kitchen Boiler', payload '{"child_lock":"UNLOCK","current":0,"energy":411.24,"indicator_mode":"off/on","last_seen":"2024-03-22T14:02:02.241Z","linkquality":98,"power":0,"power_outage_memory":"on","state":"ON","update":{"installed_version":-1,"latest_version":-1,"state":null},"update_available":null,
"voltage":238}'
error 2024-03-22 15:03:06: Publish 'set' 'state' to 'always_on_plugs' failed: 'Error: Command 1 genOnOff.on({}) failed (SRSP - AF - dataRequestExt after 6000ms)'
error 2024-03-22 15:03:40: Publish 'set' 'brightness' to 'Office Lamp' failed: 'Error: Command 0x0c4314fffeede29d/1 genLevelCtrl.moveToLevelWithOnOff({"level":254,"transtime":0}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":false,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactio
nSequenceNumber":null,"writeUndiv":false}) failed (SRSP - AF - dataRequest after 6000ms)'
error 2024-03-22 15:03:46: Publish 'set' 'brightness' to 'Office Lamp Desk 1' failed: 'Error: Command 0x84b4dbfffef8c619/1 genLevelCtrl.moveToLevelWithOnOff({"level":254,"transtime":0}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":false,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"tra
nsactionSequenceNumber":null,"writeUndiv":false}) failed (SRSP - AF - dataRequest after 6000ms)'
error 2024-03-22 15:03:52: Publish 'set' 'color_temp' to 'Office Lamp' failed: 'Error: Command 0x0c4314fffeede29d/1 lightingColorCtrl.moveToColorTemp({"colortemp":250,"transtime":0}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":false,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transa
ctionSequenceNumber":null,"writeUndiv":false}) failed (SRSP - AF - dataRequest after 6000ms)'

I first restarted Z2M but it failed to attach to the UZG:

info  2024-03-22 17:53:46: Logging to console and directory: '/config/zigbee2mqtt/log/' filename: zigbee_2024-03-22.17-53-46.log
info  2024-03-22 17:53:46: Starting Zigbee2MQTT version 1.36.0 (commit #unknown)
info  2024-03-22 17:53:46: Starting zigbee-herdsman (0.35.1)
error 2024-03-22 17:54:06: Error while starting zigbee-herdsman
error 2024-03-22 17:54:06: Failed to start zigbee
error 2024-03-22 17:54:06: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
error 2024-03-22 17:54:06: Exiting...
error 2024-03-22 17:54:07: Error: Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)
    at ZStackAdapter.start (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/zStackAdapter.ts:103:27)
    at Controller.start (/app/node_modules/zigbee-herdsman/src/controller/controller.ts:132:29)
    at Zigbee.start (/app/lib/zigbee.ts:62:27)
    at Controller.start (/app/lib/controller.ts:109:27)
    at start (/app/index.js:107:5)

I then connected to the UZG web interface.
All seemed fine (pages where refreshing correctly).

I went to "System and Tools" then "System Control" and clicked "Zigbee Restart".
I then restarted Z2M and all went fine.

The UZG01 uptime was around 7d on Ethernet.

The Device information is:
Model: UZG-01
ESP32 Firmware ver: 0.1.5 (2023-09-06 12:01:02.723464)
ESP32 version: ESP32-D0WDQ6
ESP32 temperature: 47.00 °C
ESP32 frequency: 2 cores @ 240 MHz
ESP32 flash size: 4 Mb, external
ESP32 Free heap: 189 / 289 KiB
CC2652P version: CC2652PP1FRGZR
CC2652P flash size: 352 Kb

I believe I should upgrade the UZG01.

If you have no idea what could have gone wrong, what information can I provide next time before taking actions ?
Should I have taken a look at the "System and Tools" / "System Tools" / "Debug console" ?

Thank you in advance,

Pierre

Fails to boot after power outage.

It seems like my GW (Zigstar LAN Gateway with 0.6.4 fw)) fails to boot correctly after power outage when the power returns.

I have done some testing and it seems like the GW is unable to boot properly if the switch its hooked up to not gets enough time to boot BEFORE the GW. That little green led on the ethernet port just glows a little at this moment.
After the switch is up and running i can power cycle the GW again and the led immediately lights up fully and connects.

Is there any solution for this? Suggestions?

Ethernet shows disconnected after update to 0.6.8

After the update the status for my Ethernet connection says it's not connected.

However, I am browsing the web interface on the IP address i configured on the Ethernet port.

I can ping the unit on both the Ethernet IP and the WIFI IP

see screenshot for details:
image

Dallas DS18b20 sensor suddenly only 0C°

At first everything worked fine. The values of dallas were about on the level of ESP Sensor. The coordinator was not even touched. Still works fine, only dallas sensor no longer and delivers only 0

grafik

Cannot connect to mosquitto mqtt running as HA addon

I'm trying to have zigstar GW connect to mosquitto MQTT server running as HA addon (HA supervised) and getting these errors

2022-09-07 22:23:49: Client <unknown> disconnected, not authorised.
2022-09-07 22:24:34: New connection from on port 1883.

I tried these settings
(password is from home assistant integration where it says core-mosquitto etc.)
image

and also
image

while having config like this
image

zigbee2mqtt connects and communicates no problem whatsoever

mercenaruss/zigstar_gateways#20

Any ideas why it does not connect?

Delay on outgoing packets send while high load on Zigbee network

While the network coordinator is loaded with constant incoming traffic (at least 1 message every second) outgoing requests from z2m are sent with a delay.
There is no delay in receiving incoming packages in any conditions.

FW version: 0.6.0

Если сетевой координатор будет загружен постоянно входящим трафиком каждую секунду и в этом момент делать запросы на исходящие действия то действия выполняются с таймингом задержкой. FW version : 0.6.0

[REQUEST] Zeroconf DNS TXT records parameters in ZigStarGW-FW to support Home Assistant ZHA network discovery #7

@xyzroe Please consider adding Zeroconf DNS TXT Reconds parameters in your firmware for automatic ZHA network discovery, see:

https://community.home-assistant.io/t/zha-automatic-network-discovery-of-zigbee-coordinator-bridges-gateways-ethernet-wifi-network-adapters-that-support-zeroconf/293300

This was previously requested for the original ZigStar gateway firmware here:

mercenaruss/zigstar_gateways#2

As you can see there, Home Assistant needs not only a service to be presented via Zeroconf but also parameters via Zeroconf DNS TXT records which include radio_type, baud_rate, and data_flow_control, which ZHA config flow use during initial configuration. Once your firmware provide those via Zeroconf then patches can be submitted to Home Assistant core which both makes its Zeroconf whitelist it for discovery as well as pass it along to the ZHA domain which uses the DNS TXT record parameters and puts them into the config flow to ZHA. What this achieved is that the user get a pop-up notification that a new device has been discovered and if they use they can go in to get your adapter automatically configured which makes the whole process very user-friendly to new users.

Since you based your new firmware on ZiGate-Ethernet you might also be interested in this same request posted to fairecasoimeme:

fairecasoimeme/ZiGate-Ethernet#7

PS: Please note I'm just a big fan Zigbee based hardware and of the ZHA integration in Home Assistant (as well as the zigpy project which it depends on) but do not actually own a ZigStar. My only wish with this request is to make it easier for users to get started.

Update available - sensor for Home Assistant

It would be great to have a nice to have function regarding the update functionality.
Currently when calling the page comes a toaster with the notice about a new version.
This would also be very nice as a sensor in Home Assistant.
Possibly like WLED: an update button that directly starts the update process.
grafik

Flash cc2538//cc2652 from WebUI

Hey

We're currently like to be able to download the firmware for cc2538/cc2652 from the internet and flash it to the controller just by using the ZigStarGW-FW WebUI.
To do that, we would be happy to fork it, implement it and if course do a pullrequest on your main repo to give it back to the community. So it's not exactly a feature request but just a request for information on your thoughts about this.

My main question is:
I currently suspect that your reason to develop a the firmware downloader in python and flash over TCP is that you would like to make it compatible to other controllers without touching the firmware, but just patching the code on python level.
Did you have any other reasons not to do it in the Arduino Firmware which I currently don't see?

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.