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

API Time Zone is different to Mealie Time Zone set in ENV, posting wrong meal of the day on API request. #4263

Closed
5 of 6 tasks
mopedy opened this issue Sep 23, 2024 · 7 comments · Fixed by #4734
Closed
5 of 6 tasks
Labels
bug Something isn't working triage

Comments

@mopedy
Copy link

mopedy commented Sep 23, 2024

First Check

  • This is not a feature request.
  • I added a very descriptive title to this issue (title field is above this).
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the Mealie documentation, with the integrated search.
  • I already read the docs and didn't find an answer.
  • This issue can be replicated on the demo site (https://demo.mealie.io/).

What is the issue you are experiencing?

Setting the TZ in the docker env to Australia/Adelaide does not change the timezone for API requests.
This causes the Meal of the day request via API rest request to change @UTC time instead of the set Timezone.

Steps to Reproduce

Meal Plan
image

Homeassistant Rest Sensor
image

Docker Container Time
image

Please provide relevant logs

_mealie_logs (3).txt

Mealie Version

Details
Version: v1.12.0
Build: 0d06494
Application Mode: Production
Demo Status: Not Demo
API Port: 9000
API Docs: Enabled
Database Type: sqlite
Recipe Scraper Version: 15.0.0

Checks
Secure Site: No
Server Side Base URL: Yes
LDAP Ready: No
OIDC Ready: No
OpenAI Ready: No
Email Configured: No

docker.io/ghcr.io/mealie-recipes/mealie:v1.12.0

Deployment

Docker (Synology)

Additional Deployment Details

No response

@mopedy mopedy added bug Something isn't working triage labels Sep 23, 2024
@boc-the-git
Copy link
Collaborator

How is the HA sensor being created?

@mopedy
Copy link
Author

mopedy commented Sep 24, 2024

I create it as sensor entity in config.
image

Not sure if it helps but it has the correct meal in the calender in HA, just the picture in camera entity that is created with the generic camera does not match until 09:30am

image

http://192.168.1.116:9925/api/media/recipes/{{states('sensor.mealie_todays_meal_id')}}/images/min-original.webp

It seems Mealie integration and Mealie use the set TZ of ACST which is UTC +9:30 but the API uses UTC.

Thanks for looking into this.

@fabianluque
Copy link

Can confirm same happening to me. I'm on EST time, have a similar sensor configured in HA:

rest:
  - headers:
      Authorization: >
        Bearer  ---
    scan_interval: 60
    resource: http://homeassistant:9925/api/households/mealplans/today
    sensor:
      - name: "Meal of the Day"
        value_template: "{{ value_json[0].recipe.name }} "
        json_attributes_path: "$.[0].recipe"
        json_attributes:
          - id

My sensor changes to the next meal around 8pm EST time:

image

@Charli181
Copy link

Happening here as well for AEDT (+11 GMT). I am running on V2.04.
Calendar is looking fine
looking at startup logs there does not seem to be a mention that the TZ has been set to TZ: Australia/Sydney

[INFO|app|L63] 2024-10-18T09:27:05: { "TESTING": false, "PRODUCTION": true, "LOG_CONFIG_OVERRIDE": null, "LOG_LEVEL": "info", "theme": { "light_primary": "#E58325", "light_accent": "#007A99", "light_secondary": "#973542", "light_success": "#43A047", "light_info": "#1976D2", "light_warning": "#FF6D00", "light_error": "#EF5350", "dark_primary": "#E58325", "dark_accent": "#007A99", "dark_secondary": "#973542", "dark_success": "#43A047", "dark_info": "#1976D2", "dark_warning": "#FF6D00", "dark_error": "#EF5350" }, "BASE_URL": "hidden", "STATIC_FILES": "/spa/static", "IS_DEMO": false, "HOST_IP": "*", "API_HOST": "0.0.0.0", "API_PORT": 9000, "API_DOCS": true, "TOKEN_TIME": 48, "GIT_COMMIT_HASH": "hidden", "ALLOW_SIGNUP": false, "DAILY_SCHEDULE_TIME": "23:45", "SECURITY_MAX_LOGIN_ATTEMPTS": 5, "SECURITY_USER_LOCKOUT_TIME": 24, "DB_ENGINE": "sqlite", "DEFAULT_GROUP": "Home", "DEFAULT_HOUSEHOLD": "Family", "SMTP_HOST": null, "SMTP_PORT": "587", "SMTP_FROM_NAME": "Mealie", "SMTP_FROM_EMAIL": null, "SMTP_AUTH_STRATEGY": "TLS", "LDAP_AUTH_ENABLED": false, "LDAP_SERVER_URL": null, "LDAP_TLS_INSECURE": false, "LDAP_TLS_CACERTFILE": null, "LDAP_ENABLE_STARTTLS": false, "LDAP_BASE_DN": null, "LDAP_QUERY_BIND": null, "LDAP_USER_FILTER": null, "LDAP_ADMIN_FILTER": null, "LDAP_ID_ATTRIBUTE": "uid", "LDAP_MAIL_ATTRIBUTE": "mail", "LDAP_NAME_ATTRIBUTE": "name", "OIDC_AUTH_ENABLED": false, "OIDC_CLIENT_ID": null, "OIDC_CONFIGURATION_URL": null, "OIDC_SIGNUP_ENABLED": true, "OIDC_USER_GROUP": null, "OIDC_ADMIN_GROUP": null, "OIDC_AUTO_REDIRECT": false, "OIDC_PROVIDER_NAME": "OAuth", "OIDC_REMEMBER_ME": false, "OIDC_USER_CLAIM": "email", "OIDC_GROUPS_CLAIM": "groups", "OIDC_TLS_CACERTFILE": null, "OPENAI_BASE_URL": null, "OPENAI_MODEL": "gpt-4o", "OPENAI_CUSTOM_HEADERS": {}, "OPENAI_CUSTOM_PARAMS": {}, "OPENAI_ENABLE_IMAGE_SERVICES": true, "OPENAI_WORKERS": 2, "OPENAI_SEND_DATABASE_DATA": true, "OPENAI_REQUEST_TIMEOUT": 60, "WORKER_PER_CORE": 1, "UVICORN_WORKERS": 1 }

Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Nov 17, 2024
@fabianluque
Copy link

Still present on 2.2.0

@github-actions github-actions bot removed the stale label Nov 18, 2024
@michaelclark2
Copy link
Contributor

from what I can tell, the api endpoint is hardcoded to use UTC timezone as todays date

today = datetime.now(tz=UTC).date()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants