Error on installing a script for case fan control and power button from command line

I believe the fan is connected to the controller board.

After looking at the script code this doesn’t look that hard.
Everything regards speed control can be simplified to a single line:

bus.write_byte(0x1a,percentage)

I’m sure creating a custom component for this won’t be that hard. The integration would need a single service (according to the docs: https://developers.home-assistant.io/docs/dev_101_services/)
We can monitor CPU temp from Home Assistant, so having a service would allow us to create an automation that would turn on the fan at a specific temperature.
Power events could be done via custom events, this way the user could assign different actions to the power button (not only shut down and reboot).
I could create an integration for argon case and fan hat, but I don’t own the case or the fan.
If someone has a discount code for argon40 shop or could help be getting the case or fan hat that would help me to set up the dev environment.

3 Likes

Have you had any success yet? I just installed the Argon ONE case today. :grinning:

They are out of stock on the Argon One website right now (there are other listings at other sites, but the markup is ridiculous. The case is only $25 from the Argon One site) so will have to wait until they come back in stock. Do you have the Raspberry Pi 4B or the 3B+?

No, I don’t know how to write the code for Alpine Linux. It is different than Debian and I struggled with finding what I needed for the conversion. I only know a very little bit about coding.

I have both, but I use PI 4 for my current dev environment.
I’ve just checked their website, even the fan hat is out of the stock :roll_eyes:
I can create something without the actual device, but I can’t promise it will work properly. I won’t feel comfortable releasing it without even a single test on a physical device.
My idea is to create a service that you will be able to call from any place in Home Assistant.
Something like argon_one.set_fan_speed(20).

This way you can read CPU temp with for example this: HA CPU temps and set fan speed as you like. Even a button to set the fan speed would be possible (https://www.home-assistant.io/lovelace/button/).

Can you try getting the cpu temp using this: HA CPU temps ?? If that will work then we can proceed next :slight_smile:

The Argon One case for the RPi3B and RPi3B+ is in stock for the $25 price. I have it as well as the Argon One for RPi 4B. They are almost identical except for the layout for the boards. I can get one for the 3B for you if you have the board for it as the script is the same for both cases. You would have to PM me your address to send it to you though.

I am not so good at the confg stuff for HA yet. I got a lot of this from Google and then work to customize it as I can for my use. I am learning though. :slight_smile: I use this to read the temp of the RPi board:

                entities:
                  - entity: sensor.processor_use
                    title: CPU
                  - entity: sensor.ha_cpu_temperature
                    title: Temp  
                    unit_of_measurement: 'C'
                    icon: mdi:thermometer
  - platform: command_line
    name: HA CPU Temperature
    command: "cat /sys/class/thermal/thermal_zone0/temp"
    unit_of_measurement: "C"
    value_template: '{{ (value | multiply(0.001)) | round(1) }}'

That’s the exact same script I use :slight_smile:
Automations is the next step. The beginnings are a bit hard, but then you will find it super useful.

Just got the Argon case today and found this thread. Trying to figure this out as well. I found another version of Argon one’s script for a different OS here but it doesn’t work on home assistant either.

https://www.argon40.com/learn/index.php/2020/03/10/argon-one-installation-guide-for-libreelec/

Happy to help you test this. Not sure if you have an Argon One available for testing purposes.

Hi everyone,

I just received my Argon One Case for Raspberry Pi 4, and I’m in the same situation:
The argon1.sh script is built for Debian based OS.
But I found this repo that seems running the Argon deamon in a docker container https://github.com/jmercha/docker-argonone

AFAIK, Hassio is built around Docker, and add-ons are precisely docker containers, so do you think about a solution with that?

PS: I’m developer, I can help to built a integration for Argon One case (fan + button) for Hassio

I’ve started developing an integration. The current version is available here: https://github.com/Misiu/argon40
Sadly I don’t have the case so I can’t properly test the code.
The idea is to create a service that could be used to control the fan speed. This way you can create a cpu temp sensor and use automation to control fan.
You need I2c enabled.

If you want you can try the code. Improvements are welcome :slight_smile:

2 Likes

Oh nice! I’ll try this as soon as I can, and I will let you know if it works! Thanks a lot

@Misiu I just tried to install the integration, but I catch an error at the last step:

    1. Add argon40 : to your configuration.yaml

If I add this to my configuration, Hassio tells me:

The following integrations and platforms could not be set up:
  - argon40
Please check your config.

Would you like talk about this in your GitHub repo, through an issue?

EDIT: It seems to be caused by i2c, which I did activate following this, but the logs show me that is not enabled.

2020-06-11 14:05:47 ERROR (MainThread) [homeassistant.setup] Error during setup of component argon40
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/smbus/smbus.py", line 81, in open
    self._fd = os.open(path, os.O_RDWR, 0)
FileNotFoundError: [Errno 2] No such file or directory: '/dev/i2c-1'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/argon40/__init__.py", line 34, in async_setup
    bus = SMBus(1)
  File "/usr/local/lib/python3.7/site-packages/smbus/smbus.py", line 56, in __init__
    self.open(bus)
  File "/usr/local/lib/python3.7/site-packages/smbus/smbus.py", line 83, in open
    raise IOError(e.errno)
OSError: 2

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 190, in _async_setup_component
    result = await asyncio.wait_for(task, SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/config/custom_components/argon40/__init__.py", line 64, in async_setup
    address,
UnboundLocalError: local variable 'address' referenced before assignment

Sadly I don’t have access to my test environment till the end of the week.
There is an easier way to enable I2c, you need to plug SD card to your PC and edit a single file, but I can’t find the instructions. I’ll post it here and in my repo if I find and test them.

I followed thoses instructions I2c not working on the Pi4
And it works for i2c, now I have /dev/i2c-1 available.

But sadly, I figured out that adding argon40: to my configuration.yml is breaking completely the loading of my HomeAssistant instance. No specific logs via SSH, but the frontend refuse to load.

EDIT:

I found logs after added argon40: in my configuration.yaml:

20-06-12 19:21:42 ERROR (MainThread) [supervisor.homeassistant] Error on call https://172.30.32.1:8123/api/config:

It occurs many times, until I comment argon40: in configuration.yaml. Unfortunately, I don’t know where to find HomeAssistant API logs :confused:

Sorry for late reply.
What version of Home Assistant you have?
I’ll try to debug everything on both PI3 and PI4, but I still don’t have the case so I’ll be asking for help.
You can log issues in my repo or post them here :slight_smile:

I just received my Argon one for my raspberry pi 4 :slight_smile:

I would like to help and test your addon.
The problem is each time I uncomment the line “dtparam=i2c_arm=on” to get i2c, the pi doesn’t boot anymore. I was using this method I2c not working on the Pi4