Automation not running for PIB

Hello

Quite the new guy here, so any feedback and tips are much appreciated.
Goal:
Let my Marstek PIB charge when the price of €/kWh drops below a certain value.

Code:

alias: Testing
description: ""
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.epex_spot_data_price
    id: Price per kWh
    below: 3
conditions: []
actions:
  - data:
      value: "{{ states('sensor.venus_charge_power') | float(800) }}"
    target:
      entity_id: sensor.venus_charge_power
    action: number.set_value
mode: single

Thanks!

Kevin

Welcome Kevin

Helps if you show your code in the correct format.

Also you might want to think of switching off the charging when the price goes back up.

1 Like

Hey Spiro

Thanks for the advice!
Indeed, i’m using the build-in AI-tool from Marstek but the feature lacks options.
I’d combine this automation with other input values like: current state of charge etc

Any errors you notice in the code why the value of 800 doesn’t change?

Much appreciated.

Are you looking to add the 800 subtract, divide or multiply a number by it?

Hey

The value should be set fixed to 800, replacing the floating value.

Confused by this.

The value 800 = setting the charging power to 800w, so far my goal i want to achieve. This way the battery charges whenever the treshold of the price is reached.
It could be higher but we dont consume that much energy at home.
Setting it higher would lead to a full battery and solar power during the day would go to the grid instead of the battery.

I don’t think it’s correct to use number.set_value on a sensor entity; I don’t think that call is doing anything and it’s probably leaving an error in your logs.

number.set_value is for input_number helpers, not for sensor entities.

1 Like

It seems that I’ll need to use a template for this.
Pending research :slight_smile: