MvdDonk / brewfather

Brewfather integration for Home Assistant
16 stars 3 forks source link

Temperature ramp not supported #12

Open MvdDonk opened 10 months ago

MvdDonk commented 10 months ago

Temperature ramp does not seem to work. Looks like the "current temperature" becomes undefined when temperature ramp has started.

Brewfather recipe: image

Home Assistant timeline: image

Home Assistant current: image

https://api.brewfather.app/v2/batches/318gNrkT1a66BSLH8TIwTSIYLuIhik?include=recipe.fermentation,notes,measuredOg

{
  "_id": "318gNrkT1a66BSLH8TIwTSIYLuIhik",
  "name": "Batch",
  "batchNo": 44,
  "status": "Fermenting",
  "brewer": null,
  "brewDate": 1705791600000,
  "recipe": {
    "name": "Dark Mild Ale ",
    "fermentation": {
      "name": "Ale",
      "_id": "default",
      "steps": [
        {
          "actualTime": 1705791600000,
          "stepTemp": 18,
          "displayPressure": null,
          "ramp": null,
          "displayStepTemp": 18,
          "pressure": null,
          "type": "Primary",
          "stepTime": 7
        },
        {
          "actualTime": 1706655600000,
          "stepTemp": 21,
          "displayPressure": null,
          "actualRampTime": 1706396400000,
          "ramp": 3,
          "pressure": null,
          "displayStepTemp": 21,
          "type": "Primary",
          "stepTime": 4
        }
      ]
    }
  },
  "notes": [
    {
      "note": "",
      "type": "statusChanged",
      "timestamp": 1705839961742,
      "status": "Fermenting"
    }
  ]
}
geoff035 commented 5 months ago

Hey @MvdDonk,

Firstly, just want to say thanks so much for making this integration available on HACS, its super useful and I'm loving it. I hit the wall with this issue of the temp ramp not working myself. As I often have multiple batches fermenting at a time, I have made an input select for each of my fermenters so I can select the right batch that is currently fermenting in each fermenter. This allows me to pull just the batch information relevant to the specific fermenter into a separate sensor so I can manipulate the times and temperatures and automate my heaters and coolers. One thing I am currently working on is trying to ramp the temperature at either the date set in brewfather or at 75% attenuation (whichever is first) and to do this I need the estimated FG number. At the moment I am just using an input text to manually add the FG but it would be awesome if you could update the integration to include the estimated FG from the brewfather API.

Cheers, Geoff

MvdDonk commented 1 week ago

Hi @geoff035,

In the last couple of weeks I have been working on a implementation for temperature ramping. The implementation I have right now is that I increase/decrease the temperature 1 degree C every x hours. X is calculated by dividing the ramp duration by the temperature difference. So for example: current fermenting step temperature is 20c and the next step is 24c with a ramp of 2 days it will increase the temperature 1c every (2 * 24) / (24-20) = 12 hours. This will result in the following temperature schedule: Date Target temp Hours into ramp Step status
11/02/2024 13:00 20c 0
11/03/2024 01:00 21c 12 Ramping
11/03/2024 13:00 22c 24 Ramping
11/04/2024 01:00 23c 36 Ramping
11/04/2024 13:00 24c 0 Ramping stopped, target temperature set

I am uncertain how it will work with fahrenheit, at the moment I dont know what the brewfather API will return. I will make the automatic temperature ramping in this integration configurable using the settings.

You mentioned to track multiple batches. I do want to support multiple batches eventhough I only have a single fermentation vessel. Can you explain in the ticket https://github.com/MvdDonk/brewfather/issues/15 how you have setup your Home Assistant and what things could be improved in this integration. Thanks!

MvdDonk commented 1 week ago

Just confirmed the API will always return celcius.