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

FSM example

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.1.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.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hasmtools-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 e871f92a413041aa5b5e70f2e694414a36040890e006c234cf8ab70578891d3d
MD5 75ffed00800a44005c3c98f92a0546e0
BLAKE2b-256 3c6bcaf23ee5e14484dfcb31c0729a6dbb33e5ab10e36f580c6ba90d41c77d6b

See more details on using hashes here.

Provenance

The following attestation bundles were made for hasmtools-0.0.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: hasmtools-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 81cc5b52d5b554ae8425caf2f3a7d5d499145ee445f3c809876cf044708b60ba
MD5 27351e8f91c44f7cb69895e600fc8224
BLAKE2b-256 67855d323352612113ffa6691963d055a4695fa33caa8afe5cbcf26b82364e13

See more details on using hashes here.

Provenance

The following attestation bundles were made for hasmtools-0.0.1-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