EMHASS: An Energy Management for Home Assistant

Short answer is no you don’t need a subscription and even if you did I don’t think it would add much value to an EMHASS solution.

I find Solcast great in terms of a reasonable forecast and sets my optimisations up for the day. I use the home assistant Solcast integration so I can poll that as many times as I want without effecting the upstream API count as the results are cached locally. I also don’t find the forecasts charge much during the day certainly not minute to minute.

To run my high frequency MPC optimisation, I inject my current solar PV actual value from my inverters MODBUS sensor which is updated every 10 seconds, then I inject the other 47 forecasts from Solcast sensor to make up the full 24 hour picture.

So the current decision on which devices to run is made in live data, solar, household load, buy cost and sell price. The plan for the next periods (30 minutes - 24 hours) is based on forecasts on the same parameters. It seems to work pretty well for me. I can see if I turn on the oven or a large cloud goes overtop the other loads are tuned down.

       "pv_power_forecast": {{
          ([states('sensor.APF_Generation_Entity')|int(0)] +
          state_attr('sensor.solcast_forecast_today', 'detailedForecast')|selectattr('period_start','gt',utcnow()) | map(attribute='pv_estimate')|map('multiply',2000)|map('int')|list +
          state_attr('sensor.solcast_forecast_tomorrow', 'detailedForecast')|selectattr('period_start','gt',utcnow()) | map(attribute='pv_estimate')|map('multiply',2000)|map('int')|list
          )| tojson
        }},

Your setup seems ideal to use with EMHASS and the fact you have everything already in home assistant makes it even easier.

Your strategy of one step at a time is great, start with a simple model and inject your household load and solar forecast, then include your dynamic pricing.

Get each step working and don’t be afraid to roll back to a working configuration.

You can setup EMHASS in a purely passive mode so you can see what it would suggest to compare the performance with tibber. This is recommended before you start physically controlling devices through Home Assistant anyway. EMHASS builds the optimised plan and you then need to create Home Assistant automations to switch your devices according to that plan.

1 Like

Thanks for your quick answer, much appreciated! Do you have any tips for what the minimum config is for this? I’m gathering I don’t need to configure any of the PV related config variables, but only about the battery and which optimization algos to use?

I just came across this cool battery simulator integration: Battery Simulator integration/custom component for home assistant

This would allow you to run the optimizer with a virtual battery to simulate how much it would save you :slight_smile:

That battery simulation looks nice. But if you have EMHASS already up and running then just use the “perfect” optimization task and activate/deactivate the battery. Change the number of days to retrieve to whatever you want and you will have quick results comparing those scenarios. Try for example 30 days to compare for the last month with and without a battery.

But I don’t understand how that would simulate a battery?

On EMHASS the battery model is directly in the LP formulation. It is actually the exact same model from the integration that you sent. It is a simple constant efficiency battery model based on just power and energy capacity in kWh to compute the state of charge (SOC)

If you like this work please consider buying a coffee :wink:

![Buy Me A Coffee](upload://i335BTjV6hwmfpDyoyLhz4yKkLY.png)

1 Like

Thanks Mark… I just saw the utcnow…
What’s the reason behind multplying by 2000? instead of 1000? just for my sanity :smiley:
It makes sense… Thanks again

I have a 15 kW inverter, Solcast 30 minute peak interval forecast is 7.5 kWh, EMHASS requires power so I multiply 7.5 kWh / 0.5 hr * 1000 W = 15,000 W.

1 Like

Thanks.

I’m a bit confused by the documentation as it’s a bit contradictory at times.
https://emhass.readthedocs.io/en/latest/config.html clearly states that “There are no optional parameters.”, but also states default values for some parameters.
https://emhass.readthedocs.io/en/latest/forecasts.html#pv-power-production-forecast states that solcast api and id should be passed at runtime, but the example secrets_emhass.yaml has the parameters set there.
These things has thrown me off a bit when trying to configure emhass.

Yes these contradictions needs to be fixed. These are the result of the evolution of the code. In fact at the beginning EMHASS was just a Python module. Then the add-on was developed along with a third method using docker in standalone mode. These different installation methods made it difficult to avoid some contradictions, but they still need to be fixed. Changes and improvements on the code and the documentation are open to contribution, pull requests are welcomed.

3 Likes

Looks good. How often do you run this query?

I really like the idea with EMHASS and is eager to try it out.

I ran into some problems tho. I’ve solved most of them thanks to old posts in the community but i’m stuck on one problem.

i’m running a standalone installation in docker on rpi4

The config

{                                                                                                                                                                                                                
  "hass_url": "empty",                                                                                                                                                                                           
  "long_lived_token": "empty",                                                                                                                                                                                   
  "costfun": "profit",                                                                                                                                                                                           
  "optimization_time_step": 60,                                                                                                                                                                                
  "historic_days_to_retrieve": 2,                                                                                                                                                                                
  "method_ts_round": "nearest",                                                                                                                                                                                  
  "set_total_pv_sell": false,                                                                                                                                                                                    
  "lp_solver": "GLPK_CMD",                                                                                                                                                                                       
  "lp_solver_path": "empty",                                                                                                                                                                              
  "set_nocharge_from_grid": false,                                                                                                                                                                              
  "set_nodischarge_to_grid": false,
  "set_battery_dynamic": false,
  "battery_dynamic_max": 0.9,
  "battery_dynamic_min": -0.9,
  "sensor_power_photovoltaics": "sensor.inverter_active_power",                                                                                                                                                    
  "sensor_power_load_no_var_loads": "sensor.power_meter_consumption",                                                                                                                                            
  "number_of_deferrable_loads": 2,                                                                                                                                                                               
  "list_nominal_power_of_deferrable_loads": [                                                                                                                                                                    
    {                                                                                                                                                                                                            
      "nominal_power_of_deferrable_loads": 3000                                                                                                                                                                  
    },                                                                                                                                                                                                           
    {                                                                                                                                                                                                            
      "nominal_power_of_deferrable_loads": 1000                                                                                                                                                                  
    }                                                                                                                                                                                                                                                                                                                                                                                                                  
  ],                                                                                                                                                                                                             
  "list_operating_hours_of_each_deferrable_load": [                                                                                                                                                              
    {                                                                                                                                                                                                            
      "operating_hours_of_each_deferrable_load": 5                                                                                                                                                               
    },                                                                                                                                                                                                           
    {                                                                                                                                                                                                            
      "operating_hours_of_each_deferrable_load": 2                                                                                                                                                               
    }                                                                                                                                                                                                           
  ],                                                                                                                                                                                                             
  "list_peak_hours_periods_start_hours": [                                                                                                                                                                       
    {                                                                                                                                                                                                            
      "peak_hours_periods_start_hours": "02:54"                                                                                                                                                                  
    },                                                                                                                                                                                                           
    {                                                                                                                                                                                                            
      "peak_hours_periods_start_hours": "17:24"                                                                                                                                                                  
    }                                                                                                                                                                                                            
  ],                                                                                                                                                                                                             
  "list_peak_hours_periods_end_hours": [                                                                                                                                                                         
    {                                                                                                                                                                                                            
      "peak_hours_periods_end_hours": "15:24"                                                                                                                                                                    
    },                                                                                                                                                                                                           
    {                                                                                                                                                                                                            
      "peak_hours_periods_end_hours": "20:54"                                                                                                                                                                    
    }                                                                                                                                                                                                            
  ],  
  "list_treat_deferrable_load_as_semi_cont": [
    {
      "treat_deferrable_load_as_semi_cont": true
    },
    {
      "treat_deferrable_load_as_semi_cont": true
    },
    {
      "treat_deferrable_load_as_semi_cont": true
    }
  ],
  "load_peak_hours_cost": 0.1907,                                                                                                                                                                                
  "load_offpeak_hours_cost": 0.1419,                                                                                                                                                                             
  "photovoltaic_production_sell_price": 0.1419,                                                                                                                                                                  
  "maximum_power_from_grid": 12000,
  "list_pv_module_model": [
    {
      "pv_module_model": "SunPower_SPR_400E_WHT_D"
    }
  ],
  "list_pv_inverter_model": [
    {
      "pv_inverter_model": "Huawei_Technologies_Co___Ltd___SUN2000_10KTL_USL0__240V_"
    }
  ],
  "list_surface_tilt": [
    {
      "surface_tilt": 22
    }
  ],
  "list_surface_azimuth": [
    {
      "surface_azimuth": 190
    }
  ],
  "list_modules_per_string": [
    {
      "modules_per_string": 13
    },
    {
      "modules_per_string": 14
    }


  ],
  "list_strings_per_inverter": [
    {
      "strings_per_inverter": 2
    }
  ],
  "set_use_battery": true,
  "battery_discharge_power_max": 5000,
  "battery_charge_power_max": 5000,
  "battery_discharge_efficiency": 0.95,
  "battery_charge_efficiency": 0.95,
  "battery_nominal_energy_capacity": 5000,
  "battery_minimum_state_of_charge": 0.05,
  "battery_maximum_state_of_charge": 0.95,
  "battery_target_state_of_charge": 0.05
}

I get this error, i’ve tried out all solvers.

waitress   INFO  Serving on http://0.0.0.0:5000
2023-06-05 18:49:29,342 - web_server - INFO - Setting up needed data
2023-06-05 18:49:29,417 - web_server - INFO - Retrieving weather forecast data using method = scrapper
2023-06-05 18:49:31,816 - web_server - INFO - Retrieving data from hass for load forecast using method = naive
2023-06-05 18:49:31,819 - web_server - INFO - Retrieve hass get data method initiated...
2023-06-05 18:49:32,140 - web_server - INFO -  >> Performing dayahead optimization...
2023-06-05 18:49:32,140 - web_server - INFO - Performing day-ahead forecast optimization
2023-06-05 18:49:32,174 - web_server - INFO - Perform optimization for the day-ahead
2023-06-05 18:49:32,247 - web_server - ERROR - It was not possible to find a valid solver for Pulp package
2023-06-05 18:49:32,248 - web_server - INFO - Status: Not Solved
2023-06-05 18:49:32,248 - web_server - WARNING - Cost function cannot be evaluated, probably None
2023-06-05 18:49:32,256 - web_server - ERROR - Exception on /action/dayahead-optim [POST]
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "src/emhass/web_server.py", line 191, in action_call
    opt_res = dayahead_forecast_optim(input_data_dict, app.logger)
  File "/usr/local/lib/python3.8/site-packages/emhass-0.4.11-py3.8.egg/emhass/command_line.py", line 234, in dayahead_forecast_optim
    opt_res_dayahead = input_data_dict['opt'].perform_dayahead_forecast_optim(
  File "/usr/local/lib/python3.8/site-packages/emhass-0.4.11-py3.8.egg/emhass/optimization.py", line 525, in perform_dayahead_forecast_optim
    self.opt_res = self.perform_optimization(df_input_data, P_PV.values.ravel(),
  File "/usr/local/lib/python3.8/site-packages/emhass-0.4.11-py3.8.egg/emhass/optimization.py", line 416, in perform_optimization
    opt_tp["P_grid"] = [P_grid_pos[i].varValue + P_grid_neg[i].varValue for i in set_I]
  File "/usr/local/lib/python3.8/site-packages/emhass-0.4.11-py3.8.egg/emhass/optimization.py", line 416, in <listcomp>
    opt_tp["P_grid"] = [P_grid_pos[i].varValue + P_grid_neg[i].varValue for i in set_I]
TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'

Very thankful for help getting forth

This was problem some time ago. You can try these instructions: GitHub - davidusb-geek/emhass: emhass: Energy Management for Home Assistant, is a Python module designed to optimize your home energy interfacing with Home Assistant.

I tried them one by one without luck.

I run the command you suggested in another thread. I had to shorten the long output


root@raspberrypi:/home/pi/docker/emhass# docker exec -it DockerEMHASS bash
root@0cdbb2f7358a:/app# cd /usr/bin/cbc
bash: cd: /usr/bin/cbc: No such file or directory
root@0cdbb2f7358a:/app# python3
Python 3.8.16 (default, May 23 2023, 09:55:57)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pulp as plp
>>> solver_list = plp.listSolvers()
>>> print(solver_list)
['GLPK_CMD', 'PYGLPK', 'CPLEX_CMD', 'CPLEX_PY', 'GUROBI', 'GUROBI_CMD', 'MOSEK', 'XPRESS', 'XPRESS', 'XPRESS_PY', 'PULP_CBC_CMD', 'COIN_CMD', 'COINMP_DLL', 'CHOCO_CMD', 'MIPCL_CMD', 'SCIP_CMD', 'HiGHS_CMD']
>>> plp.pulpTestAll()
sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss    Test that logic put in place for deprecation handling of indexs works
.        Testing 'indexs' param continues to work for LpVariable.dicts
         Testing 'indexs' param continues to work for LpVariable.matrix
.        Testing 'indices' argument works in LpVariable.dicts
         Testing 'indices' param continues to work for LpVariable.matrix
.        Testing invalid status
.        Testing continuous LP solution - export dict
E        Testing export dict for LP
E        Testing export dict MIP
E        Testing maximize continuous LP solution
E        Testing continuous LP solution - export JSON
E        Testing continuous LP solution - export solver dict
E        Testing continuous LP solution - export solver JSON
E..      Testing reading MPS files - binary variable, no constraint names
.        Testing reading MPS files - integer variable
.        Testing reading MPS files - maximize
.        Testing reading MPS files - noname
.E       Testing invalid var names
E        Testing logPath argument
E        Testing makeDict general behavior
.        Testing makeDict default value behavior
.        Testing measuring optimization time
E        Testing that `readsol` can parse CPLEX mipopt solution
.        Testing the availability of the function pulpTestAll
.        Testing zero subtraction
.        Testing inconsistent lp solution
E        Testing continuous LP solution
E        Testing maximize continuous LP solution
E        Testing unbounded continuous LP solution
E        Testing Long Names
E        Testing repeated Names
E        Testing zero constraint
E        Testing zero objective
E        Testing LpVariable (not LpAffineExpression) objective
E        Testing Long lines in LP
E        Testing LpAffineExpression divide
E        Testing MIP solution
E        Testing MIP solution with floats in objective
E        Testing Initial value in MIP solution
E        Testing fixing value in MIP solution
E        Testing MIP relaxation
E        Testing feasibility problem (no objective)
E        Testing an infeasible problem
E        Testing an integer infeasible problem
E        Testing another integer infeasible problem
E        Testing column based modelling
E.       Testing dual variables and slacks reporting
EE.      Testing fractional constraints
E        Testing elastic constraints (no change)
E        Testing elastic constraints (freebound)
E        Testing elastic constraints (penalty unchanged)
E        Testing elastic constraints (penalty unbounded)
E        Testing timeLimit argument
E.Esssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
======================================================================
ERROR: test_export_dict_LP (pulp.tests.test_pulp.PULP_CBC_CMDTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 818, in test_export_dict_LP
    pulpTestCheck(
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 1493, in pulpTestCheck
    status = prob.solve(solver, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/pulp.py", line 1913, in solve
    status = solver.actualSolve(self, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 137, in actualSolve
    return self.solve_CBC(lp, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 202, in solve_CBC
    cbc = subprocess.Popen(args, stdout=pipe, stderr=pipe, stdin=devnull)
  File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/usr/local/lib/python3.8/site-packages/pulp/solverdir/cbc/linux/64/cbc'

======================================================================
ERROR: test_export_dict_LP_no_obj (pulp.tests.test_pulp.PULP_CBC_CMDTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 836, in test_export_dict_LP_no_obj
    pulpTestCheck(
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 1493, in pulpTestCheck
    status = prob.solve(solver, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/pulp.py", line 1913, in solve
    status = solver.actualSolve(self, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 137, in actualSolve
    return self.solve_CBC(lp, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 202, in solve_CBC
    cbc = subprocess.Popen(args, stdout=pipe, stderr=pipe, stdin=devnull)
  File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/usr/local/lib/python3.8/site-packages/pulp/solverdir/cbc/linux/64/cbc'

======================================================================
ERROR: test_export_dict_MIP (pulp.tests.test_pulp.PULP_CBC_CMDTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 881, in test_export_dict_MIP
    pulpTestCheck(
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 1493, in pulpTestCheck
    status = prob.solve(solver, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/pulp.py", line 1913, in solve
    status = solver.actualSolve(self, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 137, in actualSolve
    return self.solve_CBC(lp, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 202, in solve_CBC
    cbc = subprocess.Popen(args, stdout=pipe, stderr=pipe, stdin=devnull)
  File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/usr/local/lib/python3.8/site-packages/pulp/solverdir/cbc/linux/64/cbc'

======================================================================
ERROR: test_export_dict_max (pulp.tests.test_pulp.PULP_CBC_CMDTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 902, in test_export_dict_max
    pulpTestCheck(
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 1493, in pulpTestCheck
    status = prob.solve(solver, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/pulp.py", line 1913, in solve
    status = solver.actualSolve(self, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 137, in actualSolve
    return self.solve_CBC(lp, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 202, in solve_CBC
    cbc = subprocess.Popen(args, stdout=pipe, stderr=pipe, stdin=devnull)
  File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/usr/local/lib/python3.8/site-packages/pulp/solverdir/cbc/linux/64/cbc'

======================================================================
ERROR: test_export_json_LP (pulp.tests.test_pulp.PULP_CBC_CMDTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 861, in test_export_json_LP
    pulpTestCheck(
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 1493, in pulpTestCheck
    status = prob.solve(solver, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/pulp.py", line 1913, in solve
    status = solver.actualSolve(self, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 137, in actualSolve
    return self.solve_CBC(lp, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 202, in solve_CBC
    cbc = subprocess.Popen(args, stdout=pipe, stderr=pipe, stdin=devnull)
  File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/usr/local/lib/python3.8/site-packages/pulp/solverdir/cbc/linux/64/cbc'

======================================================================
ERROR: test_export_solver_dict_LP (pulp.tests.test_pulp.PULP_CBC_CMDTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 920, in test_export_solver_dict_LP
    pulpTestCheck(
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 1493, in pulpTestCheck
    status = prob.solve(solver, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/pulp.py", line 1913, in solve
    status = solver.actualSolve(self, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 137, in actualSolve
    return self.solve_CBC(lp, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 202, in solve_CBC
    cbc = subprocess.Popen(args, stdout=pipe, stderr=pipe, stdin=devnull)
  File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/usr/local/lib/python3.8/site-packages/pulp/solverdir/cbc/linux/64/cbc'

======================================================================
ERROR: test_export_solver_json (pulp.tests.test_pulp.PULP_CBC_CMDTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 960, in test_export_solver_json
    pulpTestCheck(
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 1493, in pulpTestCheck
    status = prob.solve(solver, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/pulp.py", line 1913, in solve
    status = solver.actualSolve(self, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 137, in actualSolve
    return self.solve_CBC(lp, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 202, in solve_CBC
    cbc = subprocess.Popen(args, stdout=pipe, stderr=pipe, stdin=devnull)
  File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/usr/local/lib/python3.8/site-packages/pulp/solverdir/cbc/linux/64/cbc'

======================================================================
ERROR: test_infeasible_problem__is_not_valid (pulp.tests.test_pulp.PULP_CBC_CMDTest)
Given a problem where x cannot converge to any value
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 1193, in test_infeasible_problem__is_not_valid
    pulpTestCheck(
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 1493, in pulpTestCheck
    status = prob.solve(solver, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/pulp.py", line 1913, in solve
    status = solver.actualSolve(self, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 137, in actualSolve
    return self.solve_CBC(lp, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 202, in solve_CBC
    cbc = subprocess.Popen(args, stdout=pipe, stderr=pipe, stdin=devnull)
  File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/usr/local/lib/python3.8/site-packages/pulp/solverdir/cbc/linux/64/cbc'

======================================================================
ERROR: test_invalid_var_names (pulp.tests.test_pulp.PULP_CBC_CMDTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 1248, in test_invalid_var_names
    pulpTestCheck(
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 1493, in pulpTestCheck
    status = prob.solve(solver, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/pulp.py", line 1913, in solve
    status = solver.actualSolve(self, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 137, in actualSolve
    return self.solve_CBC(lp, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 202, in solve_CBC
    cbc = subprocess.Popen(args, stdout=pipe, stderr=pipe, stdin=devnull)
  File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/usr/local/lib/python3.8/site-packages/pulp/solverdir/cbc/linux/64/cbc'

======================================================================
ERROR: test_logPath (pulp.tests.test_pulp.PULP_CBC_CMDTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 1017, in test_logPath
    pulpTestCheck(
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 1493, in pulpTestCheck
    status = prob.solve(solver, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/pulp.py", line 1913, in solve
    status = solver.actualSolve(self, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 137, in actualSolve
    return self.solve_CBC(lp, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 202, in solve_CBC
    cbc = subprocess.Popen(args, stdout=pipe, stderr=pipe, stdin=devnull)
  File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/usr/local/lib/python3.8/site-packages/pulp/solverdir/cbc/linux/64/cbc'

======================================================================
ERROR: test_measuring_solving_time (pulp.tests.test_pulp.PULP_CBC_CMDTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pulp/tests/test_pulp.py", line 1221, in test_measuring_solving_time
    prob.solve(self.solver)
  File "/usr/local/lib/python3.8/site-packages/pulp/pulp.py", line 1913, in solve
    status = solver.actualSolve(self, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 137, in actualSolve
    return self.solve_CBC(lp, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pulp/apis/coin_api.py", line 202, in solve_CBC
    cbc = subprocess.Popen(args, stdout=pipe, stderr=pipe, stdin=devnull)
  File "/usr/local/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/usr/local/lib/python3.8/site-packages/pulp/solverdir/cbc/linux/64/cbc'

Should I be seeing this in the sensor.p_batt_forecast?
My automation is not being triggered… I’m using notify for now

12¢ looks like the lowest price of the day so a good time to charge your battery (4000W) from excess solar (1000W) and the grid (3000W).

What were you expecting at this time?

Hi Mark,

I values makes sense… but the sensor.p_batt_forecast is not reaching -4000 by the time its already 1130.
Maybe it has something to do with the MPC_Opt being ran every 5 mins?

Are you also calling the publish data end point every time you run the MPC optimisation?