Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a function to predict a value from a csv file. #147

Closed
wants to merge 161 commits into from

Conversation

gieljnssns
Copy link
Contributor

The story behind this pull request.
I keep a CSV file in which I store data from which I want to predict the number of heating hours.
I first tried to do this via a custom_component for home-assistant, but apparently it is not possible to install scikit-learn.
Since the result of my prediction is to be used in emhass and the necessary dependencies are already installed in emhass, I decided to go this way.

This pull request contains a new method csv-predict with new parameters, here is an example of a rest command in home-assistant

predict_heating:
  url: http://localhost:5001/action/csv-predict
  method: POST
  content_type: "application/json"
  payload: >-
    {
      "csv_file": "prediction.csv",
      "independent_variables":["dd", "solar"],
      "dependent_variable": "hour",
      "sklearn_model": "LinearRegression",
      "csv_predict_entity_id": "sensor.voorspelde_uren",
      "csv_predict_unit_of_measurement": "h",
      "csv_predict_friendly_name": "Voorspelde uren",
      "new_values": [{{states("sensor.degree_day_prediction")}}, {{states("sensor.solcast_solaredge_forecast_today")}}]
    }

If you are open to accepting this pull request, I will also take the time to write some documentation. And if necessary, I would also like to try writing some tests.

Here is also a used CSV file.
prediction.csv

Copy link

codecov bot commented Jan 18, 2024

Codecov Report

Attention: Patch coverage is 71.63995% with 230 lines in your changes are missing coverage. Please review.

Project coverage is 80.52%. Comparing base (e192d97) to head (e154380).
Report is 50 commits behind head on master.

❗ Current head e154380 differs from pull request most recent head f8b43aa. Consider uploading reports for the commit f8b43aa to get more accurate results

Files Patch % Lines
src/emhass/command_line.py 61.69% 95 Missing ⚠️
src/emhass/machine_learning_regressor.py 21.10% 86 Missing ⚠️
src/emhass/utils.py 90.47% 36 Missing ⚠️
src/emhass/retrieve_hass.py 82.89% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #147      +/-   ##
==========================================
- Coverage   87.69%   80.52%   -7.17%     
==========================================
  Files           6        7       +1     
  Lines        1706     1920     +214     
==========================================
+ Hits         1496     1546      +50     
- Misses        210      374     +164     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/emhass/csv_predictor.py Fixed Show fixed Hide fixed
src/emhass/csv_predictor.py Fixed Show fixed Hide fixed
@davidusb-geek
Copy link
Owner

Hi could you please explain a little bit more your use case here? What are you using these predictions for?
Also they are not time series predictions like we do in the ML forecaster, these are just regressions.
It wouldn't be better to include these as another method in the ML forecast class?
What passing the data directly from sensors in Home Assistant?

@davidusb-geek
Copy link
Owner

This need some unittest, otherwise we don't if it's breaking something.

@gieljnssns
Copy link
Contributor Author

gieljnssns commented Jan 19, 2024

I have an automation in HA that stores some daily data in a csv file

alias: "Heating csv"
id: 157b1d57-73d9-4f39-82c6-13ce0cf4288a
trigger:
  - platform: time
    at: "23:59:32"
