kevdliu / hacs-anylist

Home Assistant integration for Anylist
GNU General Public License v3.0
22 stars 2 forks source link

500 error #5

Closed jazzmonger closed 11 months ago

jazzmonger commented 11 months ago

Got both the addon and integration installed. latest versions of everything. HA supervised. I had to use port 8085 and configured the server to use that port

image

And in the integration shows all my lists

image
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[16:05:16] INFO: Starting server on port 8085

> anylist@1.0.0 start
> node index.js

Server listening on port 8085

this results in a 500 error.

image

as doex this

image
2023-12-10 15:57:47.602 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration anylist which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-12-10 15:57:54.149 INFO (MainThread) [homeassistant.bootstrap] Setting up stage 2: {'sql', 'ssh', 'cync_lights', 'sun', 'lovelace', 'ios', 'zone', 'wyoming', 'script', 'conversation', 'tts', 'openhasp', 'input_select', 'stream', 'blueprint', 'homeassistant_alerts', 'file_upload', 'input_number', 'tuya', 'hacs', 'assist_pipeline', 'anylist', 'input_boolean', 'my', 'nws', 'logbook', 'binary_sensor', 'aladdin_connect', 'device_tracker', 'trace', 'esphome', 'sonoff', 'climate', 'counter', 'input_button', 'wake_word', 'utility_meter', 'map', 'media_source', 'search', 'schedule', 'image_upload', 'person', 'bestway', 'scene', 'system_health', 'starlink', 'hardware', 'timer', 'input_text', 'persistent_notification', 'template', 'tag', 'device_automation', 'diagnostics', 'derivative', 'input_datetime', 'auth', 'onboarding', 'camera', 'panel_iframe', 'ffmpeg', 'frigidaire', 'sensor', 'repairs', 'analytics', 'application_credentials', 'history', 'config', 'automation', 'openweathermap', 'alexa_media', 'mobile_app', 'stt', 'energy', 'mqtt', 'tasmota', 'button', 'group', 'default_config', 'rest_command', 'influxdb'}
2023-12-10 15:57:54.225 INFO (MainThread) [homeassistant.setup] Setting up anylist
2023-12-10 15:57:54.225 INFO (MainThread) [homeassistant.setup] Setup of domain anylist took 0.0 seconds
2023-12-10 15:57:58.961 INFO (MainThread) [homeassistant.components.todo] Setting up todo.anylist
2023-12-10 15:58:08.963 WARNING (MainThread) [homeassistant.components.todo] Setup of todo platform anylist is taking over 10 seconds.
2023-12-10 15:58:52.766 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: anylist, todo.anylist
2023-12-10 15:58:58.963 ERROR (MainThread) [homeassistant.components.todo] Setup of platform anylist is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2023-12-10 16:00:14.659 ERROR (MainThread) [anylist] Failed to add item. Received error code 500.
2023-12-10 16:00:26.882 ERROR (MainThread) [anylist] Failed to add item. Received error code 500.
2023-12-10 16:01:00.602 ERROR (MainThread) [anylist] Failed to add item. Received error code 500.
2023-12-10 16:03:57.038 ERROR (MainThread) [anylist] Failed to add item. Received error code 500.
2023-12-10 16:06:16.937 ERROR (MainThread) [anylist] Failed to add item. Received error code 500.

why does it say "todo.anylist_costco"? or is that just how you present all lists?

Not sure what to do or look at from here...

kevdliu commented 11 months ago

Are there any errors in the add-ons logs? If you have watchdog enabled for the addon make sure to disable it while grabbing the logs or it'll restart the addon and override the crash logs

jazzmonger commented 11 months ago

I posted all the logs above including from the add-on.

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[20:30:04] INFO: Starting server on port 8085

> anylist@1.0.0 start
> node index.js

Server listening on port 8085

no errors...

kevdliu commented 11 months ago

Ok. To try to pin down the cause of the issue, could you try adding an item through home assistant's todo integration? The service call looks something like this

service: todo.add_item
data:
  item: Milk
target:
  entity_id: todo.anylist_costco
jazzmonger commented 11 months ago

service: todo.add_item data: item: Milk target: entity_id: todo.anylist_costco

nothing happens when I call that service other than the checkbox going green:

image

If I delete the old service and re-add a new service I get this in the logs

