Power states

I’m starting to implement an HA installation and have a number of automations that will have different behaviours base on power availability and cost. Example might be to delay a heating cycle until cheap rate power is available. I work in the automotive industry and we use an abstracted power state machine that all systems and functions subscribe to. This lets us manage the systems power management and functional behaviour and abstracts it away from the physical hardware. It means we can change suppliers/ power supply components etc without having to re-engineer the entire electrical system.
Before I go off and create my own, is there a standard mains power state function that exists in Home Assistant that reports existing energy supply status? I’m thinking of states like Standard rate, Peak rate, Cheap rate, Free electricity, Solar available etc?

No such function exists. There are far too many different billing schemes.

This is usually implemented by creating template sensors or template binary sensors for your specific supplier. e.g. I only have peak and off-peak rates so I use:

  - binary_sensor:
      - name: "Peak Rate"
        unique_id: de98f85a-61be-46e7-92fd-d34320b80e4e
        icon: "mdi:power-plug"
        state: >
          {% if states('binary_sensor.is_dst')|bool(0) %}
            {{ (now().weekday() < 5) and ( (7 < now().hour < 11) or (16 < now().hour < 22) ) }}
          {% else %}
            {{ (now().weekday() < 5) and ( (6 < now().hour < 10) or (15 < now().hour < 21) ) }}
          {% endif %}

There is a morning and evening peak rate except on weekends and the hours or these periods change with daylight savings.

That’s the entire purpose of generating an abstraction. Each supplier has their own tariffs and charging structures and it would require each HA installation to have a specific power management integration. By using an abstraction it would allow generic blueprints and automations to be generated that could be used by all installations. It would then require a small script or template update to adapt the abstraction to the chosen supplier.
Automations would have a generic power state entity to refer to and could be created in a more generic and re-usable way.

Not sure what you are going on about. I just answered your question:

Feel free to open a feature request.