Skip to content

v1.8.0

Choose a tag to compare

@github-actions github-actions released this 23 Oct 11:55
· 41 commits to main since this release
v1.8.0
0154c67

Stewart 1.8 means fewer copies and fewer typos: call actions by the names Home Assistant uses, run one app class for
every room, and let PhpStorm and PHPStan catch a mistyped entity ID or action name before Home Assistant sees it.

Highlights

Call actions by their names. callAction() takes the action as Home Assistant writes it, the same name you see
under Developer tools → Actions:

$this->ha->callAction('light.turn_on', ['brightness_pct' => 60], ServiceTarget::forEntities('light.hall'));
$this->ha->getEntity('lock.front_door')->callAction('lock');

callService('light', 'turn_on', …) still works, but each call prints a deprecation line, and 2.0 removes it. The
upgrading guide has a one-line command that rewrites the old calls. The guide is now
Call actions.

One class, several apps. Mark a class #[AppTemplate], then give each copy an entry with its own ID and options:

apps:
  hall-motion-light:
    class: App\MotionLight
    options:
      motionSensor: binary_sensor.hall_motion
      light: light.hall
  landing-motion-light:
    class: App\MotionLight
    options:
      motionSensor: binary_sensor.landing_motion
      light: light.landing

Each entry is an app of its own in the logs, make status and the store. The class can also come from a Composer
package. make app NAME=MotionLight TEMPLATE=1 writes one with its test, and the
motion light recipe has a complete one.

Typos caught before deploy. After make generate, PhpStorm completes entity IDs in getState(),
watchStateChanges(), ServiceTarget::forEntities() and the other methods that take one, and action names in
callAction(). The new stewart-php/phpstan extension makes make stan fail on a name Home Assistant does not
have, and names the closest one:

  24     Entity ID "light.porhc" was not in Home Assistant at the last stewart generate. Did you mean
         "light.porch"?
         🪪  stewart.entityId

New projects have it. Typos caught by PHPStan
shows how to add it to an existing project.

Also new

  • http.metrics.listen serves /metrics on a port of its own, with a token of its own or none, so Prometheus no
    longer needs the token that can pause apps. The Helm chart opens it with metrics.enabled, scrapes it with
    metrics.podMonitor, and can lock the pod down with an optional NetworkPolicy.
  • stewart check and stewart doctor report an admin port without a token before the daemon refuses to start, and
    the admin API warns when it listens beyond this host.
  • Raw states have isOn() and isOff(), and the test harness matches option names the way Stewart does.

Upgrading

Run make upgrade VERSION=1.8, then make generate, then restart Stewart. The generated classes move to a new
format; until you regenerate them, each generated call prints a deprecation line. On Kubernetes, move
adminApi.podMonitor to metrics.podMonitor. The
upgrading guide has the details, including the command that
moves your code to callAction() and how to add the PHPStan extension.


Every change is in the changelog.