Additional heater if Grid Export is higher then 300w

Hi,

I would like to setup a shelly plug with a heater … maybe in summer a small air condition if I export more than 300w to the grid. I dont get money for export and it make sense to use the energy for heating or cooling.
I get from the tasmota the Power of each phase. My Plant fires to one Phase. The messured power which I have to pay is the sum of all 3 phases. The produced Power is measured as neg. Value.

So if the Sum of L1/l2/L3 is negative, I have the value which is interesting for me. If that neg. Sum is greater than 300W the Plug should be powered on if it goes less then 10W it shoud go down.

in theory a easy job for Home assistent. But for me to big. Hope somebody here could help me out.

It’s a lot easier for both you and us if you just give us the entity names.

sure …but I wait for the arrive of the shally plug :wink:

what I have are the entities of the power
[sensor.tasmota_sm_36_7_0] Power L1 (w)
[sensor.tasmota_sm_56_7_0] Power L2 (w)
[sensor.tasmota_sm_76_7_0] Power L3 (w)

and as well the sum of the Power. But I am not sure if I get a negative value there !
[sensor.tasmota_sm_16_7_0]

do you need something else ?

This will probably work:

description: ""
mode: single
trigger:
  - platform: template
    value_template: >-
      {{ (states('sensor.tasmota_sm_36_7_0') | int +
          states('sensor.tasmota_sm_56_7_0') | int +
          states('sensor.tasmota_sm_76_7_0') | int)  <= -300 }}
    id: "on"
  - platform: template
    value_template: >-
      {{ (states('sensor.tasmota_sm_36_7_0') | int +
          states('sensor.tasmota_sm_56_7_0') | int +
          states('sensor.tasmota_sm_76_7_0') | int)  >= -10 }}
    id: "off"
condition: []
action:
  - service: switch.turn_{{ trigger.id }}
    data: {}
    target:
      entity_id: switch.shelly

thx … now its sunny … and I figured out, that sensor.tasmota_sm_16_7_0 get the (negative)sum off all.
I will try to modify this. pls check

description: ""
mode: single
trigger:
  - platform: template
    value_template: >-
      {{ (states('sensor.tasmota_sm_16_7_0' )| int)  <= -300 }}
    id: "on"
  - platform: template
    value_template: >-
      {{ (states('sensor.tasmota_sm_16_7_0') | int   >= -10 }}
    id: "off"
condition: []
action:
  - service: switch.turn_{{ trigger.id }}
    data: {}
    target:
      entity_id: switch.shelly
      

Thank you for support !

I checked yours and mine. Can I put that in the configuration.yaml ?
there I get in both cases the following:

Integration error: description - Integration ‘description’ not found.
Integration error: mode - Integration ‘mode’ not found.
Integration error: trigger - Integration ‘trigger’ not found.
Integration error: condition - Integration ‘condition’ not found.
Integration error: action - Integration ‘action’ not found.

nobody here who can help me :disappointed_relieved:

I’ve just done that recently. In fact, I fitted the Shelly 1PM inside the heater. I use the Visual editor for the configuration of the Automation, however, the yaml looks like this.

alias: "Excess Solar :  Fan heater on"
description: ""
trigger:
  - above: 350
    entity_id: sensor.emoncms_export
    for:
      hours: 0
      minutes: 0
      seconds: 20
      milliseconds: 0
    platform: numeric_state
condition: []
action:
  - type: turn_on
    device_id: a21157e668631d7f8248d7cc59214507
    entity_id: switch.fan_heater
    domain: switch
mode: single

and I have another automation to turn it off if I start importing.

Open the GUI automation editor and switch to yaml mode and paste the code there.

its running … but I have a small problem. After the shelly is off and the trigger comes again, it takes more than five minutes to get th shelly back on.
Here is my code:

- id: '1664004807689'
  alias: shelly-ein
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.tasmota_sm_16_7_0
    above: -300
    below: -10
    for:
      hours: 0
      minutes: 0
      seconds: 30
  condition: []
  action:
  - type: turn_on
    device_id: 8e83f1adec218cd7a9534898b5ecf59f
    entity_id: switch.shelly_plug1
    domain: switch
  mode: single
- id: '1664004862258'
  alias: shelly aus
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.tasmota_sm_16_7_0
    above: 0
    for:
      hours: 0
      minutes: 0
      seconds: 30
  condition: []
  action:
  - type: turn_off
    device_id: 8e83f1adec218cd7a9534898b5ecf59f
    entity_id: switch.shelly_plug1
    domain: switch
  mode: single
- id: '1664009765972'