Core: Integration SMS, can't delete sms, spam sms.incoming_sms events

Created on 22 Sep 2020  Â·  27Comments  Â·  Source: home-assistant/core

The problem

Each time I recieve (on HA) a new sms he send an event for each sms in SIM memory (including the new one) so I get one more each time.
In the log I see that I get errors when he tried to delete old sms. See logs for details.

Environment

  • Home Assistant Core release with the issue: 0.115.2
  • Last working Home Assistant Core release (if known): 0.115.2
  • Operating environment (OS/Container/Supervised/Core): HassOS 4.13
  • Integration causing this issue: SMS
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/sms/
  • Hardware used : Raspberry PI 4 4go, huawei E220.
  • Two sim card tried, same result. (Free and Orange)
    Also tried with an huawei E3531 but I don't get any sms.incoming_sms event.

Problem-relevant configuration.yaml

notify:
  - platform: sms
    name: sms_zorim
    recipient: "+331234567890"

Traceback/Error logs


Main logs

2020-09-22 17:29:40 DEBUG (Thread-5) [homeassistant.components.sms.gateway] Received incoming event type:SMS,data:{'Location': 38, 'Folder': 1, 'InboxFolder': 1}
2020-09-22 17:29:40 DEBUG (Thread-5) [homeassistant.components.sms.gateway] Start remaining:39
2020-09-22 17:29:40 DEBUG (Thread-5) [homeassistant.components.sms.gateway] All parts:0
2020-09-22 17:29:40 DEBUG (Thread-5) [homeassistant.components.sms.gateway] Part Number:-1
2020-09-22 17:29:40 DEBUG (Thread-5) [homeassistant.components.sms.gateway] Remaining:39
2020-09-22 17:29:40 DEBUG (Thread-5) [homeassistant.components.sms.gateway] Start all_parts_arrived:True
2020-09-22 17:29:40 DEBUG (Thread-5) [homeassistant.components.sms.gateway] Deleting message
2020-09-22 17:29:40 ERROR (Thread-5) [homeassistant.components.sms.gateway] {'SMSC': {'Location': 0, 'Name': '', 'Format': 'Text', 'Validity': 'NA', 'Number': '+330000000000', 'DefaultNumber': ''}, 'UDH': {'Type': 'NoUDH', 'Text': b'', 'ID8bit': 0, 'ID16bit': 0, 'PartNumber': -1, 'AllParts': 0}, 'Folder': 1, 'InboxFolder': 1, 'Memory': 'SM', 'Location': 0, 'Name': '', 'Number': '+330000000000', 'Text': 'Ok5', 'Type': 'Deliver', 'Coding': 'Default_No_Compression', 'DateTime': datetime.datetime(2020, 9, 16, 23, 3, 29), 'SMSCDateTime': datetime.datetime(2020, 9, 22, 17, 29, 40), 'DeliveryStatus': 0, 'ReplyViaSameSMSC': 0, 'State': 'Read', 'Class': -1, 'MessageReference': 0, 'ReplaceMessage': 0, 'RejectDuplicates': 0, 'Length': 3}
2020-09-22 17:29:40 ERROR (Thread-5) [homeassistant.components.sms.gateway] Error deleting SMS, memory not available
2020-09-22 17:29:40 DEBUG (Thread-5) [homeassistant.components.sms.gateway] Deleting message
2020-09-22 17:29:40 ERROR (Thread-5) [homeassistant.components.sms.gateway] {'SMSC': {'Location': 0, 'Name': '', 'Format': 'Text', 'Validity': 'NA', 'Number': '+330000000000', 'DefaultNumber': ''}, 'UDH': {'Type': 'NoUDH', 'Text': b'', 'ID8bit': 0, 'ID16bit': 0, 'PartNumber': -1, 'AllParts': 0}, 'Folder': 1, 'InboxFolder': 1, 'Memory': 'SM', 'Location': 1, 'Name': '', 'Number': '+330000000000', 'Text': 'Ok', 'Type': 'Deliver', 'Coding': 'Default_No_Compression', 'DateTime': datetime.datetime(2020, 9, 17, 10, 58, 50), 'SMSCDateTime': datetime.datetime(2020, 9, 22, 17, 29, 40), 'DeliveryStatus': 0, 'ReplyViaSameSMSC': 0, 'State': 'Read', 'Class': -1, 'MessageReference': 0, 'ReplaceMessage': 0, 'RejectDuplicates': 0, 'Length': 2}
2020-09-22 17:29:40 ERROR (Thread-5) [homeassistant.components.sms.gateway] Error deleting SMS, memory not available
2020-09-22 17:29:40 DEBUG (Thread-5) [homeassistant.components.sms.gateway] Deleting message

Result of state_machine.GetSMSFolders()

[{'Name': 'Inbox', 'Memory': 'SM', 'Inbox': 1},
 {'Name': 'Outbox', 'Memory': 'SM', 'Inbox': 0},
 {'Name': 'Inbox', 'Memory': 'ME', 'Inbox': 1},
 {'Name': 'Outbox', 'Memory': 'ME', 'Inbox': 0}]

Additional information

I added _LOGGER.error(entry[0]) before state_machine.DeleteSMS(Folder=0, Location=entry[0]["Location"]) to get more logs

sms

Most helpful comment

@pvizeli can we update hassos to include new version of libgammu?

All 27 comments

Hey there @ocalvo, mind taking a look at this issue as its been labeled with an integration (sms) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

This a bug in gammu

This a bug in gammu

There is any work around ?
What happen if the sim card memory is full ?

You will eventually run out of space and no more message will be able to be received.
At this point, if this bug is not resolved, the only alternative is to start looking for gammu replacements.

Sending and receiving messages is very simple, a library like sms3 could be enough to replace gammu.

After receiving more more messages, what is the status your memory?
state_machine.GetSMSFolders()
Is the memory still growing?

@ocalvo I get the same result each time but I keep getting more and more events each time;

[
    {'Name': 'Inbox', 'Memory': 'SM', 'Inbox': 1},
    {'Name': 'Outbox', 'Memory': 'SM', 'Inbox': 0},
    {'Name': 'Inbox', 'Memory': 'ME', 'Inbox': 1},
    {'Name': 'Outbox', 'Memory': 'ME', 'Inbox': 0}
]

Full log : https://pastebin.com/3Yrc2t1B

If you move the Sim to another device, can you still see the received messages?

Get Outlook for Androidhttps://aka.ms/ghei36


From: Zehir notifications@github.com
Sent: Tuesday, September 29, 2020 3:58:41 AM
To: home-assistant/core core@noreply.github.com
Cc: Oscar Calvo oscar@calvonet.com; Mention mention@noreply.github.com
Subject: Re: [home-assistant/core] Integration SMS, can't delete sms, spam sms.incoming_sms events (#40462)

@ocalvohttps://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Focalvo&data=02%7C01%7C%7C7156d5b564fe4505d36708d86466a130%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637369739230760446&sdata=sAaESWyDSLcLVjeVTHzTN8dElQd8DZf%2B8ZdCnkzCBmA%3D&reserved=0 I get the same result each time but I keep getting more and more events each time;

[
{'Name': 'Inbox', 'Memory': 'SM', 'Inbox': 1},
{'Name': 'Outbox', 'Memory': 'SM', 'Inbox': 0},
{'Name': 'Inbox', 'Memory': 'ME', 'Inbox': 1},
{'Name': 'Outbox', 'Memory': 'ME', 'Inbox': 0}
]

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fhome-assistant%2Fcore%2Fissues%2F40462%23issuecomment-700627761&data=02%7C01%7C%7C7156d5b564fe4505d36708d86466a130%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637369739230780438&sdata=1G2wLRWrkwZJPrjvbuLvMeGFL1rMtrT%2B5jf0o2YXQHg%3D&reserved=0, or unsubscribehttps://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAP6UPRNZ74K64UBSURPGJTSIG4WDANCNFSM4RV6AJ3Q&data=02%7C01%7C%7C7156d5b564fe4505d36708d86466a130%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637369739230790435&sdata=qVfWoJAgn685aVAvA4%2B%2F0UhoEzgEBLLLo26OYd81yE0%3D&reserved=0.

Yes I still see them. I just delete them all and send 2 new sms to HA.
First, I got 1 event
Second, I got 2 events

Full log : https://pastebin.com/LS0TGhhP

Can we use the "phone" memory instead of the sim one ?

@ocalvo What hardware is fully compatible for sending and receving sms ? I have two Huawei E220 and one Huawei E3531 and none of them works correctly

I have Huawei E3372.

There is good news, gammu has fixed this bug, so we should get it in the next version of the hypervisor.

E3372 is quite expensive just for sms

You talk about the 3.1 version of python-gammu ?
Any ETA for the next version ?

This will be released via gammu and not python-gammu.
I have asked @nijel when the next release of gammu is.

Good news, Gammu 1.42.0 was just released 1h ago.
Thanks @nijel

@ocalvo So now we need a python-gammu release ?

No, it will just use the new library (unless you're on Windows and using pre-compiled binaries).

@pvizeli can we update hassos to include new version of libgammu?

@pvizeli can we update hassos to include new version of libgammu?

I think we need to start with alpine linux:

https://pkgs.alpinelinux.org/packages?name=gammu&branch=edge

@pvizeli can we update hassos to include new version of libgammu?

I think we need to start with alpine linux:

https://pkgs.alpinelinux.org/packages?name=gammu&branch=edge

How we do that ?

@pvizeli can we update hassos to include new version of libgammu?

I think we need to start with alpine linux:

https://pkgs.alpinelinux.org/packages?name=gammu&branch=edge

How we do that ?

We should start by contacting the package maintainer.

Someone will need to read their contributing guidelines, maybe there is a process to submit a patch to alpine.

@ScrumpyJack is that you the package maintainer of Alpine Linux package of gammu ?

The Alpine Linux packages has been updated, what is the next move @ocalvo ?

The Alpine Linux packages has been updated, what is the next move @ocalvo ?

I am not sure, @pvizeli do we need to update hassos?

@Zehir I would file a new issue in hassos.

The Alpine Linux packages has been updated, what is the next move @ocalvo ?

I am not sure, @pvizeli do we need to update hassos?

@Zehir I would file a new issue in hassos.

You already made one or you want I do it ?

We are on Alpine 3.12 -> https://pkgs.alpinelinux.org/packages?name=gammu&branch=v3.12
So the issue will be fixed if we swap to 3.13 if that is out. You can only ask if they want to backport it to Alpine 3.12 otherwise just wait until the new alpine version is out and we have built all 1k modules to switch the base image.

I think we will need to ask them for a bug fix release 3.12.2, otherwise we may need to wait up to a year.
Filed a new issue on Alpine

Please vote on the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

i-am-shodan picture i-am-shodan  Â·  3Comments

arangates picture arangates  Â·  3Comments

piitaya picture piitaya  Â·  3Comments

coolriku picture coolriku  Â·  3Comments

moskovskiy82 picture moskovskiy82  Â·  3Comments