EOS_connect icon indicating copy to clipboard operation
EOS_connect copied to clipboard

price_interface.py: Error in line 210

Open HolBaum5 opened this issue 1 year ago • 2 comments

I am on version 0.1.19 and EOS is from 2025-06-07 I always get the following error message regardless of whether I specify default or fixed price as the source.

2025-06-20 20:09:38 DEBUG [PRICE-IF] Prices from AKKUDOKTOR fetched successfully.
Exception in thread Thread-4 (_update_state_loop):
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/threading.py", line 1043, in _bootstrap_inner
    self.run()
    ~~~~~~~~^^
  File "/usr/local/lib/python3.13/threading.py", line 994, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/eos_connect.py", line 572, in _update_state_loop
    self.run_optimization()
    ~~~~~~~~~~~~~~~~~~~~~^^
  File "/app/eos_connect.py", line 609, in run_optimization
    price_interface.update_prices(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        EOS_TGT_DURATION,
        ^^^^^^^^^^^^^^^^^
        datetime.now(time_zone).replace(hour=0, minute=0, second=0, microsecond=0),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/app/interfaces/price_interface.py", line 156, in update_prices
    self.current_feedin = self.__create_feedin_prices()
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/app/interfaces/price_interface.py", line 210, in __create_feedin_prices
    round(self.feed_in_tariff_price / 1000, 9)
          ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

My config.yaml looks like this

# Electricity price configuration
price:
  source: default # data source for electricity price tibber, fixed_24h, default (akkudoktor)
  token: tibberBearerToken # Token for electricity price
  fixed_24h_array:  # 24 hours array with fixed prices over the day
  feed_in_price:  # feed in price for the grid
  negative_price_switch: false # switch for no payment if negative stock price

HolBaum5 avatar Jun 20 '25 18:06 HolBaum5

fix was part of https://github.com/ohAnd/EOS_connect/commit/ead9e002572e1d26ac2e15a15cd91c6ac378c0a4

should be not a problem anymore with upcoming release

ohAnd avatar Jun 23 '25 20:06 ohAnd

I did not read the error code carefully after i set feed_in_price to 0.0 the version 0.1.19 runs again.

# Electricity price configuration
price:
  source: default # data source for electricity price tibber, fixed_24h, default (akkudoktor)
  token: tibberBearerToken # Token for electricity price
  fixed_24h_array: 10.41, 10.42, 10.42, 10.42, 10.42, 23.52, 28.17, 28.17, 28.17, 28.17, 28.17, 23.52, 23.52, 23.52, 23.52, 28.17, 28.17, 34.28, 34.28, 34.28, 34.28, 34.28, 28.17, 23.52 # 24 hours array with fixed prices over the day
  feed_in_price: 0.0 # feed in price for the grid
  negative_price_switch: false # switch for no payment if negative stock price

HolBaum5 avatar Jun 24 '25 05:06 HolBaum5