That post of mine is over four years old. There have been dozens of new versions of Home Assistant released since then providing many new features, including Blueprints.
I suggest you use a ready-made blueprint for this application. Here are two examples but there are others in the Blueprint Exchange section of the community forum.