action:
  - service: notify.prediction
    data:
      message: >
        {% set dd = states('sensor.degree_day_daily') |float %}
        {% set inside = states('sensor.gemiddelde_dagtemperatuur_binnen') |float %}
        {% set outside = states('sensor.gemiddelde_dagtemperatuur_buiten') |float %}
        {% set hour = states('sensor.branduren_warmtepomp_vandaag') |float | round(2) %}
        {% set kwhdd = states('sensor.kwh_per_degree_day_daily') |float %}
        {% set hourdd = states('sensor.uur_per_degree_day_daily') |float | round(2) %}
        {% set solar_total = states('sensor.opbrengst_kwh') |float %}
        {% set solar_total_yesterday = states('sensor.solar_csv_2') |float %}
        {% set solar = (states('sensor.opbrengst_kwh') |float - solar_total_yesterday) | round(3) %}
        {% set verwarming_total = states('sensor.warmtepomp_kwh') |float %}
        {% set verwarming_total_yesterday = states('sensor.verwarming_csv') |float %}
        {% set verwarming = (states('sensor.warmtepomp_kwh') |float - verwarming_total_yesterday) | round(3) %}
        {% set verbruik_total = states('sensor.verbruik_kwh') |float %}
        {% set verbruik_total_yesterday = states('sensor.verbruik_csv') |float %}
        {% set verbruik = (states('sensor.verbruik_kwh') |float - verbruik_total_yesterday) | round(3) %}
        {% set verbruik_zonder_verwarming = (verbruik - verwarming) | round(3) %}
        {% set time = now() %}

          {{time}},{{dd}},{{solar}},{{verbruik_zonder_verwarming}},{{hourdd}},{{inside}},{{outside}},{{hour}},{{kwhdd}},{{solar_total}},{{verwarming_total}},{{verwarming}},{{verbruik_total}},{{verbruik}}

where hour is the number of hours my heating has been on
solar is the amount of solar energy produced
and dd are the degree days of that day

I'm trying to get as much data as I can

I know the solar for the next day (solcast) and I can calculate the degree days for the next day (based on temperature predictions)
Then I want to predict the number of hours my heating should be on the next day, so I can set the def_total_hours for my heating
I hope when I have data over one year the predictions of hour wil be good enough to eliminate my thermostat.

src/emhass/csv_predictor.py Fixed Show resolved Hide resolved
src/emhass/csv_predictor.py Fixed Show fixed Hide fixed
@davidusb-geek
Copy link
Owner

Ok I understand better now. You have two regressor to train. A first regression to output your degree days using an available forecast of your local temperature, then a second regressor using this degree days along with your available solar forecast from solcast to output the needed number of hours for your heating the next day. Is that it?
This seems interesting. A nice feature.

Please consider adding a unittest in the test folder to test this new class, otherwise we don't if it's breaking something. This will be necessary to merge this into the final code.

Like I said I would have make this more generic. Your use case is with CSV files (which I personally like), but may not be the case for most people. I think that this should support other types of data input. Like directly specifying the name of sensors in Home Assistant and then retrieven the data directly like we do for the energy optimization.
If this is to be more generic then the name of the new can be something like MLPredictor and machine_learning_predictor.py.
What do you think?
These is to keep coherence with the rest of the code.
Maybe you can finish what you started (including the unittest) and then after the merge I can refactor the names.
Thanks again for this feature

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may have overlooked but there is not fit method in this class?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I see it is with the predict method -> Create a separate fit method

