Visualize Home Assistant Finite State Machines
Project description
hasmtools
A small tool to help me working with the Finite State Machine Sensor for Home Assistant by generating a png and converting the definition between JSON and YAML.
See https://github.com/edalquist/ha_state_machine for the Sensor.
Features
- write your definition in YAML instead of JSON
- convert from YAML to JSON and back
- generate an image of the state machine using graphviz
Examples
YAML input file
initial:
a: state2
b: state3
state2:
a: initial
b: state3
state3:
a: initial
b: state2
Note that in yaml the first state is the default/initial state.
Converted to JSON
$ hasmtool example.yaml example.json
{
"state": {
"status": "initial"
},
"transitions": {
"initial": {
"a": "state2",
"b": "state3"
},
"state2": {
"a": "initial",
"b": "state3"
},
"state3": {
"a": "initial",
"b": "state2"
}
}
}
Finally converted to PNG
$ hasmtool example.json example.png
An example with timeouts
source: https://github.com/edalquist/ha_state_machine/blob/main/example.json
{
"state": {
"status": "IDLE"
},
"transitions": {
"IDLE": {
"above": "STARTING"
},
"STARTING": {
"timeout": { "after": 6, "to": "RUNNING" },
"below": "IDLE"
},
"RUNNING": {
"below": "STOPPING"
},
"STOPPING": {
"timeout": { "after": 15, "to": "DONE" },
"above": "RUNNING",
"middle": "RUNNING"
},
"DONE": {
"timeout": { "after": 15, "to": "IDLE" }
}
}
}
Status
Working MVP.
Why Did I Do This?
It started with the desire to have a visualization of the FSM, then I realised I like yaml more than json for it, so one thing led to another...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hasmtools-0.0.3.tar.gz.
File metadata
- Download URL: hasmtools-0.0.3.tar.gz
- Upload date:
- Size: 90.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8471a1e1cc97e5e0b5c1fa7f3d42f3d25531fb14fb1f1183bbd3f81d692d6eb
|
|
| MD5 |
e9bd4de0db22b2ccce57ffae0c9ff51a
|
|
| BLAKE2b-256 |
84a280f59dbcd77403f3c1d65ace7e08a3cf7b8238423b8e998cac78f1bb3c14
|
Provenance
The following attestation bundles were made for hasmtools-0.0.3.tar.gz:
Publisher:
publish.yml on mutax/hasmtools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hasmtools-0.0.3.tar.gz -
Subject digest:
d8471a1e1cc97e5e0b5c1fa7f3d42f3d25531fb14fb1f1183bbd3f81d692d6eb - Sigstore transparency entry: 154108705
- Sigstore integration time:
-
Permalink:
mutax/hasmtools@44af3917e719487dd1f40eb611030495834b65cd -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/mutax
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@44af3917e719487dd1f40eb611030495834b65cd -
Trigger Event:
release
-
Statement type:
File details
Details for the file hasmtools-0.0.3-py3-none-any.whl.
File metadata
- Download URL: hasmtools-0.0.3-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52f395258b46830d434d1d114f7eb810020b966339c829c1be9738a234ceb1a4
|
|
| MD5 |
e7d1f518d4601610bd42e07998fff2e8
|
|
| BLAKE2b-256 |
072159b0ba73c200f3ae36f5f632d7028b3ad55d72288d69cf413bb5e7bc80c5
|
Provenance
The following attestation bundles were made for hasmtools-0.0.3-py3-none-any.whl:
Publisher:
publish.yml on mutax/hasmtools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hasmtools-0.0.3-py3-none-any.whl -
Subject digest:
52f395258b46830d434d1d114f7eb810020b966339c829c1be9738a234ceb1a4 - Sigstore transparency entry: 154108706
- Sigstore integration time:
-
Permalink:
mutax/hasmtools@44af3917e719487dd1f40eb611030495834b65cd -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/mutax
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@44af3917e719487dd1f40eb611030495834b65cd -
Trigger Event:
release
-
Statement type: