Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Home Assistant

Options
1121315171824

Comments

  • Registered Users Posts: 6,098 ✭✭✭emaherx


    "Ive picked up a cheap hive setup and plan to swap the Shelly for the hive receiver as blackadder suggests it can be integrated into zha and has manual override buttons, which will be nice"

    Having manual wall controls was the priority with my setup from the start, it really makes sense that anyone can use the heating controls without needing access to an app or even needing to know that HA is running the show. Having said that ever since adding a touch screen running HA in a Kiosk browser the physical wall stats are hardly ever touched. But a simple +/- control on a wall is easy to explain to even the most luddite babysitter.



  • Registered Users Posts: 385 ✭✭comete


    Exactly my reason for investigating alternatives. I spent too long this time last year looking for something with a manual override, but the tuya switches you have either can’t be got through Amazon anymore, or are too expensive from alternative sellers. I made a HA screen for wife’s phone app with a big central heating boost button, so the lack of manual switch has been a non-issue, but I still want one for when parents are over.



  • Registered Users Posts: 385 ✭✭comete


    The results are in, hive, although zigbee, does not provide the functionality I was expecting without the hub and linked to zha.

    You cannot use the receiver without pairing a thermostat. Once paired it exposes a climate entity, but you can only use the temperature sensor of the actual hive thermostat and not additional peripheral temperature sensors with a min/max helper, and probably not trvs with in built temperature sensors. It doesn’t expose a boost in HA although the buttons on the receiver and the boost buttons on the thermostat boost for 1 hour.

    I was hoping I could use the receiver alone but unfortunately that’s not the case, so the Shelly stays for now.



  • Registered Users Posts: 6,098 ✭✭✭emaherx


    Does it show up as a thermostat in HA? or just a temperature sensor?

    If it shows up as a thermostat do the +/- buttons increase/decrease the set temperature in HA and likewise does adjusting in HA change the set temperature on the physical Hive thermostat?

    Have you got the Hive TRV's too?



    Edit:

    This thread suggests, that it may be possible to get the other device and boost functions working.

    https://community.home-assistant.io/t/can-i-integrate-hive-active-heating-into-ha-without-the-hive-hub/246728/38



  • Registered Users Posts: 385 ✭✭comete


    It shows up as a thermostat and yes changing the target temperature in HA will update the physical thermostat, so on a basic level it does work, but no boost button is exposed in HA, and you can’t use additional alternative temperature sensors. If you weren’t considering zoning in HA it would work great.

    I don’t have hive trvs, was planning to get aqara trvs.

    I was hoping the receiver would just function like a relay with a button on the front, and I could treat it like the Shelly I’m currently using.



  • Advertisement
  • Registered Users Posts: 6,098 ✭✭✭emaherx


    Of course you can use as many additional temperature sensors in HA as you like including TRV's so it can definitely be still used as part of a multi zone setup.

    Others have claimed to get the boost button working, perhaps you need to manually subscribe to the topic?

    And also the other receiver device but it seems it needed to be paired with HA first.


    You probably need to leave the thermostat in manual mode and forget about any scheduling/program modes it has then use HA for managing those.



  • Registered Users Posts: 385 ✭✭comete


    It’s possible I’m missing a trick, but when linked to zha I’m not getting a simple on/off button in HA - it only exposes a climate entity, which looks the same as the generic thermostat in HA. I don’t really know how to link an existing temperature sensor to that, unless I set some automation to boost the heating (when I figure out how to do that) until the required set point in that room has been hit. Even then I think temperature boost is fixed at 1 hour so it’ll just overshoot the set point when it calls for temperature.

    My medium term plan was to have a temperature sensor in each bedroom, combined into a “minimum sensor” so that it always looks at the coldest room in a generic thermostat, calling the boiler on when any of the rooms drop below the set point.

    Longer term I plan to have trvs in each room, but either way the only way around this would be to call a 1 hour heating boost from the hive when any room drops below the set point. It’s not as neat a solution I had hoped for.



  • Registered Users Posts: 385 ✭✭comete


    Some digging suggests zigbee2mqtt might unlock some of the features I can’t manage in zha, but I don’t know if I want to go down the road of migrating everything over just to check, so might pick up an additional zigbee usb to test run it.



  • Registered Users Posts: 9 vaperhead82


    I have set up Hive with my HASS using zigbee2mqtt. I used the Hive integration previously, but changed to z2m to get rid of the extra hive hub. I have to say it works really well. The boost mode can be triggered with the thermostat or my automation (schedule). In the schedule I've added extra conditions that is only triggered in someone is at home and that the temp outside is lower than 10 degrees Celsius.





  • Registered Users Posts: 385 ✭✭comete


    This looks really good!

    I migrated everything over to z2m on the weekend and spent a quiet work day yesterday playing with hive in z2m. I got to a state of being able to trigger a heating and hot water (my current setup does not have the ability to control water but I was hoping this would expose something I could use as a trigger for a shelly/contactor at the water tank, which I could) boost from home assistant, the thermostat, or the receiver (but I noticed triggering it from the receiver set it to a fixed 22 degrees that you could then change on the thermostat or home assistant). I was also able to use the climate entity which would update the thermostat if set in ha, or vice versa, great. Much better than I fared with zha.

    Where i am still struggling is using temperature sensors that aren’t the hive thermometer to always take a reading from the coldest room as the current temperature, and where I can’t yet get my head around is how I could eventually introduce TRV’s in each room. I am certain someone much more intelligent than I am will eventually figure it out, but as it stands I think my current setup (shelly 1pm replaced timer switch for boiler) will be much easier to expand.



  • Advertisement
  • Registered Users Posts: 6,098 ✭✭✭emaherx



    Where i am still struggling is using temperature sensors that aren’t the hive thermometer to always take a reading from the coldest room as the current temperature, and where I can’t yet get my head around is how I could eventually introduce TRV’s in each room.

    If you have all temperature sensors setup as thermostats from HA then it is fairly simple to achieve with automations to have the boiler switch on based on which ever room is coldest. You can create groups of thermostats that track the same set temperatures this way. You may only get the hive to display the temperature of the room its in, but the other thermostats track the temperature adjustments, these other thermostats whether actual thermostats or sensors made into generic thermostats don't have to be displayed in Lovelace if you don't want them to.


    You can have thermostats follow

    Or Enable/Disable based on heating/not heating


    Post edited by emaherx on


  • Registered Users Posts: 385 ✭✭comete


    The issue comes from the link between the hive receiver and the hive thermostat - the receiver only exposes a climate entity with the local temperature reading from the thermostat, and not an on/off switch. The receiver needs the thermostat linked to function properly, and the hive thermostat only exposes a battery entity, everything else is shown as receiver entities.



  • Registered Users Posts: 6,098 ✭✭✭emaherx


    Ah, that's exactly the issue I have with my thermostats, so they are mapped like above to generic thermostats then you can set a relay (or Boolean switch) to be the on/off load.


    I used Booleans with mine and grouped them to control the boiler.


    This is the automation I use to map the actual thermostat with no on/off load onto a virtual one with a Boolean switch as the on/off load.




  • Registered Users Posts: 2,493 ✭✭✭ECO_Mental


    What's the story with Zigbee2MQTT....what are the advantages over normal Zigbee?

    I just got one of those Sonoff Zigbee 3.0 dongle and I was trying to set it up as Zigbee2MQTT as everybody does but for some reason but I couldn't flash the dongle as my computer wouldn't recognize the dongle as I think it didn't have the driver to it.

    Anyway I got fed up with it and just plugged it into my RPi4 and it worked no probs as plain auld Zigbee and picked up a couple of Aqara temp sensors I got and seem to be working great? (apart from signal loss to a few of the far off sensors but I am getting a could of Sonoff smart plugs to act as signal repeaters.

    Anyway is it worth the hassle of trying again to get this Zigbee2MQTT working?

    Thanks

    6.1kWp south facing, South of Cork City



  • Registered Users Posts: 385 ✭✭comete


    I have a conbee 2, originally set up with zha and was working great, tried to integrate something that wasn’t as well supported in zha so decided to migrate to zigbee2mqtt and while the device I was trying to integrate exposed more in zigbee2mqtt, I found that overall it didn’t work as well as zha, so I migrated back to zha.

    If zha is working and you like it, keep with that.



  • Registered Users Posts: 6,829 ✭✭✭Alkers


    Is there a good site / YouTube channel tutorial for getting HA setup from scratch?

    We've solar, hue lighting, smart plugs, robo hoover etc currently controlled from Google home currently. Happy enough with that but primarily interested in energy management side of ha



  • Registered Users Posts: 7,731 ✭✭✭Raoul


    I think everything smart home is one of the best out there on YouTube.



  • Registered Users Posts: 4,941 ✭✭✭paulbok


    Agreed, probably the most up to date as well for installing. Lots of videos on YouTube about setting up but are years old and Home Assistant has come on a lot since.



  • Registered Users Posts: 1,508 ✭✭✭Manion


    Id have thought it straight forward, but seemingly not. Can anyone give me a steer on configuring day night meter energy usage and costs in home assistant. Ideally I’d like to be able to put the stats in fluxdb for graffana graphing. I’ve a Shelly EM tracking it consumption.

    separately, why would one want to use mqtt over the normal Shelly integration? The normal one seems to work fine and the guides assume you already know why you would want mqtt. Is it just for local control?



  • Registered Users Posts: 7,058 ✭✭✭10-10-20


    Good question. I'm making a mistake somewhere with mine too and it's somewhat working.

    Got the tariffs setup for hourly/daily/monthly in configuration.yaml:

    utility_meter:
     hourly_energy:
       source: sensor.shelly_em_esb_meter_channel_1_energy
       name: ESB Meter Hourly Electrical Energy
       cycle: hourly
       tariffs:
         - peak
         - offpeak
     daily_energy:
       source: sensor.shelly_em_esb_meter_channel_1_energy
       name: ESB Meter Daily Electrical Energy
       cycle: daily
       tariffs:
         - peak
         - offpeak
     monthly_energy:
       source: sensor.shelly_em_esb_meter_channel_1_energy
       name: ESB Meter Monthly Electrical Energy
       cycle: monthly
       tariffs:
         - peak
         - offpeak
    

    Have the automation setup in automations.yaml

    - id: '1634335289003'
     alias: ESB Meter Electricty Meter Tariffs
     description: Day and Night PEAK Tariffs
     trigger:
     - platform: time
       at: 08:11:00
       variables:
         tariffs: peak
     - platform: time
       at: 23:11:00
       variables:
         tariffs: offpeak
     action:
     - service: select.select_option
       target:
         entity_id: select.daily_energy
       data:
         option: '{{ tariffs }}'
     - service: select.select_option
       target:
         entity_id: select.monthly_energy
       data:
         option: '{{ tariffs }}'
    

    But that's not following the documentation where they show "tariffs" in configuration.yaml, but "tariff" in the automation.

    I changed it all to "tariffs" and it seems to accumulate, but I can't seem to integrate those individual sources into the Energy dashboard, but I am getting daily data for peak and offpeak, I just can't format it in a reasonable graph:

    What does yours look like?



  • Advertisement
  • Registered Users Posts: 2,393 ✭✭✭Grassey


    @10-10-20 If it's any use this is what I have.

    [I have been meaning to return to it as I've some CT clamps to add to the fusebox and monitor ESB incoming so I can have (Total - Monitored Individuals = Unmonitored everything else)

    I can't remember specifically why I did it this way (possibly because it worked... or maybe as I've 15 odd power meter plugs, and every bulb is linked to powercalc so I could monitor everything individually and grouped), there was a lot of googling and trying different things, but I do remember having issues with getting the utility meter approach above working in the dashboad.


    # energy_unit_rates.yaml
    # https://community.home-assistant.io/t/an-approach-to-both-detailed-and-group-level-energy-management/393261/11
    # Setting variable time of use price values to be used by utility_meter
    #
    input_number:
      energy_tou_rate_day:
        name: Day Rate Unit
        icon: mdi:currency-eur
        mode: box
        unit_of_measurement: "EUR/kWh"
        min: 0.001
        max: 1
        initial: 0.4724
      energy_tou_rate_night:
        name: Night Rate Unit
        icon: mdi:currency-eur
        mode: box
        unit_of_measurement: "EUR/kWh"
        min: 0.001
        max: 1
        initial: 0.3488
      energy_tou_rate_peak:
        name: Peak Rate Unit
        icon: mdi:currency-eur
        mode: box
        unit_of_measurement: "EUR/kWh"
        min: 0.001
        max: 1
        initial: 0.5752
    
    
    # Day 8 - 5, 7 -11
    # Night 11 -8
    # Peak 5 -7
    template:
      - trigger:
          - platform: time_pattern
            seconds: "/1"
          - platform: homeassistant
            event: start
          - platform: event
            event_type: "call_service"
            event_data:
              domain: "template"
              service: "reload"
        sensor:
          - name: energy_tou_tariff
            unique_id: e09d54cbfd1e4511a66a847f25e246ef
            icon: mdi:chart-bar
            state: >
             {% if now().hour >= 8 and now().hour < 17 %} day
             {% elif now().hour >= 17 and now().hour < 19 %} peak
             {% elif now().hour >= 19 and now().hour < 23 %} day
             {% else %} night
             {% endif %}
          - name: energy_kwh_cost
            unique_id: 97041eea00d0448caf9e300ee08694a5
            unit_of_measurement: "EUR/kWh"
            icon: mdi:currency-eur
            state: >
              {% if is_state('sensor.energy_tou_tariff', 'day') %} {{ states('input_number.energy_tou_rate_day') | float }}
              {% elif is_state('sensor.energy_tou_tariff', 'peak') %} {{ states('input_number.energy_tou_rate_peak') | float }}
              {% elif is_state('sensor.energy_tou_tariff', 'night') %} {{ states('input_number.energy_tou_rate_night') | float }}
              {% endif %}
          - name: Current Rate Band
            unique_id: 97d6ed78bc8e4bac8728f334a2b8b009
    #        unit_of_measurement: "EUR/kWh"
            icon: mdi:currency-eur
            state: >
              {% if is_state('sensor.energy_tou_tariff', 'day') %} {{ 'Day Rate' }}
              {% elif is_state('sensor.energy_tou_tariff', 'peak') %} {{ 'Peak Rate' }}
              {% elif is_state('sensor.energy_tou_tariff', 'night') %} {{ 'Night Rate' }}
              {% endif %}  
    


    # grouped_energy_sensors.yaml
    # https://seanblanchfield.com/2022/05/real-time-device-power-meters-in-home-assistant
    #
    group:
        monitored_power:
            name: "Monitored Power"
            entities:
    # Smart Plugs
                - sensor.athom_power_plug_1_energy_power # Washing Machine
    # etc etc etc
    
    
        monitored_energy:
            name: "Monitored Energy"
            entities:
    # Smart Plugs
                - sensor.athom_power_plug_1_energy_today # Washing Machine
    # etc etc etc
    
            
    #
    # https://community.home-assistant.io/t/how-to-sum-energy-and-power-sensors/172779
    #
    template:
      - sensor:
        - name: Electric Home Total Power
          unique_id: '94a7b6b8e1444f3f8f170e7a3b5e44d2'
          unit_of_measurement: W
          state: >
            {{ expand('group.monitored_power')
            | rejectattr('state', 'in', ['unavailable', 'unknown'])
            | selectattr('attributes.unit_of_measurement', 'equalto', 'W') 
            | map(attribute='state') | map('float') | list | sum }}
          device_class: power
          state_class: total_increasing
          icon: mdi:transmission-tower
          
        - name: Electric Home Total Energy
          unique_id: 'd6285bf5314d4540b7a2f9ceaeb2cf10'
          unit_of_measurement: kWh
          state: >
            {{ expand('group.monitored_energy')
            | rejectattr('state', 'in', ['unavailable', 'unknown'])
            | selectattr('attributes.unit_of_measurement', 'equalto', 'kWh') 
            | map(attribute='state') | map('float') | list | sum }}
          device_class: energy
          state_class: total_increasing
          icon: mdi:transmission-tower
    


    ---
    #
    # https://www.home-assistant.io/integrations/utility_meter/
    # See also - https://community.home-assistant.io/t/an-approach-to-both-detailed-and-group-level-energy-management/393261/12
    
    
    utility_meter:
      ################  Track daily consumption for each grouping  ###############
      electric_home_daily_total_energy:
        source: sensor.electric_home_total_energy
        cycle: daily
        <<: &utility_meter_tariff_defaults
          tariffs:
            - day
            - night
            - peak
      lighting_daily_total_energy:
        source: sensor.all_light_energy
        cycle: daily
        <<: *utility_meter_tariff_defaults
    # ... repeat as needed ...
    
    
      ################  Track monthly consumption for each grouping  ###############
      electric_home_monthly_total_energy:
        source: sensor.electric_home_total_energy
        cycle: monthly
        <<: *utility_meter_tariff_defaults
      lighting_monthly_total_energy:
        source: sensor.all_light_energy
        cycle: monthly
        <<: *utility_meter_tariff_defaults
    # ... repeat as needed ...
    
    
    # Since utility_meter will now output usage into multiple “buckets” 
    # by tariff, total usage must then be configured to aggregate each tariff rate.
    
    
    sensor:
      - platform: template
        sensors:
        ################  Calculate daily energy usage for each grouping  ###############
          electric_home_daily_total_energy_usage:
            friendly_name: "Electric Home Daily Total Energy Usage"
            unique_id: 'cc4f6652c97346c3927675f3f3a1868c'
            value_template: "{{ states('sensor.electric_home_daily_total_energy_day') | float(2) + states('sensor.electric_home_daily_total_energy_night') | float(2) + states('sensor.electric_home_daily_total_energy_peak') | float(2) }}"
            <<: &energy_usage_defaults
              unit_of_measurement: "kWh"
              icon_template: mdi:gauge
          lighting_daily_total_energy_usage:
            friendly_name: "Lighting Daily Total Energy Usage"
            unique_id: 'ecaace9051b64146a14fb855b290fbc3'
            value_template: "{{ states('sensor.lighting_daily_total_energy_day') | float(2)  + states('sensor.lighting_daily_total_energy_night') | float(2) + states('sensor.lighting_daily_total_energy_peak') | float(2) }}"
            <<: *energy_usage_defaults
    # ... repeat as needed ...
    ## I monitor a number of individual devices here also using the above format     
    
    
        ################  Calculate monthly energy usage for each grouping  ###############
          electric_home_monthly_total_energy_usage:
            friendly_name: "Electric Home Monthly Total Energy Usage"
            unique_id: 'c4679658a7c14446ac49266e42439eb0'
            value_template: "{{ states('sensor.electric_home_monthly_total_energy_day') | float(2) + states('sensor.electric_home_monthly_total_energy_night') | float(2) + states('sensor.electric_home_monthly_total_energy_peak') | float(2) }}"
            <<: *energy_usage_defaults
          lighting_monthly_total_energy_usage:
            friendly_name: "Lighting Monthly Total Energy Usage"
            unique_id: '6456c3919d61477aa3fc9740c5d6f7e0'
            value_template: "{{ states('sensor.lighting_monthly_total_energy_day') | float(2)  + states('sensor.lighting_monthly_total_energy_night') | float(2) + states('sensor.lighting_monthly_total_energy_peak') | float(2)  }}" # see original removed the multiply by offpeak rate value
            <<: *energy_usage_defaults
    # ... repeat as needed ...
    ## I monitor a number of individual devices here also using the above format  
    
    
    # In addition, cost must be calculated and aggregated for each tariff as well.
    
    
        ################  Calculate daily energy cost for each grouping  ###############
          electric_home_daily_total_energy_cost:
            friendly_name: "Electric Home Daily Total Energy Cost"
            unique_id: 'b2e338b301d3409fa3430e4d605f0c89'
            value_template: >-
              {{ max((states('sensor.electric_home_daily_total_energy_day') | float(2) * states('input_number.energy_tou_rate_day') | float(2))
                + (states('sensor.electric_home_daily_total_energy_night') | float(2) * states('input_number.energy_tou_rate_night') | float(2))
                + (states('sensor.electric_home_daily_total_energy_peak') | float(2) * states('input_number.energy_tou_rate_peak') | float(2)) | round(2), 0.00) }}
            <<: &energy_cost_defaults
              unit_of_measurement: "€"
              icon_template: mdi:currency-eur
          lighting_daily_total_energy_cost:
            friendly_name: "Lighting Daily Total Energy Cost"
            unique_id: 'f17d5494f93141f58db95ff27a8f9d81'
            value_template: >-
              {{ max((states('sensor.lighting_daily_total_energy_day') | float(2) * states('input_number.energy_tou_rate_day') | float(2))
                + (states('sensor.lighting_daily_total_energy_night') | float(2) * states('input_number.energy_tou_rate_night') | float(2))
                + (states('sensor.lighting_daily_total_energy_peak') | float(2) * states('input_number.energy_tou_rate_peak') | float(2)) | round(2), 0.00) }}
            <<: *energy_cost_defaults
    # ... repeat as needed ...
    ## I monitor a number of individual devices here also using the above format  
       
    
        ################  Calculate monthly energy cost for each grouping  ###############
          electric_home_monthly_total_energy_cost:
            friendly_name: "Electric Home Monthly Total Energy Cost"
            unique_id: 'e1e581f3b72c429dab59d9fda100557b'
            value_template: >-
              {{ max((states('sensor.electric_home_monthly_total_energy_day') | float(2) * states('input_number.energy_tou_rate_day') | float(2))
                + (states('sensor.electric_home_monthly_total_energy_night') | float(2) * states('input_number.energy_tou_rate_night') | float(2))
                + (states('sensor.electric_home_monthly_total_energy_peak') | float(2) * states('input_number.energy_tou_rate_peak') | float(2)) | round(2), 0.00) }}
            <<: *energy_cost_defaults
          lighting_monthly_total_energy_cost:
            friendly_name: "Lighting Monthly Total Energy Cost"
            unique_id: '2f13a1e932e24d2eaf33e175184a6bbe'
            value_template: >-
              {{ max((states('sensor.lighting_monthly_total_energy_day') | float(2) * states('input_number.energy_tou_rate_day') | float(2))
                + (states('sensor.lighting_monthly_total_energy_night') | float(2) * states('input_number.energy_tou_rate_night') | float(2))
                + (states('sensor.lighting_monthly_total_energy_peak') | float(2) * states('input_number.energy_tou_rate_peak') | float(2)) | round(2), 0.00) }}
            <<: *energy_cost_defaults
    # ... repeat as needed ...
    
    
    # Finally, an automation is configured to set the tariff rate for each utility_meter. We use an automated group to simplify rate automation.
    
    
    automation:
      ################  Create and update power groupings for circuits and devices  ###############
      - alias: "Update Utility Groups"
        trigger:
          - platform: homeassistant
            event: start
          - platform: event
            event_type: "call_service"
            event_data:
              domain: "group"
              service: "reload"
        action:
          - service: group.set
            data_template:
              object_id: utility_meters
              entities: >
                {% set ns = namespace(entities=[]) %}
                {% for s in states.utility_meter if s.object_id.endswith('_daily_total_energy') or s.object_id.endswith('_monthly_total_energy') %}
                  {% set ns.entities = ns.entities + [ s.entity_id ] %}
                {% endfor %}
                {{ ns.entities }}
                
      ################  Update power tariffs for all circuits  ###############
      - alias: "Update Power Tariffs"
        trigger:
          - platform: homeassistant
            event: start
          - platform: event
            event_type: "call_service"
            event_data:
              domain: "group"
              service: "reload"
          - platform: state
            entity_id: sensor.energy_tou_tariff
          - platform: time_pattern
            seconds: "/5"
        action:
          - service: select.select_option
            target:
              entity_id: 
                - select.lighting_daily_total_energy
                - select.lighting_monthly_total_energy
    ## I monitor a number of individual devices here also using the above format  
            data:
              option: '{{ states("sensor.energy_tou_tariff") }}'
    
    
    

    then that gives me stuff to have hidden under dropdowns on dashboard:

    [cost per device is TBD :D ]

    or connected up in the Energy Dashboard




  • Registered Users Posts: 6,098 ✭✭✭emaherx


    Here is mine:

    https://github.com/Farmer-Eds-Shed/Home-Assistant-Energy-Monitoring

    I don't use Shelly cloud at all, so all locally controlled I've most setup on MQTT but 2 lights on the Shelly integration. The MQTT integration never gives a moments bother but the Shelly integration occasionally shows switched unavailable, usually only for a matter of seconds but it's enough for me to be more in favour of the MQTT integration.



  • Registered Users Posts: 1,508 ✭✭✭Manion


    OK so there were three parts to this, the first is to set up a utility helper. This works best if you have one sensor that measures your total import in kWh. The second part is to set up an automation to toggle the utility based on the number of tariffs present. The third part was to set up template sensors to cost in euros. 


    Part of the thing that was challenging me is that everyone has slightly different configuration needs and also the old and new syntax making it difficult to reason about samples. All the links where helpful but emaherx’s was closest to what I was looking for. I've also learnt that one of the reasons why one might want to go to MQTT is more timely updates. It seems the normal Shelly integration only updates roughly once a minute.

    energy_automations.yaml

    - id: "tariff_automation_1"
      alias: "tariff_automation_1"
      trigger:
        - platform: time
          at: "09:00:00"
          variables:
            tariff: "peak"
        - platform: time
          at: "23:59:59"
          variables:
            tariff: "offpeak"
      action:
        - service: select.select_option
          target:
            entity_id: select.daily_energy
          data:
            option: "{{ tariff }}"
        - service: select.select_option
          target:
            entity_id: select.monthly_energy
          data:
            option: "{{ tariff }}"
        - service: select.select_option
          target:
            entity_id: select.hourly_energy
          data:
            option: "{{ tariff }}"
    
    
    

    configuration.yaml

    ## ----------------------------------------------------------- #
    ##                    Peak and Off peak Tracking
    ## ----------------------------------------------------------- #
    # ------ Utility Meter configuration
    # This is how we feed in the shelly EM to a utility helper
    utility_meter:
      hourly_energy:
        source: sensor.import_total_energy
        name: ESB meter hourly electrical energy
        cycle: hourly
        tariffs:
          - peak
          - offpeak
      daily_energy:
        source: sensor.import_total_energy
        name: ESB meter daily electrical energy
        cycle: daily
        tariffs:
          - peak
          - offpeak
      monthly_energy:
        source: sensor.import_total_energy
        name: ESB meter monthly electrical energy
        cycle: monthly
        tariffs:
          - peak
          - offpeak
    
    
    # ------ Template Senor for total energy by hour, day, month ----
    # Create a template sensor which combines peak and off peak power
    template:
      - sensor:
          - name: "Hourly Energy Total"
            unique_id: "template_sensor_1"
            device_class: energy
            unit_of_measurement: kWh
            state: >
              {% if is_number(states('sensor.hourly_energy_offpeak')) and is_number(states('sensor.hourly_energy_peak')) %}
                {{ states('sensor.hourly_energy_offpeak') | float + states('sensor.hourly_energy_peak') | float }}
              {% else %}
                None
              {% endif %}
    
    
      - sensor:
          - name: "Daily Energy Total"
            unique_id: "template_sensor_2"
            device_class: energy
            unit_of_measurement: kWh
            state: >
              {% if is_number(states('sensor.daily_energy_offpeak')) and is_number(states('sensor.daily_energy_peak')) %}
                {{ states('sensor.daily_energy_offpeak') | float + states('sensor.daily_energy_peak') | float }}
              {% else %}
                None
              {% endif %}
    
    
      - sensor:
          - name: "Monthly Energy Total"
            unique_id: "template_sensor_3"
            device_class: energy
            unit_of_measurement: kWh
            state: >
              {% if is_number(states('sensor.monthly_energy_offpeak')) and is_number(states('sensor.monthly_energy_peak')) %}
                {{ states('sensor.monthly_energy_offpeak') | float + states('sensor.monthly_energy_peak') | float }}
              {% else %}
                None
              {% endif %}
    
    
      # ------ Template Senor for costs ----
      # Create a template sensor which combines peak and off peak power
      - sensor:
          - name: "Hourly Cost Total Peak"
            unique_id: "template_sensor_4"
            device_class: monetary
            unit_of_measurement: "€"
            icon: mdi:currency-eur
            state: >
              {{ (states('sensor.hourly_energy_peak') | float * 0.3132 ) | round(2) }}
    
    
          - name: "Hourly Cost Total Off Peak"
            unique_id: "template_sensor_5"
            device_class: monetary
            unit_of_measurement: "€"
            icon: mdi:currency-eur
            state: >
              {{ (states('sensor.hourly_energy_offpeak') | float * 0.1502) | round(2) }}
    
    
          - name: "Daily Cost Total Peak"
            unique_id: "template_sensor_6"
            device_class: monetary
            unit_of_measurement: "€"
            icon: mdi:currency-eur
            state: >
              {{ (states('sensor.daily_energy_peak') | float * 0.3132 ) | round(2) }}
    
    
          - name: "Daily Cost Total Off Peak"
            unique_id: "template_sensor_7"
            device_class: monetary
            unit_of_measurement: "€"
            icon: mdi:currency-eur
            state: >
              {{ (states('sensor.daily_energy_offpeak') | float * 0.1502) | round(2) }}
    
    
          - name: "Monthly Cost Total Peak"
            unique_id: "template_sensor_8"
            device_class: monetary
            unit_of_measurement: "€"
            icon: mdi:currency-eur
            state: >
              {{ (states('sensor.monthly_energy_peak') | float * 0.3132 ) | round(2) }}
    
    
          - name: "Monthly Cost Total Off Peak"
            unique_id: "template_sensor_9"
            device_class: monetary
            unit_of_measurement: "€"
            icon: mdi:currency-eur
            state:          
              {{ (states('sensor.monthly_energy_offpeak') | float * 0.1502) | round(2) }}
    


  • Registered Users Posts: 6,098 ✭✭✭emaherx


    "Part of the thing that was challenging me is that everyone has slightly different configuration needs and also the old and new syntax making it difficult to reason about samples."

    Yep, all you can do is find examples closest to what you want then manipulate them to fit your own needs, very rarely do you find it exactly as needed.

    "It seems the normal Shelly integration only updates roughly once a minute."

    That makes sense, probably what I'm seeing is occasionally a switch unavailable for less than a minuet, they are probably picked back up in that update cycle. And no such issues with MQTT.



  • Registered Users Posts: 1,508 ✭✭✭Manion


    Yep, yours where very well put together and straight forward to reason about. Once I had something working it's easier to iterate. I've updated mine now with what @Grassey had regarding input numbers and I've split the automation for peak and off peak into 3 seasonal automations so I don't have to remember to change the off peak/peak times back and forth with daylight savings.

    I've a few more things I want to do, maybe use blue prints for the automations and also track my total solar consumption over time. I'll dump all this into Github to share on for those who follow.

    I know it's not related to this topic, but genuinely shocked at the prices folks are paying per unit. My contact expires in April and I'm not looking forward to it, I think my day rate will hit 51 cent.



  • Registered Users Posts: 1,888 ✭✭✭bittihuduga


    amazing..so much of info available here for home energy monitoring.

    my question - if we dont have any individual shelly power manager, is it worth getting just a shelly 3em for usage check at the main meter level?

    considering we have smart meter hourly usage details from esb, i felt its no point in getting shelly at the main level.

    i know esb cannot be integrated with HA where as shelly data can be used in HA



  • Registered Users Posts: 1,508 ✭✭✭Manion


    The Shelly 3em is for a three phase power supply and is din mounted, if you have a single phase support the Shelly EM is what you want. You'll be able to monitor two circuits with it if you purchase two CT clamps. The clamps come in 120A and 50A varieties. The shelly will give you access to a wealth of information, including power factor. While this information is available from smart meters my attitude is that it's my data so I want to have it where I want it, when I want it. EI doesn't provide any smart insights unless you sign up to their smart tariffs and not all suppliers off smart insights. Furthermore it's unclear what happens when you change provider.



  • Registered Users Posts: 2,393 ✭✭✭Grassey



    @maameeo Changing providers shouldn't be an issue anymore. Data is now accessible direct from esb since last month, but it's a day in arrears and not real-time.


    



  • Registered Users Posts: 1,888 ✭✭✭bittihuduga


    i totally understand your point. you can play around the data and see the way you want to see in HA. very good for detailed analysis.

    i miss those. for eg. i notice power usage goes up suddenly around 6am in the morning when everyone is sleeping. i have no clue what appliance is running at that hour. if we had a shelly installed probably i would have knows clearly.



  • Advertisement
  • Moderators, Education Moderators, Home & Garden Moderators Posts: 8,165 Mod ✭✭✭✭Jonathan


    You can use the 3EM to monitor three single phase loads. They don't have to be three phase.



Advertisement