home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.72k stars 29.98k forks source link

The device storage is full when trying to learn new codes on broadlink.remote component #35875

Closed mikepruett3 closed 4 years ago

mikepruett3 commented 4 years ago

The problem

I was able to use the remote.learn_command service yesterday, before upgrading to 0.110.0 this morning. Now when I try to learn a code, I get an error about The device storage is full. I have plenty of disk space available for my HASS install... and I have tried this on multiple Broadlink RM Mini 3's and have the same issue.

service: remote.learn_command
entity_id: remote.living_room
device: television
command: test

Environment

Problem-relevant configuration.yaml

platform: broadlink
name: "Living Room"
host: 10.10.10.xx
mac: 'XX:XX:XX:XX:XX:XX'
type: rm_mini

Traceback/Error logs

Log Details (ERROR)
Logger: homeassistant.components.broadlink.remote
Source: components/broadlink/remote.py:305
Integration: broadlink (documentation, issues)
First occurred: 2:04:46 PM (1 occurrences)
Last logged: 2:04:46 PM

Failed to learn 'test/television': The device storage is full

Additional information

probot-home-assistant[bot] commented 4 years ago

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

felipediel commented 4 years ago

Hi @mikepruett3. Thanks for reporting this error. I'll fix it, but since I don't have the device, I'll need help to test the solution.

felipediel commented 4 years ago

Testing the solution

1. Set up SSH add-on

1.1. Follow this tutorial. 1.1. Disable Protected Mode. 1.2. Set up a user name and password in the config file.

2. Open a terminal and connect to your device via SSH

ssh USERNAME@HOST

3. Change user to homeassistant.

docker exec -it homeassistant /bin/bash

4. Let's update some files

cd /usr/src/homeassistant/homeassistant/components/broadlink

wget -O __init__.py https://raw.githubusercontent.com/felipediel/home-assistant/fix-learning/homeassistant/components/broadlink/__init__.py

wget -O remote.py https://raw.githubusercontent.com/felipediel/home-assistant/fix-learning/homeassistant/components/broadlink/remote.py

7. Restart Home Assistant

Please let me know if it worked so I can create a pull request.

chrisfonte commented 4 years ago

@felipediel I had the same issue and just tried your potential fix, same behavior.

chrisfonte commented 4 years ago

I removed the "type" from my configuration.yaml and it fixed the issue.

Broadlink

switch:

felipediel commented 4 years ago

@chrisfonte Your problem was in the config file, it is different.

mikepruett3 commented 4 years ago

So I already had SSH access to the ubuntu server running my hassio_supervisor and homeassistant containers. I did docker exec into the homeassistant container, and pull the init.py file down and restart. Still having the same issue.

felipediel commented 4 years ago

@mikepruett3 Please run this file using python3 debug.py and send me debug.txt.

felipediel commented 4 years ago

If the LED blinks during debugging, try to capture a code.

mikepruett3 commented 4 years ago

Here is the debug.txt file. I did look at the closest device when I ran the debug, and no LED activity at all.

debug.txt

felipediel commented 4 years ago

Your firewall is blocking discovery. You can run debug.py using your computer if you want, just make sure you are on the same network.

mikepruett3 commented 4 years ago

