registry: dual-publish UnitStates and add associated tests
Merge pull request #638 from jonboulle/638

Scope unit state by machine