src/emhass/csv_predictor.py Outdated Show resolved Hide resolved
src/emhass/csv_predictor.py Outdated Show resolved Hide resolved
"""
X = data[self.independent_variables].values
y = data[self.dependent_variable].values
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could put a cross validation here. You are not cross validating your model, so maybe prone to overfit on that training set.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you point me to an example for this?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use cross validation and model selection. It is very well explained here: https://scikit-learn.org/stable/modules/cross_validation.html

Concretely use some hyper-parameter tuning method, as GridSearchCV.
The best is to use a pipe-line.
Example code:

from sklearn.pipeline import Pipeline
from sklearn.model_selection import GridSearchCV
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import StandardScaler

# Create a pipeline with a standard scaler and a linear regression model
pipe = Pipeline([
    ('scaler', StandardScaler()),
    ('regressor', LinearRegression())
])

# Define the parameters to tune
param_grid = {
    'regressor__alpha': [0.1, 0.5, 1],
    'regressor__fit_intercept': [True, False]
}

# Create a grid search object
grid_search = GridSearchCV(pipe, param_grid, cv=5, scoring='neg_mean_squared_error')

# Fit the grid search object to the data
grid_search.fit(X, y)

# Print the best parameters and the corresponding score
print('Best parameters:', grid_search.best_params_)
print('Best score:', grid_search.best_score_)

The grid_search object also contains the best model: best_model = grid_search.best_estimator_

# Fit and time it
self.logger.info("Predict through a "+self.sklearn_model+" model")
start_time = time.time()
self.forecaster.fit(X, y)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creat a separate method for this, a fit method

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean I have to create a def for the fit method?
Does that def also needs a command_line def also?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean I have to create a def for the fit method?
Does that def also needs a command_line def also?

Yes and yes. See example code above for a complete fit method

@gieljnssns gieljnssns marked this pull request as draft January 26, 2024 18:57
@gieljnssns
Copy link
Contributor Author

I will work on this hopefully next week again...

@davidusb-geek
Copy link
Owner

Of course, keep this up, it is a very nice new feature.

@gieljnssns
Copy link
Contributor Author

Please consider adding a unittest in the test folder to test this new class, otherwise we don't if it's breaking something.

I do not have any experience whit unittest, I will try to find this out

@gieljnssns
Copy link
Contributor Author

I'm also having an issue with pytest

vscode ➜ /workspaces/emhass (master) $ pytest
====================================================================================== test session starts =======================================================================================
platform linux -- Python 3.11.4, pytest-7.3.1, pluggy-1.0.0
rootdir: /workspaces/emhass
plugins: requests-mock-1.11.0
collected 0 items / 6 errors                                                                                                                                                                     

============================================================================================= ERRORS =============================================================================================
_______________________________________________________________________ ERROR collecting tests/test_command_line_utils.py ________________________________________________________________________
ImportError while importing test module '/workspaces/emhass/tests/test_command_line_utils.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_command_line_utils.py:9: in <module>
    from emhass.command_line import set_input_data_dict
E   ModuleNotFoundError: No module named 'emhass'
____________________________________________________________________________ ERROR collecting tests/test_forecast.py _____________________________________________________________________________
ImportError while importing test module '/workspaces/emhass/tests/test_forecast.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_forecast.py:11: in <module>
    from emhass.retrieve_hass import retrieve_hass
E   ModuleNotFoundError: No module named 'emhass'
___________________________________________________________________ ERROR collecting tests/test_machine_learning_forecaster.py ___________________________________________________________________
ImportError while importing test module '/workspaces/emhass/tests/test_machine_learning_forecaster.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_machine_learning_forecaster.py:16: in <module>
    from emhass.command_line import set_input_data_dict
E   ModuleNotFoundError: No module named 'emhass'
__________________________________________________________________________ ERROR collecting tests/test_optimization.py ___________________________________________________________________________
ImportError while importing test module '/workspaces/emhass/tests/test_optimization.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_optimization.py:11: in <module>
    from emhass.retrieve_hass import retrieve_hass
E   ModuleNotFoundError: No module named 'emhass'
__________________________________________________________________________ ERROR collecting tests/test_retrieve_hass.py __________________________________________________________________________
ImportError while importing test module '/workspaces/emhass/tests/test_retrieve_hass.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_retrieve_hass.py:12: in <module>
    from emhass.retrieve_hass import retrieve_hass
E   ModuleNotFoundError: No module named 'emhass'
______________________________________________________________________________ ERROR collecting tests/test_utils.py ______________________________________________________________________________
ImportError while importing test module '/workspaces/emhass/tests/test_utils.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_utils.py:8: in <module>
    from emhass import utils
E   ModuleNotFoundError: No module named 'emhass'
==================================================================================== short test summary info =====================================================================================
ERROR tests/test_command_line_utils.py
ERROR tests/test_forecast.py
ERROR tests/test_machine_learning_forecaster.py
ERROR tests/test_optimization.py
ERROR tests/test_retrieve_hass.py
ERROR tests/test_utils.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 6 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================================================= 6 errors in 0.74s ========================================================================================
vscode ➜ /workspaces/emhass (master) $ 

How can i solve this?

@davidusb-geek
Copy link
Owner

Please consider adding a unittest in the test folder to test this new class, otherwise we don't if it's breaking something.

I do not have any experience whit unittest, I will try to find this out

Follow the same procedure as this: https://github.com/davidusb-geek/emhass/blob/master/tests/test_machine_learning_forecaster.py

@davidusb-geek
Copy link
Owner

davidusb-geek commented Jan 29, 2024

I'm also having an issue with pytest

How can i solve this?

What's your dev environment?
You need to install emhass as an editable package in your environment.

python -m pip install -e .

@gieljnssns
Copy link
Contributor Author

gieljnssns commented Jan 29, 2024

What's your dev environment?

I re-open in devcontainer (vscode)
I change in web_server this lines
CONFIG_PATH = os.getenv("CONFIG_PATH", default="/app/config_emhass.yaml") to CONFIG_PATH = os.getenv("CONFIG_PATH", default="/workspaces/emhass/app/config_emhass.yaml")
DATA_PATH = os.getenv("DATA_PATH", default="/app/data/") to DATA_PATH = os.getenv("DATA_PATH", default="/workspaces/emhass/app/data/")
and with open(os.getenv('SECRETS_PATH', default='/app/secrets_emhass.yaml'), 'r') as file: to with open(os.getenv('SECRETS_PATH', default='/workspaces/emhass/app/secrets_emhass.yaml'), 'r') as file:

And then cd src && python -m emhass.web_server

@davidusb-geek
Copy link
Owner

I you may need to rebase your branch based on the latest code from master

@gieljnssns
Copy link
Contributor Author

I have seen it.
Is there a better way to develop on emhass then the way I described above?

@davidusb-geek
Copy link
Owner

davidusb-geek commented Jan 30, 2024

I'm not using codespaces.
I do everything locally on my PC.
To do it locally on a Linux machine do this:

  1. Set up a virtual environment: python -m venv .venv (here the virtual environment is called .venv)
  2. Activate the env: source .venv/bin/activate (if using Windows instead this would be .venv\Scripts\activate.bat
  3. Then git clone the EMHASS repository and from within the repo and with the virtual env activated just install the emhass package in editable mode with this: python -m pip install -e .
  4. VSCode should automatically catch that a new virtual env was created so you can start developing from there

Hope it helps

EDIT: I've actually just tested this same procedure inside the codespaces and it works perfectly

@GeoDerp

This comment was marked as outdated.

@GeoDerp
Copy link
Contributor

GeoDerp commented Feb 5, 2024

If you like to try out another alternative, have a look at this: #182

@gieljnssns
Copy link
Contributor Author

@davidusb-geek
I did some changes, still no tests or documentation.
But at first maybe you can have a look at it and give me some comments...

@GeoDerp
Copy link
Contributor

GeoDerp commented Feb 13, 2024

Good job on keeping your pull request up to date.

src/emhass/command_line.py Fixed Show fixed Hide fixed
src/emhass/command_line.py Fixed Show fixed Hide fixed
src/emhass/command_line.py Fixed Show fixed Hide fixed
@gieljnssns
Copy link
Contributor Author

This are the new rest commands

fit_heating_hours:
  url: http://localhost:5001/action/csv-model-fit
  method: POST
  content_type: "application/json"
  payload: >-
    {
    "csv_file": "prediction.csv",
    "independent_variables":["degreeday", "solar"],
    "dependent_variable": "hours",
    "model_type": "heating_dd",
    "timestamp": "timestamp",
    "date_features": ["month", "day_of_week"]
    }
predict_heating_hours:
  url: http://localhost:5001/action/csv-model-predict
  method: POST
  content_type: "application/json"
  payload: >-
   {
    "csv_predict_entity_id": "sensor.predicted_hours",
    "csv_predict_unit_of_measurement": "h",
    "csv_predict_friendly_name": "Predicted hours",
    "new_values": [8.2, 7.23, 2, 6],
    "model_type": "heating_dd"
    }

If you have a column in your csv file that contains a timestamp, you can pass that column name.
And if you have a timestamp you can use date_features, by passing the ones you care about the model they are taken into account with the fit action.
the possibilities are year, month, day_of_week, day_of_year, day and hour

@gieljnssns
Copy link
Contributor Author

@davidusb-geek
Do you have any feedback on the changes I have made?

@davidusb-geek
Copy link
Owner

davidusb-geek commented Feb 27, 2024

Hi yes of course sorry, here are some comments.

It is a nice feature. Here are some comments. This class should work for multiple types of input data, not only CSV files. The main workflow should be retrieving the data directly from HA using the same methods as emhass does for the optimization. (we can make this after merging your code with some later refactoring)

Then the name of the class can be changed to something like MLRegressor. That will be consistent with the MLForecaster class.

Then there are the models, I only see linear regression, but now that you have put together a pipeline you can go ahead and add a list of different ML models with their parameters and try to find the best. You can add lasso, random forest, etc.

The docstring of the main class is confusing on the example for the dependent variable, hours? Also it is typical in data science to name the dependent variable as the target and the independent variables as features.

We may make use of the more efficient bayesian optimization already available within emhass to optimize the hyperparameters. But can see this later, gridSearchCV is a very good start.

@davidusb-geek
Copy link
Owner

davidusb-geek commented Feb 27, 2024

Here is a code snippet from chat gpt for multiple models, so needs testing ;-) . Store the results and pick the best model with lowest error:

regression_methods = [
    ('Linear Regression', LinearRegression(), {}),
    ('Ridge Regression', Ridge(), {'ridge__alpha': [0.1, 1.0, 10.0]}),
    ('Lasso Regression', Lasso(), {'lasso__alpha': [0.1, 1.0, 10.0]}),
    ('Random Forest Regression', RandomForestRegressor(), {'randomforestregressor__n_estimators': [50, 100, 200]}),
    ('Gradient Boosting Regression', GradientBoostingRegressor(), {
        'gradientboostingregressor__n_estimators': [50, 100, 200],
        'gradientboostingregressor__learning_rate': [0.01, 0.1, 0.2]
    }),
    ('AdaBoost Regression', AdaBoostRegressor(), {
        'adaboostregressor__n_estimators': [50, 100, 200],
        'adaboostregressor__learning_rate': [0.01, 0.1, 0.2]
    })
]

for name, model, param_grid in regression_methods:
    pipeline = Pipeline([
        ('scaler', StandardScaler()),
        (name, model)
    ])
    
    # Use GridSearchCV to find the best hyperparameters for each model
    grid_search = GridSearchCV(pipeline, param_grid, scoring='neg_mean_squared_error', cv=5)
    grid_search.fit(X_train, y_train)

    # Get the best model and print its mean squared error on the test set
    best_model = grid_search.best_estimator_
    predictions = best_model.predict(X_test)

@davidusb-geek
Copy link
Owner

davidusb-geek commented Mar 2, 2024

Hi @gieljnssns.
Have you tested this? It is giving you good regression results for your test csv data? Good metrics r2?
Please keep your branch updated with master, currently there are some conflicts

@davidusb-geek
Copy link
Owner

davidusb-geek commented Apr 19, 2024

@gieljnssns, happy to help you out with the path changes that just merged. May be good to see @davidusb-geek 's response to testing that PR on the weekend first however. (just in case it gets reverted)

Hi, I merged #247 yesterday and unit tests are passing correctly, so everything looks good to me.

@gieljnssns
Copy link
Contributor Author

How can I fix the CodeQL error?

@davidusb-geek
Copy link
Owner

How can I fix the CodeQL error?

Yes these have been hanging for some time now. We need to fix them. They come from using the eval function directly.
I haven't come up with a solution to this, ideas are welcomed

@gieljnssns
Copy link
Contributor Author

@davidusb-geek
Are you open to use ruff as the standard formatter?

@davidusb-geek
Copy link
Owner

@davidusb-geek
Are you open to use ruff as the standard formatter?

What is ruff?

I propose a solution otherwise, change those eval with ast.literal_eval:

import ast

user_input = input("Enter a Python expression: ")
result = ast.literal_eval(user_input)

Needs testing.

@gieljnssns
Copy link
Contributor Author

What is ruff?

https://github.com/astral-sh/ruff

This is also the default formatter in Home Assistant

@GeoDerp
Copy link
Contributor

GeoDerp commented Apr 19, 2024

Hey @gieljnssns your PR file change seems to be a little weird (showing file changes to all master merged commits) I experienced this myself yesterday. (just tested the result with #259)

Could you see if this changes anything:

git remote add david [email protected]:davidusb-geek/emhass.git
git pull --tags david master

Then a git push

Feel free to do this on a test bed first to make sure you don't mess anything up.
Amazing Job by the way. Will validate the path changes as well as do the pipeline (standalone & addon) tests on this code later tonight hopefully.

@davidusb-geek
Copy link
Owner

Hey @gieljnssns your PR file change seems to be a little weird (showing file changes to all master merged commits) I experienced this myself yesterday. (just tested the result with #259)

I was about to comment on this myself when I saw the number of files changed = 49!

@davidusb-geek
Copy link
Owner

https://github.com/astral-sh/ruff

This is also the default formatter in Home Assistant

Got it, yes open to anything that will make this better.

@gieljnssns
Copy link
Contributor Author

to make sure you don't mess anything up.

I think this already happened.

@gieljnssns
Copy link
Contributor Author

vscode ➜ /workspaces/emhass (master) $ git remote add david [email protected]:davidusb-geek/emhass.git
vscode ➜ /workspaces/emhass (master) $ git pull --tags david master
Warning: Permanently added the ECDSA host key for IP address '140.82.121.4' to the list of known hosts.
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

@gieljnssns
Copy link
Contributor Author

Hey @gieljnssns your PR file change seems to be a little weird (showing file changes to all master merged commits) I experienced this myself yesterday. (just tested the result with #259)

I was about to comment on this myself when I saw the number of files changed = 49!

Stange
Scherm­afbeelding 2024-04-19 om 11 27 01

@davidusb-geek
Copy link
Owner

image

@GeoDerp
Copy link
Contributor

GeoDerp commented Apr 19, 2024

vscode ➜ /workspaces/emhass (master) $ git remote add david [email protected]:davidusb-geek/emhass.git
vscode ➜ /workspaces/emhass (master) $ git pull --tags david master
Warning: Permanently added the ECDSA host key for IP address '140.82.121.4' to the list of known hosts.
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Sorry that's because it's GitHub ssh and not https

git remote add david [email protected]:davidusb-geek/emhass.git

To

git remote add david https://github.com/davidusb-geek/emhass.git

@GeoDerp
Copy link
Contributor

GeoDerp commented Apr 19, 2024

Hey @gieljnssns your PR file change seems to be a little weird (showing file changes to all master merged commits) I experienced this myself yesterday. (just tested the result with #259)

I was about to comment on this myself when I saw the number of files changed = 49!

Stange
Scherm­afbeelding 2024-04-19 om 11 27 01

It might be a new GitHub glitch. 🤷‍♂️

@gieljnssns
Copy link
Contributor Author

vscode ➜ /workspaces/emhass (master) $ git remote add david https://github.com/davidusb-geek/emhass.git
error: remote david already exists.

@gieljnssns
Copy link
Contributor Author

I think the best I can do is closing this PR and do it again?

@GeoDerp
Copy link
Contributor

GeoDerp commented Apr 19, 2024

vscode ➜ /workspaces/emhass (master) $ git remote add david https://github.com/davidusb-geek/emhass.git
error: remote david already exists.
git remote rm david

Having a remote that's the origin repository is a good way (my uneducated option ) to fetch and pull in the latest commits to merge or make a new branch. Feel free to use something like this in the future 😁.

Vs code has GUI ways to do this I believe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Archived done
Development

Successfully merging this pull request may close these issues.

3 participants