Skip to content

Complete rewrite to make adding features and fixes easier #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 42 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
de3b10e
rewrite as ESM
bytespider Oct 31, 2023
631e46b
WIP
bytespider Nov 1, 2023
244295a
added missing files
bytespider Nov 1, 2023
5f5d2d9
componentise the library
bytespider Nov 2, 2023
827ad31
keep code clean
bytespider Nov 2, 2023
9b1de7f
format to standard
bytespider Nov 3, 2023
cfaed31
Remove unneeded imports
bytespider Nov 3, 2023
bb94969
Remove debuging
bytespider Nov 3, 2023
3ff072d
Use `configure` rather then `set` to imply action over the network
bytespider Nov 3, 2023
a30ab90
rename functions and document
bytespider Dec 27, 2023
eb2e609
updated deps
bytespider Dec 27, 2023
ec2eb55
Proof read options
bytespider Dec 27, 2023
0ba0811
Update readme
bytespider Dec 27, 2023
881381b
Update readme
bytespider Dec 27, 2023
faeaba1
Update readme with requirements
bytespider Dec 27, 2023
c2f3c89
removed old api file
bytespider Dec 27, 2023
0c42ba1
updated github action
bytespider Dec 27, 2023
3a95cb6
updated version
bytespider Dec 27, 2023
e276c8b
update versions
bytespider Dec 13, 2024
a4020c6
update to use import attributes rather than import assertions
bytespider Dec 13, 2024
b4ccfb3
add docker test environment
bytespider Jan 22, 2025
bf0d3d5
remove parameters from shebang
bytespider Jan 22, 2025
8938f93
clean up ignore files
bytespider Jan 22, 2025
eb4fa81
remove VERSION file
bytespider Jan 25, 2025
cf1c3d7
add license
bytespider Jan 25, 2025
920d5ac
complete typescript rewrite. Added encrypted communication for device…
bytespider Apr 5, 2025
43bea72
removed dist
bytespider Apr 5, 2025
e0e65a9
added dist to ignore
bytespider Apr 5, 2025
b6a5e23
allow strings to be passed to base64 encode
bytespider Apr 5, 2025
011d83b
decide the protocol and the port based on the input
bytespider Apr 5, 2025
b2bc8c0
use strings not buffers
bytespider Apr 5, 2025
1a315a5
remove commented reference code
bytespider Apr 5, 2025
a4244bd
added readme and license
bytespider Apr 6, 2025
a65d52b
ip flag is not required as we default it
bytespider Apr 6, 2025
bfd5d05
fix license
bytespider Apr 6, 2025
29862da
for build and publishing
bytespider Apr 6, 2025
4e67458
for build and publishing
bytespider Apr 6, 2025
ba2a46f
fix packages
bytespider Apr 6, 2025
97bb1d4
make sure node std libraries are imported with node: prefix
bytespider Apr 12, 2025
3e0a7c8
2.0.0
bytespider Apr 12, 2025
e94d6d8
WIP
bytespider Apr 23, 2025
179521d
update version
bytespider Apr 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 23 additions & 22 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,46 @@ name: Node.js Package
on:
release:
types: [created]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 12
node-version: 18
- run: npm ci
- run: npm test

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 12
node-version: 18
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

publish-gpr:
needs: build
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
registry-url: https://npm.pkg.github.com/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
# publish-gpr:
# needs: build
# runs-on: ubuntu-latest
# permissions:
# packages: write
# contents: read
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v3
# with:
# node-version: 18
# registry-url: https://npm.pkg.github.com/
# - run: npm ci
# - run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
bin/src/node_modules
cmd/
dumps/
old_certs/
# Directories
node_modules/
dist/

# Files
*.log
6 changes: 3 additions & 3 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Directories
certs/
cmd/
dumps/
mosquito/
old_certs/
teardown/

#Files
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"arrowParens": "always",
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"useTabs": false
}
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["esbenp.prettier-vscode"]
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.detectIndentation": false,
"editor.tabSize": 2
}
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM eclipse-mosquitto:1.6.15-openssl

COPY mosquitto/basic.conf ./mosquitto/config/mosquitto.conf
RUN apk add --update --no-cache openssl && \
mkdir /mosquitto/config/certs && \
cd /mosquitto/config/certs && \
openssl genrsa -out ca.key 2048 && \
openssl req -x509 -new -nodes -key ca.key -days 3650 -out ca.crt -subj '/CN=My Root' && \
openssl req -new -nodes -out server.csr -newkey rsa:2048 -keyout server.key -subj '/CN=Mosquitto' && \
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 3650 && \
c_rehash . && \
chown -R mosquitto:mosquitto /mosquitto && \
chmod 600 /mosquitto/config/certs/*

EXPOSE 1883
EXPOSE 8883
15 changes: 15 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ISC License

Copyright (c) 2025 Rob Griffiths

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
57 changes: 47 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,58 @@
# Meross utilities

[![Node.js Package](https://github.com/bytespider/Meross/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/bytespider/Meross/actions/workflows/npm-publish.yml)

Tools to help configure the Meross devices for purpose of utilising our <a href="https://github.com/bytespider/Meross/wiki/MQTT">own MQTT servers</a>.
Tools to help configure the Meross devices to use private MQTT servers.

## Requirements

Before you can use the tool to setup your device you need to put it into paring mode and connect to it's Access Point. It's IP address is known as the `--gateway` parameter and is typically `10.10.10.1`.
NodeJS: ^21.0.0, ^20.10.0, ^18.20.0
NPM: ^10.0.0

## Home Assistant
It's possible to get these devices to work with Home Assistant (HASSIO).
<a href="https://github.com/bytespider/Meross/wiki/Home-Assistant-(HASSIO)">Setup Home Assistant MQTT</a>
## Setup

Once paired and linked to your broker, you can use the <a href="https://github.com/krahabb/meross_lan">Meross Lan</a> integration to control the devices.
TODO:
[Devices with WIFI pairing]()

[Devices with Bluetooth pairing]()

## Tools

### Info
`npx meross info [--inclide-wifi]`
Gets information from the device you are connected to in setup mode and optionally the WIFI SSID's it can see.

```
npx meross-info [options] <options>

Options:
-V, --version output the version number
-a, --ip <ip> Send command to device with this IP address (default: "10.10.10.1")
-u, --user <user-id> Integer id. Used by devices connected to the Meross Cloud
-k, --key <shared-key> Shared key for generating signatures (default: "")
--include-wifi List WIFI Access Points near the device
--include-ability List device ability list
--include-time List device time
-v, --verbose Show debugging messages
-h, --help display help for command
```

### Setup
`npx meross setup [options]`
Setup device you are connected to in setup mode

```
npx meross-setup [options] <options>

Options:
-V, --version output the version number
-a, --ip <ip> Send command to device with this IP address (default: "10.10.10.1")
--wifi-ssid <wifi-ssid> WIFI Access Point name
--wifi-pass <wifi-pass> WIFI Access Point password
--wifi-encryption <wifi-encryption> WIFI Access Point encryption (this can be found using meross info --include-wifi)
--wifi-cipher <wifi-cipher> WIFI Access Point cipher (this can be found using meross info --include-wifi)
--wifi-bssid <wifi-bssid> WIFI Access Point BSSID (each octet seperated by a colon `:`)
Copy link
Preview

Copilot AI Apr 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in the README: 'seperated' should be corrected to 'separated'.

Suggested change
--wifi-bssid <wifi-bssid> WIFI Access Point BSSID (each octet seperated by a colon `:`)
--wifi-bssid <wifi-bssid> WIFI Access Point BSSID (each octet separated by a colon `:`)

Copilot uses AI. Check for mistakes.

--wifi-channel <wifi-channel> WIFI Access Point 2.5GHz channel number [1-13] (this can be found using meross info --include-wifi)
--mqtt <mqtt-server> MQTT server address
-u, --user <user-id> Integer id. Used by devices connected to the Meross Cloud (default: 0)
-k, --key <shared-key> Shared key for generating signatures (default: "")
-t, --set-time Configure device time with time and timezone of current host
-v, --verbose Show debugging messages (default: "")
-h, --help display help for command
```
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

47 changes: 0 additions & 47 deletions bin/meross-info

This file was deleted.

103 changes: 0 additions & 103 deletions bin/meross-setup

This file was deleted.

23 changes: 0 additions & 23 deletions certs/ca.crt

This file was deleted.

Loading