tr1plus / ha-aftership

Aftership state card for use in HomeAssistant
MIT License
16 stars 1 forks source link

HA error : Data too long for column 'event_data' at row 1 #3

Open thelittlefireman opened 5 years ago

thelittlefireman commented 5 years ago

Hi,

With about 9 packages i've got this error on HA :

2018-08-20 14:39:50 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: (pymysql.err.DataError) (1406, "Data too long for column 'event_data' at row 1") 
[SQL: 'INSERT INTO events (event_type, event_data, origin, time_fired, created) VALUES (%(event_type)s, %(event_data)s, %(origin)s, %(time_fired)s, %(created)s)'] 
[parameters: {'event_type': 'state_changed', 'event_data': '{"entity_id": "sensor.aftership_sensor", "old_state": {"entity_id": "sensor.aftership_sensor", "state": "7", "attributes": {"data": {"page": 1, "limi ... (77236 characters truncated) ... tom_ui_state_card": "state-card-custom-ui"}, "last_changed": "2018-08-20T12:38:28.053330+00:00", "last_updated": "2018-08-20T12:39:44.378598+00:00"}}', 'origin': 'LOCAL', 'time_fired': datetime.datetime(2018, 8, 20, 12, 39, 44, 378738, tzinfo=<UTC>), 'created': datetime.datetime(2018, 8, 20, 12, 39, 50, 950049)}] 
(Background on this error at: http://sqlalche.me/e/9h9h)
tr1plus commented 5 years ago

It is possible that there is a limit on the amount of data the database is able to store, and the way I built this, is that it is getting a lot of data to work on... May need to check on whether I can limit the data I get or just limit the amount of lines I display at a time...

Just for my reference, are you using normal or lovelace?

thelittlefireman commented 5 years ago

Can't it be possible to create a new sensor for each package ?

tr1plus commented 5 years ago

not with this set-up, and when I tested this before it made my home assistant messy as hell.

However I did find a way to limit the amount of fields I get; I will have to look into this as it would change the API call... Currently at work so not able to check...

tr1plus commented 5 years ago

Quick fix: In your configuration file could you change the following url https://api.aftership.com/v4/trackings/ to

https://api.aftership.com/v4/trackings?fields=title, tag, tracking_number

Let me know the results

thelittlefireman commented 5 years ago

okay thanks :)

we are not alone on this issue

https://github.com/home-assistant/home-assistant/issues/16074

tr1plus commented 5 years ago

any chance you have tried my solution above?

thelittlefireman commented 5 years ago

I've got push it on my repo but actualy I can't test. i will let you know if it's working