https://github.com/ctron/hat
Eclipse Hono™ Admin Tool
https://github.com/ctron/hat
eclipse-hono eclipse-iot iot
Last synced: about 2 months ago
JSON representation
Eclipse Hono™ Admin Tool
- Host: GitHub
- URL: https://github.com/ctron/hat
- Owner: ctron
- License: epl-2.0
- Created: 2018-11-14T16:09:25.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-17T16:35:31.000Z (almost 5 years ago)
- Last Synced: 2025-04-01T08:26:20.641Z (3 months ago)
- Topics: eclipse-hono, eclipse-iot, iot
- Language: Rust
- Homepage:
- Size: 205 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# HAT – Hono Admin Tool [](https://github.com/ctron/hat/releases)
Getting help:
hat --help
## Global switches
Temporarily use a different context (with `-c` or `--context`):
hat -c context2 device create …
Or override a tenant (with `-t` or `--tenant`):
hat -t my.tenant device get …
## Managing contexts
Create a new context:
hat context create foo https://device-registry.hono.my
Create a new context with credentials:
hat context create foo https://device-registry.hono.my --username --password
Create a new context, using local Kubernetes token:
hat context create foo https://device-registry.hono.my --use-kubernetes
Update an existing context:
hat context update foo --url https://device-registry.hono.my
hat context update foo --username --password
hat context update foo --use-kubernetesDelete an existing context:
hat context delete foo
Switch to an existing context:
hat context switch foo
List existing contexts:
hat context list
### Default tenant
It is possible to set a *default tenant*, which is used on all calls when using
this context.Set a default tenant when creating a context:
hat context create foo https://device-registry.hono.my --tenant
Or update later:
hat context update foo https://device-registry.hono.my --tenant
It is possible to override the default tenant with `-t` or `--tenant`:
hat device create -t my-tenant 4711
Or by setting the environment variable `HAT_TENANT`:
HAT_TENANT=foo hat device create 4711
## Tenants
Creating a new tenant:
hat tenant create my-tenant
Creating a new tenant with payload:
hat tenant create my-tenant '{"enabled": false}'
Getting a tenant:
hat tenant get my-tenant
Deleting a tenant:
hat tenant delete my-tenant
Enable/Disable a tenant:
hat tenant enable my-tenant
hat tenant disable my-tenant
## Device registrationsRegister a new device:
hat device create 4711
Register a new device with payload:
hat device create 4711 '{…}'
Inspect the device:
hat device get 4711
Enable/Disable a device:
hat device enable 4711
hat device disable 4711### Set via
You can also set the "via" attribute directly:
hat device set-via 4711 my-gw
### Set defaults entry
Set a defaults entry using:
hat device set-defaults 4711 key value
The value will be converted into a JSON value. If it cannot
be parsed, it will be stored as a string (depending on the
shell you are using, you might need different quotation marks):hat device set-defaults 4711 key true # Booolean: true
hat device set-defaults 4711 key '"true"' # String: true
hat device set-defaults 4711 key 123 # Number: 123
hat device set-defaults 4711 key '"123"' # String: 123
hat device set-defaults 4711 key foobar # String: foobar
hat device set-defaults 4711 key '{"foo":123}' # Object: {"foo":123}Delete an entry by omitting the value:
hat device set-defaults 4711 key value
## Credentials
Replace credentials:
hat creds set device1 '[]'
Clear all credentials:
hat creds set device1
Add a password:
hat creds add-password device1 sensor1 password
Set password as only password:
hat creds set-password device1 sensor1 password
Set password with pre-hashed password:
hat creds set-password device1 sensor1 password --hash sha-512
Set PSK:
hat creds set-psk device1 sensor1 PSK
Enable X509:
hat creds enable-x509 device1 sensor1