Skip to main content

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

State Machine rendered as png

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hasmtools-0.0.2.tar.gz (38.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hasmtools-0.0.2-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file hasmtools-0.0.2.tar.gz.

File metadata

  • Download URL: hasmtools-0.0.2.tar.gz
  • Upload date:
  • Size: 38.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for hasmtools-0.0.2.tar.gz
Algorithm Hash digest
SHA256 4dbea159042058ca27d6d73ac03ba3840c6216eb75559419c3deb3c40dd0160f
MD5 db8fc01f2346c5622f5aeaec1e37b476
BLAKE2b-256 68ddb9c2ecc374baa294d6c4e797e1434a2440ad220b3ac5eff6dc812c5d66e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for hasmtools-0.0.2.tar.gz:

Publisher: publish.yml on mutax/hasmtools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hasmtools-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: hasmtools-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for hasmtools-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e0270f9421e099dfa7cfd1370618c4ed05875a1cc95a81995f118299c2fe51a4
MD5 f9aea08e5630f53890ac5dbbb2097964
BLAKE2b-256 07a71f2068f9eb399e123af373b6b9500ff9a9a44933d86a6be7dcedd9019061

See more details on using hashes here.

Provenance

The following attestation bundles were made for hasmtools-0.0.2-py3-none-any.whl:

Publisher: publish.yml on mutax/hasmtools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page