2023-12-11 15:00:34.547 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new todo.anylist entity: todo.anylist_jeff_is_list_home_to_rv
2023-12-11 15:00:35.419 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new todo.anylist entity: todo.anylist_walmart_shared
2023-12-11 15:00:36.165 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new todo.anylist entity: todo.anylist_costco
2023-12-11 15:00:36.931 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new todo.anylist entity: todo.anylist_tractor_supply

.....and another 20+ entries...

And the lists are all there showing how many items are in the lists, and that count matches what I see in my Anylist app.

image

But again, calling that service on any of the lists does nothing. I don't even see it in the log file.

image

gives this:

{"lists":["Jeff is list- Home To RV","Walmart Shared","COSTCO","Tractor Supply","Hardware","Funk Tunes","Prepped","Napa Auto Parts","RV To Fix","Europe","LORI - HOME To RV","Trader Joe’s","Gig Rember List","Van Slyke To Do","Amazon","Restaurant Supply","Walgreens Caldwell ","Harbor Freight ","Model A","Target","Alexa Shopping List","Rv To Buy","Office Depot","Craig’s Boat trip","Model T","Asian Food Store","Winterize Property"]}
kevdliu commented 11 months ago

Hmm. Thanks for all the additional info. I've tried to reproduce multiple times on my end but haven't gotten it to fail yet. Let's try further narrowing down the problem. Could you try adding an item using the addon's rest endpoint directly? With curl it'll look something like this:

curl -X POST http://192.168.1.250:8085/add -H 'Content-Type: application/json' -d '{"name":"Milk","list":"COSTCO"}'

Note that the list name is case-sensitive.

jazzmonger commented 11 months ago

that works perfectly each time.

image

AHA!! case... That was the clue. This works:

service: todo.add_item
data:
  item: Tires
target:
  entity_id: todo.anylist_COSTCO

But the auto population of the list names has the wrong case for all of the list names (at least for my lists):

image

so If I manually change it to todo.anylist_COSTCO, it works.

If you choose the list name from the Entities button, it populates all list names in lower case...

You might may want to check how you handle case in your Add-On.... especially when we start throwing mixed case at your service calls using Willow and Assist using Voice! And that is exactly what led me to your integration!

image

image
jazzmonger commented 11 months ago

on a different topic, did you ever reach out to the owners of Anylist about supporting an API officially? I'd hate for us to lose this method and integration in the future. Seems to me like they should be open to it. They must have a dev program somewhere - they have a skill on Alexa... but thinking about it, they probably wrote it themselves.

Jason Marr is their CTO and a co-founder https://jmarr.net/- he was a SW engineer at Apple in the past. His personal email address is likely this:

image

or you could send it to team@anylist.com

kevdliu commented 11 months ago

that works perfectly each time.

image

AHA!! case... That was the clue. This works:

service: todo.add_item
data:
  item: Tires
target:
  entity_id: todo.anylist_COSTCO

But the auto population of the list names has the wrong case for all of the list names (at least for my lists): image

so If I manually change it to todo.anylist_COSTCO, it works.

If you choose the list name from the Entities button, it populates all list names in lower case...

You might may want to check how you handle case in your Add-On.... especially when we start throwing mixed case at your service calls using Willow and Assist using Voice! And that is exactly what led me to your integration!

image

image

Interesting, good catch! I'll look into how to better handle the different cases in list names.

kevdliu commented 11 months ago

on a different topic, did you ever reach out to the owners of Anylist about supporting an API officially? I'd hate for us to lose this method and integration in the future. Seems to me like they should be open to it. They must have a dev program somewhere - they have a skill on Alexa... but thinking about it, they probably wrote it themselves.

Jason Marr is their CTO and a co-founder https://jmarr.net/- he was a SW engineer at Apple in the past. His personal email address is likely this: image or you could send it to team@anylist.com

I actually did reach out to them a few months ago and the reply was since they are a small team, they don't have enough manpower to create and maintain a public API. I saw that one of the co-founders replied to an issue in the repo for the anylist nodejs library (https://github.com/codetheweb/anylist) regarding anylist's authentication changes so it seems like they're not openly against third-party integrations at least.

kevdliu commented 11 months ago

Just release a new update for the addon that makes list lookups case insensitive so it should better accommodate voice use cases.

jazzmonger commented 11 months ago

Works like a champ! Thanks for all the work!

kevdliu commented 11 months ago

Glad everything's working now!