So this worked before updating to 0.110.0 this morning. I have not made any other network changes, or any changes on my firewall (Ubiquity EdgeRouterX). Having said that, I did do a few tests using the broadlink python3 library (my python sucks, but I did find some discovery steps on the python-broadlink github page.

From my workstation on the same network

python3
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import broadlink
>>> devices = broadlink.discover(timeout=30)
>>> print(devices)
[<broadlink.rm object at 0x0000021898400820>, <broadlink.rm object at 0x00000218984007C0>]

yet when I try from the homeassistant container...

docker exec -it homeassistant /bin/bash
bash-5.0# python3
Python 3.7.7 (default, Apr 28 2020, 13:57:57)
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import broadlink
>>> devices = broadlink.discover(timeout=30)
>>> print(devices)
[]

Could this have something to do with hassio ingress or apparmor?

mikepruett3 commented 4 years ago

On a whim, I tried the same test from the bash console of the ubuntu server hosting the homeassistant container, and discovery works there as well...

$ python3
Python 3.6.9 (default, Apr 18 2020, 01:56:04)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import broadlink
>>> devices = broadlink.discover(timeout=30)
>>> print(devices)
[<broadlink.rm object at 0x7f52dc838438>, <broadlink.rm object at 0x7f52dc8385f8>]
>>>
felipediel commented 4 years ago

You need to run debug.py on your workstation.

mikepruett3 commented 4 years ago

Ok, so I ran the debug.py from the ubuntu server running the homeassistant container (not from inside the container), and this is the debug.txt file that was created...

debug-outside-container.txt

Note, when I run the debug.py from inside the homeassitant container, I get this debug.txt output

debug-inside-container.txt

mikepruett3 commented 4 years ago

Here is the debug.txt from my workstation...

debug-from-workstation.txt

felipediel commented 4 years ago

Ok, the debug is working. Now try to learn a code when the LED blinks and send me debug.txt. Don't do it inside the container.

mikepruett3 commented 4 years ago

Here is the debug.txt, I ran it from the ubuntu server console.

code-learn-debug.txt

felipediel commented 4 years ago

Strange, there are no error codes in the response. Tomorrow I will create a custom debug script to understand what is going on. I'll keep you informed.

francescoanoe commented 4 years ago

Hi Guys, landing here after searching.. same problem here with 0.110 on hassOS via Hyper-V and a RM4 mini. Launching services broadlink.learn and remote.learn_command report same error:

image

If i send a command previously learned from itself all works, i see the white led blink.

Available for testing or debug....

com-xuonghuynh commented 4 years ago

I have a same problem

ciec68 commented 4 years ago

I have a same problem too - 0.110.0 and a RM3 mini

anamika784 commented 4 years ago

I have a same problem too. ( Home Assistant Core release with the issue: 0.110.0 and a RM4 mini) ERROR (MainThread) [homeassistant.components.broadlink] Failed to learn: The device storage is full

r0b3rt74 commented 4 years ago

Same error here And no notifications when learning. Hassio 0.110.0.

francescoanoe commented 4 years ago

Thank you @felipediel Unfortunately i cant learn any command because the RM4 dont receive any ir code. After call the services the error appearing immediately and with any iteraction with the broadlink. The white led doesnt appear.. it works only if i manually send an ir but i dont have finished the capture work... 😄 I will put my self in queue for the fixing! 🤞 See you

sebastian-steinmann commented 4 years ago

@felipediel Does that mean the codes are sent, and the error is kinda irrelevant?

felipediel commented 4 years ago

I deleted my previous comment because I was wrong and I don't want to create confusion. I just implemented a possible solution based on a deeper analysis of the debug files. Could anyone help me test it?

@sebastian-steinmann I was wrong. The error needs to be handled.

JayNewstrom commented 4 years ago

I'm able to test, and it's no longer throwing the error in the logs.

But this is also my first time setting up this integration, and I'm unsure how to view the learned code. Where do I see the learned code?

felipediel commented 4 years ago

@JayNewstrom Are you using broadlink.learn or remote.learn_command?

JayNewstrom commented 4 years ago

I'm using remote.learn_command. But I can setup something else if that's the way to go.

JayNewstrom commented 4 years ago

I see now, I just didn't finish reading the documentation, my bad.

I see the learned commands in the json file/root/config/.storage

Everything seems to be working as expected on my end.

felipediel commented 4 years ago

Great! I will create a PR.

r0b3rt74 commented 4 years ago

@felipediel Will the solution also work for Hassio?

JayNewstrom commented 4 years ago

I was testing in Hassio and broadlink rm mini 4

sebastian-steinmann commented 4 years ago

I just tested this, but still getting the error.

Even tried rebooting the entire host-system. What kinda info do you need to debug?

felipediel commented 4 years ago

@sebastian-steinmann Are you sure? Storage error? Please run this file using python3 debug.py and send me debug.txt.

sebastian-steinmann commented 4 years ago

Getting no device discovered, not sure how to get the text-file out, but that seems like the gist of it. So might be something on my end.

But yeah, getting the full error: Failed to learn 'power/tv': The device storage is full

felipediel commented 4 years ago

I just updated the files to wait a second before reading the data. Could you try again?

sebastian-steinmann commented 4 years ago

Still the same error, but I got the debug.py script working by adding my localip and discoverip in the script.

Its all seemed to work fine then. Do you want the debug.txt after my changes?

Also, best way to get the file out of the container?

felipediel commented 4 years ago

You can run debug.py on your computer.

sebastian-steinmann commented 4 years ago

debug.txt

sebastian-steinmann commented 4 years ago

I just saw I was getting the error on the wrong type of component, set type: rm4_mini, and now it works!

it was on switch:218, and thats sp1

felipediel commented 4 years ago

I'l kill you hahahaha :smile: Great! Ready to merge.

mikepruett3 commented 4 years ago

Testing the solution

1. Set up SSH add-on

1.1. Follow this tutorial. 1.1. Disable Protected Mode. 1.2. Set up a user name and password in the config file.

2. Open a terminal and connect to your device via SSH

ssh USERNAME@HOST

3. Change user to homeassistant.

docker exec -it homeassistant /bin/bash

4. Let's update some files

cd /usr/src/homeassistant/homeassistant/components/broadlink

wget -O __init__.py https://raw.githubusercontent.com/felipediel/home-assistant/fix-learning/homeassistant/components/broadlink/__init__.py

wget -O remote.py https://raw.githubusercontent.com/felipediel/home-assistant/fix-learning/homeassistant/components/broadlink/remote.py

7. Restart Home Assistant

Please let me know if it worked so I can create a pull request.

Just tried these new files, and its working for me now! No storage error, and I was able to learn and use the code.

Thanks!

felipediel commented 4 years ago

@mikepruett3 Thanks for the feedback!

taita2104 commented 4 years ago

@felipediel having the same issue. Merged in your change and now I get Platform error switch.broadlink - cannot import name 'DOMAIN' from 'homeassistant.components.broadlink' (/usr/src/homeassistant/homeassistant/components/broadlink/__init__.py) Platform error switch.broadlink - cannot import name 'DOMAIN' from 'homeassistant.components.broadlink' (/usr/src/homeassistant/homeassistant/components/broadlink/__init__.py)

felipediel commented 4 years ago

@Critical2104 You did something wrong. Replace all files in the folder and it will work fine. If it doesn't work, the problem is being caused by a custom component.

taita2104 commented 4 years ago

@Critical2104 You did something wrong. Replace all files in the folder and it will work fine. If it doesn't work, the problem is being caused by a custom component.

Flashed a new HA instance, only other custom component is SmartIR, merged in again your changes and now I always get Failed to send packet: The device storage is full

I have two rm mini 3, one bought almost one year ago and it is working fine, and another one bought last week that is causing me this issue. Apparently the two devices are identical.

marco76mk commented 4 years ago

Testing the solution

1. Set up SSH add-on

1.1. Follow this tutorial. 1.1. Disable Protected Mode. 1.2. Set up a user name and password in the config file.

2. Open a terminal and connect to your device via SSH

ssh USERNAME@HOST

3. Change user to homeassistant.

docker exec -it homeassistant /bin/bash

4. Let's update some files

cd /usr/src/homeassistant/homeassistant/components/broadlink

wget -O __init__.py https://raw.githubusercontent.com/felipediel/home-assistant/fix-learning/homeassistant/components/broadlink/__init__.py

wget -O remote.py https://raw.githubusercontent.com/felipediel/home-assistant/fix-learning/homeassistant/components/broadlink/remote.py

7. Restart Home Assistant

Please let me know if it worked so I can create a pull request.

works on my broadlink RM mini 3 (new firmware): remote:

Thanks!!!

orson1282 commented 4 years ago

I also had this problem and I just upgraded to the 0.110.2 and it seems to have fixed the problem, buuuttt... :-) I just installled a new remote, and noticed the following. All of the other remotes I have create 2 files in the .storage folder. broadlinkremote_flags broadlinkremote_codes

This time only the _codes file was created, but not the _flags file. I don't know if this means anything, but I just thought you should know @felipediel .