GithubHelp home page GithubHelp logo

misiu / argon40 Goto Github PK

View Code? Open in Web Editor NEW
116.0 14.0 22.0 535 KB

Home Assistant support for Argon ONE Pi 3 & 4 cases and Argon Fan HAT

License: MIT License

Python 100.00%
argon40 argon argon-fan-hat

argon40's People

Contributors

dependabot[bot] avatar mcristina422 avatar minims avatar misiu avatar vondras avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

argon40's Issues

[Bug] Fan Speed not changing

I've got an automation that turns the fan off if its below 50. I can see that the automation has triggered and the CPU temperature is 30, however the fan speed does not change?

alias: '[Argon One] Turn Off Fan Below 50'
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.cpu_temperature
    below: '50'
condition: []
action:
  - service: argon40.set_fan_speed
    data:
      speed: 0
mode: single

can't find the service argon40.set_fan_speed

Hi argon40 team,
i'm trying yo install your component but, following the installation guide, i can't find the service argon40.set_fan_speed

Can you check compatibility with version | core-2021.9.4 (and.5) ?

Please let me know, thank you.

step:

configuration.yaml

image

custom_component

image

restart HA and

image

not log problem

image

2021-09-09 13:34:56 ERROR (MainThread) [homeassistant.setup] Setup failed for argon40: Integration failed to initialize.
2021-09-09 13:34:56 ERROR (Thread-2) [root] Uncaught thread exception

Argon40 Fan Speed Sensor

RPi4B 4gb
CPU 2100mhz
Hassos
Hi,
This integration works brilliantly, however I feel it needs a few enhancements if you have the time or if even possible:

  1. Add a sensor that displays the Fan Speed in % of full speed. My reasoning behind this I have set up several automatons that change/control/proportionally the fan speed % according to CPU temperatures above 50 DEGC. Currently the only way to determine what speed the fan is at is by looking at most recent automation time stamp. I have considered creating automatons or monitor events when a particular automation is called but this would be cumbersome.

  2. Currently when Home assistant is restarted the case fan automatically turns on to a predetermined speed (cant tell what speed, but sounds approx. 50%) Therefore an option to Set a boolean flag so that in configuration.yaml the fan speed can be set to off or a predetermined value. The fan speed will then be changed according to automation triggers. I have created an Automation to so that runs on start to set fan to of, but would be great to see this as a configuration option.

Thanks in advance or your consideration
Regards,
Shane

Integration failed to initialize - Uncaught thread exception

Version of the custom_component

0.0.2

Describe the bug

Integration doesn't start.
I have enabled i2c with configuration below:
config.txt:

dtparam=i2c1=on
dtparam=i2c_arm=on

rpi-i2c.conf:

i2c-bcm2708
i2c-bcm2835
i2c-dev

Raspberry Pi 4
HassOS 4.17
Home Assistant 0.118.2

Debug log


2020-11-21 18:21:20 INFO (MainThread) [homeassistant.setup] Setting up argon40
2020-11-21 18:21:20 INFO (MainThread) [custom_components.argon40] 
-------------------------------------------------------------------
Argon40
Version: 0.0.2
This is a custom integration!
If you have any issues with this you need to open an issue here:
https://github.com/Misiu/argon40/issues
-------------------------------------------------------------------

2020-11-21 18:21:20 INFO (MainThread) [homeassistant.setup] Setup of domain argon40 took 0.0 seconds
2020-11-21 18:21:20 ERROR (MainThread) [homeassistant.setup] Setup failed for argon40: Integration failed to initialize.
2020-11-21 18:21:20 ERROR (Thread-2) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/logging/handlers.py", line 1487, in _monitor
    self.handle(record)
  File "/usr/local/lib/python3.8/logging/handlers.py", line 1468, in handle
    handler.handle(record)
  File "/usr/local/lib/python3.8/logging/__init__.py", line 950, in handle
    self.emit(record)
  File "/usr/src/homeassistant/homeassistant/components/system_log/__init__.py", line 195, in emit
    entry = LogEntry(record, stack, _figure_out_source(record, stack, self.hass))
  File "/usr/src/homeassistant/homeassistant/components/system_log/__init__.py", line 100, in __init__
    self.message = deque([record.getMessage()], maxlen=5)
  File "/usr/local/lib/python3.8/logging/__init__.py", line 369, in getMessage
    msg = msg % self.args
TypeError: %d format: a number is required, not NoneType


2020-11-21 18:21:20 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=persistent_notification, service=create, service_data=title=Invalid config, message=The following integrations and platforms could not
 be set up:

 - argon40

Please check your config and [logs](/config/logs)., notification_id=invalid_config>


2020-11-21 18:21:22 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=persistent_notification.invalid_config, old_state=None, new_state=<state persistent_notification.invalid_config=notifying; title=I
nvalid config, message=The following integrations and platforms could not be set up:

 - argon40

Please check your config and [logs](/config/logs). @ 2020-11-21T18:21:22.645930+03:00>>

Double tap is spamming

Version of the custom_component

VERSION = "0.0.1"

hassOS 5.2 on rpi 4.

Configuration

argon40:

Describe the bug

I setup the sample automation of creating a notification with the double tap of the power button. For some reason this is triggering every minute even when the power button is not being pressed. If I use a different OS (different usb stick) and the provided Argon40 script it detects and reacts normally to power buttons so doesn't seem to be a physical/connection issue.

init.py ERROR

Logger: homeassistant.setup
Source: custom_components/argon40/init.py:79
First occurred: 21:53:16 (1 occurrences)
Last logged: 21:53:16

Error during setup of component argon40
Traceback (most recent call last):
File "/usr/local/lib/python3.8/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 38, in async_setup
bus = SMBus(1)
File "/usr/local/lib/python3.8/site-packages/smbus/smbus.py", line 56, in init
self.open(bus)
File "/usr/local/lib/python3.8/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 213, in _async_setup_component
result = await task
File "/config/custom_components/argon40/init.py", line 79, in async_setup
address,
UnboundLocalError: local variable 'address' referenced before assignment

Sensor for fan speed

Is there a way for me to create a sensor to detect fan speeds?
I'm using the cpu temp sensor:

- platform: command_line
  name: CPU Temp
  command: "cat /sys/class/thermal/thermal_zone0/temp"
  unit_of_measurement: "°C"
  value_template: "{{ value | multiply(0.001) | round(1) }}"

...and I tried to find something similar from the HASSOS command line, where I could see the speed of the fan, but I didn't get lucky.

Just another query

This is a more of a "question for dummies "than a bug report.

I bought the argon40 V2 the other day to put on my Pi4 which runs Home assistant. Because home assistant uses ssh Web and terminal commands rather than the standard sudo and apt-get commands, i haven't been able to download and install the https://download.argon40.com/argon1.sh | bash as per Argon instructions. Does this repo bypass the need for that or do i still need to work out how to install that script on home assistant ? cause i'm struggling to find out how

I got this addon installed and i2c enabled etc, but i swear the fan isnt operating at all, hence the question :)

Raspberry 4B need I2C

When I turn on argon40, there was an error with missing I2C (FileNotFoundError: [Errno 2] No such file or directory: '/dev/i2c-1') in my Raspberry 4B 8GB..

I was searching solution and problems fixed with advices at this links:

It would be nice to add into documentation, can help others :-)

Secondary, I have suggestion to automatization of the Fan (in manual was mentioned temperatures and recommended power settings):

- alias: "Fan speed 0% (<55°C)"
  trigger:
    platform: numeric_state
    entity_id: sensor.cpu_temp
    below: 55
  action:
    - service: argon40.set_fan_speed
      data:
        speed: 0

- alias: "Fan speed 10% (>55°C)"
  trigger:
    platform: numeric_state
    entity_id: sensor.cpu_temp
    above: 55
  action:
    - service: argon40.set_fan_speed
      data:
        speed: 10

- alias: "Fan speed 55% (>60°C)"
  trigger:
    platform: numeric_state
    entity_id: sensor.cpu_temp
    above: 60
  action:
    - service: argon40.set_fan_speed
      data:
        speed: 55

- alias: "Fan speed 100% (>65°C)"
  trigger:
    platform: numeric_state
    entity_id: sensor.cpu_temp
    above: 65
  action:
    - service: argon40.set_fan_speed
      data:
        speed: 100

After adding config the home assistant started as safe mode

  - platform: command_line
    name: CPU Temp
    command: "cat /sys/class/thermal/thermal_zone0/temp"
    unit_of_measurement: "°C"
    value_template: "{{ value | multiply(0.001) | round(1) }}"

I have added this configuration to the configuration.yaml directly, and after that, the home assistant started as safe mode

RuntimeError: Failed to add edge detection after update to HomeAssistantOS 12.3

Version of the custom_component

0.0.5

Configuration

...
argon40:
...

Describe the bug

After updating to HomeAssistant OS 12.3 the integration fails to load.

Debug log


Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 404, in _async_setup_component
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/argon40/__init__.py", line 71, in async_setup
    GPIO.add_event_detect(shutdown_pin, GPIO.BOTH, callback=event_detect_callback)
RuntimeError: Failed to add edge detection

Fan control for 'speed 0' not working in release 2

Hi @Misiu, since release 2 it appears that setting the fan speed to 0% does not work. I have tried re-creating the automations and re-installing the component files, and I've not been able to identify anything wrong in the logs. My hardware is a Raspberry Pi 4 8GB running the Argon ONE M.2 enclosure.

I've redacted location data from the log entries for privacy, however the remaining entries are intact. If there are any additional configuration files or log entries that will be of assistance please let me know and I'll supply them for you.

Fan speed is being detected correctly; currently at 38.9 °C. I'm unable to confirm at which speed the fan is running based on my automation entries, but it is spinning.

Logs

HA debug logs refrencing term 'argon40'
2021-04-11 16:15:24 WARNING (MainThread) [homeassistant.loader] You are using a custom integration argon40 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
2021-04-11 16:15:27 INFO (MainThread) [homeassistant.bootstrap] Setting up stage 2: {'dhcp', 'media_source', 'rpi_power', 'timer', 'input_boolean', 'tag', 'sensor', 'map', 'tado', 'hue', 'default_config', 'sun', 'zone', 'history', 'input_select', 'met', 'updater', 'group', 'input_number', 'homekit_controller', 'my', 'mobile_app', 'ssdp', 'tts', 'sonos', 'automation', 'logbook', 'input_text', 'synology_dsm', 'argon40', 'deconz', 'counter', 'scene', 'input_datetime', 'zwave_js', 'system_health', 'script', 'zeroconf', 'blueprint', 'roku', 'cast'}
2021-04-11 16:15:29 INFO (MainThread) [homeassistant.setup] Setting up argon40
2021-04-11 16:15:29 INFO (MainThread) [custom_components.argon40]
-------------------------------------------------------------------
Argon40
Version: 0.0.2
This is a custom integration!
If you have any issues with this you need to open an issue here:
https://github.com/Misiu/argon40/issues
-------------------------------------------------------------------
2021-04-11 16:15:29 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=argon40, service=set_fan_speed>
2021-04-11 16:15:29 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=argon40, service=set_mode>
2021-04-11 16:15:29 INFO (MainThread) [homeassistant.setup] Setup of domain argon40 took 0.0 seconds
2021-04-11 16:15:29 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=argon40>
2021-04-11 16:15:31 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [548198226192] Sending {'id': 25, 'type': 'result', 'success': True, 'result': {'latitude': REDACTED, 'longitude': REDACTED, 'elevation': REDACTED, 'unit_system': {'length': 'km', 'mass': 'g', 'pressure': 'Pa', 'temperature': '°C', 'volume': 'L'}, 'location_name': 'Home', 'time_zone': 'Europe/London', 'components': {'image', 'binary_sensor.rpi_power', 'dhcp', 'media_source', 'rpi_power', 'timer', 'logger', 'input_boolean', 'binary_sensor.updater', 'auth', 'tag', 'sensor', 'media_player.sonos', 'system_log', 'map', 'onboarding', 'cloud', 'persistent_notification', 'sensor.command_line', 'sun', 'alexa', 'zone', 'history', 'input_select', 'homeassistant', 'updater', 'group', 'input_number', 'binary_sensor', 'frontend', 'my', 'ssdp', 'config', 'api', 'tts', 'media_player', 'sonos', 'http', 'logbook', 'person', 'recorder', 'input_text', 'argon40', 'counter', 'scene', 'input_datetime', 'zwave_js', 'device_automation', 'search', 'system_health', 'script', 'lovelace', 'hassio', 'blueprint', 'scene.homeassistant', 'webhook', 'zeroconf', 'stt', 'websocket_api'}, 'config_dir': '/config', 'whitelist_external_dirs': {'/config/www', '/media'}, 'allowlist_external_dirs': {'/config/www', '/media'}, 'allowlist_external_urls': set(), 'version': '2021.3.4', 'config_source': 'storage', 'safe_mode': False, 'state': 'NOT_RUNNING', 'external_url': None, 'internal_url': None}}
2021-04-11 16:15:31 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [548198226192] Sending {'id': 32, 'type': 'result', 'success': True, 'result': {'latitude': REDACTED, 'longitude': REDACTED, 'elevation': REDACTED, 'unit_system': {'length': 'km', 'mass': 'g', 'pressure': 'Pa', 'temperature': '°C', 'volume': 'L'}, 'location_name': 'Home', 'time_zone': 'Europe/London', 'components': {'image', 'binary_sensor.rpi_power', 'dhcp', 'media_source', 'rpi_power', 'timer', 'logger', 'input_boolean', 'binary_sensor.updater', 'auth', 'tag', 'sensor', 'media_player.sonos', 'system_log', 'map', 'onboarding', 'cloud', 'persistent_notification', 'sensor.command_line', 'sun', 'alexa', 'zone', 'history', 'input_select', 'homeassistant', 'updater', 'group', 'input_number', 'binary_sensor', 'frontend', 'my', 'ssdp', 'config', 'api', 'tts', 'media_player', 'sonos', 'http', 'logbook', 'person', 'recorder', 'input_text', 'argon40', 'counter', 'scene', 'input_datetime', 'zwave_js', 'device_automation', 'search', 'system_health', 'script', 'lovelace', 'hassio', 'blueprint', 'scene.homeassistant', 'webhook', 'zeroconf', 'stt', 'websocket_api'}, 'config_dir': '/config', 'whitelist_external_dirs': {'/config/www', '/media'}, 'allowlist_external_dirs': {'/config/www', '/media'}, 'allowlist_external_urls': set(), 'version': '2021.3.4', 'config_source': 'storage', 'safe_mode': False, 'state': 'NOT_RUNNING', 'external_url': None, 'internal_url': None}}
2021-04-11 16:15:31 DEBUG (MainThread) [homeassistant.helpers.translation] Cache miss for en-GB: image, binary_sensor.rpi_power, dhcp, media_source, rpi_power, timer, logger, input_boolean, binary_sensor.updater, auth, tag, sensor, media_player.sonos, system_log, map, onboarding, cloud, persistent_notification, sensor.command_line, sun, alexa, zone, history, input_select, homeassistant, updater, group, input_number, binary_sensor, frontend, my, ssdp, config, api, tts, media_player, sonos, http, logbook, person, recorder, input_text, argon40, counter, scene, input_datetime, zwave_js, device_automation, search, system_health, script, lovelace, hassio, blueprint, scene.homeassistant, webhook, zeroconf, stt, websocket_api
2021-04-11 16:15:32 DEBUG (SyncWorker_7) [homeassistant.util.json] JSON file not found: /config/custom_components/argon40/translations/en-GB.json
2021-04-11 16:15:32 DEBUG (SyncWorker_0) [homeassistant.util.json] JSON file not found: /config/custom_components/argon40/translations/en.json
2021-04-11 16:15:34 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [548198226192] Sending {'id': 34, 'type': 'result', 'success': True, 'result': {'resources': {'component.websocket_api.title': 'Home Assistant WebSocket API', 'component.blueprint.title': 'Blueprint', 'component.stt.title': 'Speech-to-Text (STT)', 'component.zeroconf.title': 'Zero-configuration networking (zeroconf)', 'component.hassio.title': 'Home Assistant Supervisor', 'component.lovelace.title': 'Lovelace', 'component.script.title': 'Scripts', 'component.system_health.title': 'System Health', 'component.search.title': 'Search', 'component.device_automation.title': 'Device Automation', 'component.zwave_js.title': 'Z-Wave JS', 'component.input_datetime.title': 'Input Datetime', 'component.scene.title': 'Scenes', 'component.counter.title': 'Counter', 'component.argon40.title': 'Argon40', 'component.input_text.title': 'Input Text', 'component.recorder.title': 'Recorder', 'component.person.title': 'Person', 'component.logbook.title': 'Logbook', 'component.http.title': 'HTTP', 'component.sonos.title': 'Sonos', 'component.media_player.title': 'Media Player', 'component.tts.title': 'Text-to-Speech (TTS)', 'component.api.title': 'Home Assistant API', 'component.config.title': 'Configuration', 'component.ssdp.title': 'Simple Service Discovery Protocol (SSDP)', 'component.my.title': 'My Home Assistant', 'component.frontend.title': 'Home Assistant Frontend', 'component.binary_sensor.title': 'Binary Sensor', 'component.input_number.title': 'Input Number', 'component.group.title': 'Group', 'component.updater.title': 'Updater', 'component.homeassistant.title': 'Home Assistant Core Integration', 'component.input_select.title': 'Input Select', 'component.history.title': 'History', 'component.zone.title': 'Zone', 'component.webhook.title': 'Webhook', 'component.alexa.title': 'Amazon Alexa', 'component.sun.title': 'Sun', 'component.persistent_notification.title': 'Persistent Notification', 'component.cloud.title': 'Home Assistant Cloud', 'component.onboarding.title': 'Home Assistant Onboarding', 'component.system_log.title': 'System Log', 'component.map.title': 'Map', 'component.sensor.title': 'Sensor', 'component.tag.title': 'Tags', 'component.auth.title': 'Auth', 'component.input_boolean.title': 'Input Boolean', 'component.logger.title': 'Logger', 'component.timer.title': 'Timer', 'component.rpi_power.title': 'Raspberry Pi Power Supply Checker', 'component.media_source.title': 'Media Source', 'component.dhcp.title': 'DHCP Discovery', 'component.image.title': 'Image'}}}

Configuration files

Files groups.yaml, scripts.yaml and scenes.yaml are empty and have not been included.

/config/configuration.yaml
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

argon40:

sensor:
  - platform: command_line
    name: CPU Temp
    command: "cat /sys/class/thermal/thermal_zone0/temp"
    unit_of_measurement: "°C"
    value_template: "{{ value | multiply(0.001) | round(1) }}"

recorder:
    purge_keep_days: 60
    db_url: !secret recorder_db_url

history:

logbook:

logger:
    default: debug
/config/automations.yaml
- alias: 'Argon One: Fan speed 0% (<50°C)'
  trigger:
    platform: numeric_state
    entity_id: sensor.cpu_temp
    below: 50.0
    for:
      minutes: 1
  action:
  - service: argon40.set_fan_speed
    data:
      speed: 0

- alias: 'Argon One: Fan speed 10% (>50°C)'
  trigger:
    platform: numeric_state
    entity_id: sensor.cpu_temp
    above: 50.0
    for:
      minutes: 1
  action:
  - service: argon40.set_fan_speed
    data:
      speed: 10

- alias: 'Argon One: Fan speed 55% (>55°C)'
  trigger:
    platform: numeric_state
    entity_id: sensor.cpu_temp
    above: 55.0
    for:
      minutes: 1
  action:
  - service: argon40.set_fan_speed
    data:
      speed: 55

- alias: 'Argon One: Fan speed 100% (>60°C)'
  trigger:
    platform: numeric_state
    entity_id: sensor.cpu_temp
    above: 60.0
    for:
      minutes: 1
  action:
  - service: argon40.set_fan_speed
    data:
      speed: 100
/config/custom_components/argon40/__init__.py
"""Support for Argon 40 cases and Argon Fan HAT"""
import logging
from typing import Any

from RPi import GPIO  # pylint: disable=import-error
from custom_components.argon40.const import (
    ATTR_ALWAYS_ON_NAME,
    ATTR_SPEED_NAME,
    DOMAIN,
    SERVICE_SET_FAN_SPEED,
    SERVICE_SET_MODE,
    STARTUP_MESSAGE,
)
from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType, HomeAssistantType, ServiceDataType
from smbus import SMBus
import voluptuous as vol

_LOGGER = logging.getLogger(__name__)

SERVICE_SET_FAN_SPEED_SCHEMA = vol.Schema(
    {vol.Required(ATTR_SPEED_NAME): vol.All(vol.Coerce(int), vol.Range(min=0, max=100))}
)

SERVICE_SET_MODE_SCHEMA = vol.Schema({vol.Required(ATTR_ALWAYS_ON_NAME): cv.boolean})

I2C_ADDRESS = 0x1A


async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
    """Set up the Argon40 component."""

    _LOGGER.info(STARTUP_MESSAGE)

    try:
        rev = GPIO.RPI_REVISION
        if rev == 2 or rev == 3:
            bus = SMBus(1)
        else:
            bus = SMBus(0)

        # @callback
        # def cleanup_gpio(event: Any) -> None:
        #     """Stuff to do before stopping."""
        #     GPIO.cleanup()

        # # not sure if @callback needed
        # @callback
        # def prepare_gpio(event: Any) -> None:
        #     """Stuff to do when Home Assistant starts."""
        #     hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, cleanup_gpio)

        # hass.bus.listen_once(EVENT_HOMEASSISTANT_START, prepare_gpio)

        GPIO.setwarnings(False)
        GPIO.setmode(GPIO.BCM)
        shutdown_pin = 4
        GPIO.setup(shutdown_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

        @callback
        def event_detect_callback(channel):
            if GPIO.input(shutdown_pin):
                _LOGGER.debug("Rising edge detected on 4")
                # hass.bus.async_fire("argon40_event", {"key": "pressed"})
            else:
                _LOGGER.debug("Falling edge detected on 4")
                hass.bus.async_fire("argon40_event", {"action": "double-tap"})

        GPIO.add_event_detect(shutdown_pin, GPIO.BOTH, callback=event_detect_callback)

        bus.write_byte(I2C_ADDRESS, 10)

    except IOError as err:
        _LOGGER.exception(
            "Error %d, %s accessing 0x%02X: Check your I2C address",
            err.errno,
            err.strerror,
            I2C_ADDRESS,
        )
        return False

    async def set_fan_speed(service: ServiceDataType) -> None:
        value = service.data.get(ATTR_SPEED_NAME)
        _LOGGER.debug("Set fan speed to %s", value)
        bus.write_byte(I2C_ADDRESS, value)
        hass.bus.async_fire("argon40_event", {"speed": value})

    hass.services.async_register(
        DOMAIN,
        SERVICE_SET_FAN_SPEED,
        set_fan_speed,
        schema=SERVICE_SET_FAN_SPEED_SCHEMA,
    )

    async def set_mode(service: ServiceDataType) -> None:
        value = service.data.get(ATTR_ALWAYS_ON_NAME)
        _LOGGER.debug("Set always on mode to %s", value)
        if value:
            bus.write_byte(I2C_ADDRESS, 254)  # 0xfe - always on mode
        else:
            bus.write_byte(I2C_ADDRESS, 253)  # 0xfd - the default mode

        hass.bus.async_fire("argon40_event", {"always_on": value})

    hass.services.async_register(
        DOMAIN, SERVICE_SET_MODE, set_mode, schema=SERVICE_SET_MODE_SCHEMA,
    )

    return True
/config/custom_components/argon40/const.py
"""Constants for Argon40."""

NAME = "Argon40"
DOMAIN = "argon40"
VERSION = "0.0.2"

ATTR_SPEED_NAME = "speed"
SERVICE_SET_FAN_SPEED = "set_fan_speed"

ATTR_ALWAYS_ON_NAME = "always_on"
SERVICE_SET_MODE = "set_mode"

ISSUE_URL = "https://github.com/Misiu/argon40/issues"
STARTUP_MESSAGE = f"""
-------------------------------------------------------------------
{NAME}
Version: {VERSION}
This is a custom integration!
If you have any issues with this you need to open an issue here:
{ISSUE_URL}
-------------------------------------------------------------------
"""
/config/custom_components/argon40/manifest.json
{
  "domain": "argon40",
  "name": "Argon40",
  "version": "0.0.2",
  "documentation": "https://github.com/Misiu/argon40",
  "issue_tracker": "https://github.com/Misiu/argon40/issues",
  "dependencies": [],
  "config_flow": false,
  "codeowners": [
    "@Misiu"
  ],
  "requirements": [
    "RPi.GPIO==0.7.0",
    "smbus-cffi==0.5.1"
  ]
}
/config/custom_components/argon40/services.yaml
# Describes the format for available fan services
set_fan_speed:
  description: Set the fan speed.
  fields:
    speed:
      description: Speed
      example: 50

set_mode:
  description: Enable or disable the Always ON mode.
  fields:
    always_on:
      description: "true to enable Always ON mode, false to set the default"
      example: true

System health

version core-2021.3.4
installation_type Home Assistant OS
dev false
hassio true
docker true
virtualenv false
python_version 3.8.7
os_name Linux
os_version 5.4.83-v8
arch aarch64
timezone Europe/London
Home Assistant Cloud
logged_in true
subscription_expiration 30 April 2021, 1:00
relayer_connected true
remote_enabled true
remote_connected true
alexa_enabled true
google_enabled true
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 5.12
update_channel stable
supervisor_version supervisor-2021.03.9
docker_version 19.03.13
disk_total 219.4 GB
disk_used 4.7 GB
healthy true
supported true
board rpi4-64
supervisor_api ok
version_api ok
installed_addons Let's Encrypt (4.11.0), NGINX Home Assistant SSL proxy (3.0.1), Samba share (9.3.1), File editor (5.2.0), deCONZ (6.8.0), MariaDB (2.3.0), Terminal & SSH (9.1.0), Z-Wave JS to MQTT (0.11.0)
Lovelace
dashboards 1
resources 0
mode auto-gen

Fan control addition

Just adding this to my HA and thought it might help others to give more control over the fan

`- id: Set-fan-speed-off
alias: Set-fan-speed-off
description: 'Turn off fan on start'
trigger:
- platform: homeassistant
event: start
condition: []
action:
- service: argon40.set_fan_speed
data:
speed: 0
mode: single

  • id: Set-fan-speed-on-0
    alias: CPU fan high speed 0
    description: Turn up fan speed when CPU is under 35 degrees
    trigger:
    • platform: numeric_state
      entity_id: sensor.cpu_temp
      below: '35'
      condition: []
      action:
    • service: argon40.set_fan_speed
      data:
      speed: 0
      mode: single
  • id: Set-fan-speed-on-10
    alias: CPU fan high speed 10
    description: Turn up fan speed when CPU is over 35 degrees
    trigger:
    • platform: numeric_state
      entity_id: sensor.cpu_temp
      above: '35'
      condition: []
      action:
    • service: argon40.set_fan_speed
      data:
      speed: 10
      mode: single
  • id: Set-fan-speed-on-20
    alias: CPU fan high speed 20
    description: Turn up fan speed when CPU is over 45 degrees
    trigger:
    • platform: numeric_state
      entity_id: sensor.cpu_temp
      above: '45'
      condition: []
      action:
    • service: argon40.set_fan_speed
      data:
      speed: 20
      mode: single
  • id: Set-fan-speed-on-30
    alias: CPU fan high speed 30
    description: Turn up fan speed when CPU is over 50 degrees
    trigger:
    • platform: numeric_state
      entity_id: sensor.cpu_temp
      above: '50'
      condition: []
      action:
    • service: argon40.set_fan_speed
      data:
      speed: 30
      mode: single
  • id: Set-fan-speed-on-40
    alias: CPU fan high speed 40
    description: Turn up fan speed when CPU is over 55 degrees
    trigger:
    • platform: numeric_state
      entity_id: sensor.cpu_temp
      above: '55'
      condition: []
      action:
    • service: argon40.set_fan_speed
      data:
      speed: 40
      mode: single
  • id: Set-fan-speed-on-50
    alias: CPU fan high speed 50
    description: Turn up fan speed when CPU is over 60 degrees
    trigger:
    • platform: numeric_state
      entity_id: sensor.cpu_temp
      above: '60'
      condition: []
      action:
    • service: argon40.set_fan_speed
      data:
      speed: 50
      mode: single
  • id: Set-fan-speed-on-75
    alias: CPU fan high speed 75
    description: Turn up fan speed when CPU is over 65 degrees
    trigger:
    • platform: numeric_state
      entity_id: sensor.cpu_temp
      above: '65'
      condition: []
      action:
    • service: argon40.set_fan_speed
      data:
      speed: 75
      mode: single
  • id: Set-fan-speed-on-100
    alias: CPU fan high speed 100
    description: Turn up fan speed to max when CPU is over 60 degrees
    trigger:
    • platform: numeric_state
      entity_id: sensor.cpu_temp
      above: '70'
      condition: []
      action:
    • service: argon40.set_fan_speed
      data:
      speed: 100
      mode: single`

compatibility with homeassistant 2021.8.6

Hello,
after updating to version 2021.8.6 the component is no longer recognized, below the error;

Invalid config
The following integrations and platforms could not be set up:
argon40

Is it possible for you to update it to make it compatible?
Thanks in advance

Hey just wondering

Hey , I finally got the argo40 to perfectly work with homeassistant thanks to ( remove usb and edit the file) method. So do u have a card to adjust the speed, on/off of the fan , is there is a way to know the status of fan , on/off , speed in HomeKit
I know I might sound dum, but I learn from you and other creative people :)

Issue or Feature Agron One PI4 V2 FAN

Version of the custom_component

0.02
-->

Configuration

Add your logs here.

Describe the bug

The fan of the ARGON ONE PI 4 V2 Case does not seem to be affected by this tool. I am not sure though if its a problem on my side or it is not supported yet.

Debug log


Add your logs here.

Power Button Issue

Is your feature request related to a problem? Please describe.

If Electricity sudden cuts off, then it wont start automatically.

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

i have purchased argon 40 casing for raspberry pi 4B,
fully satisfied.

i have just one issue, if i am outside home and power or electricity goes, then i am unable to access my server untill and unless i come home and press power button manually.
is there any way that if i properly shutdown then manually press power button is ok, but if sudden electricity suppy disconnect then start resume last state, mean boot server without pressing any button.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Any way to disable power button.
Because i have chat with them, they clearly said its protection feature. In nexr version they will include this feature to start automatically.
Screenshot_20200714-085851_Messenger

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

HA restart with automation speed_fan = 0

Hello,

Thank you for your integration which is very useful.

HA 0.114.4
rpi4 4GB
HassOS 4.13
Supervisor 244
I have a problem when I run the following home assistant automation restart.

Automation is as follows.

  • id: '1600262958937'
    alias: RPi fan_speed OFF
    trigger:
    • below: '40'
      entity_id: sensor.rpi_cpu_temperature
      for: '1'
      platform: numeric_state
      condition: []
      action:
    • data:
      speed: 0
      service: argon40.set_fan_speed
      mode: single

When I run it my system reboots.

Do you have the same problem where it comes from me.

thank you in advance log


Add your logs here.

template on fanspeed ?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I have to write these verbose automations, where a small template could be very helpful
Describe the solution you'd like
A clear and concise description of what you want to happen.
like to template the fan speed, based on the state of the temp sensor

automation:
  - alias: "Set fan speed"
    trigger:
      platform: numeric_state
      entity_id: sensor.cpu_temp
#      above: 50.0
#      for:
#        minutes: 1
    action:
      - service: argon40.set_fan_speed
        data:
          speed: >
             {% set temp = states('sensor.cpu_temp')|float %}
             {% if temp <= 30 %} 0
             {% elif temp <= 40 %} 5
             {% elif temp <= 45 %} 10
             {% elif temp <= 50 %} 20
             {% elif temp <= 55 %} 30
             {% elif temp <= 60 %} 40
             {% elif temp <= 65 %} 50
             {% elif temp <= 70 %} 60
             {% elif temp <= 75 %} 70
             {% elif temp <= 80 %} 90
             {% else %} 100
             {% endif %}

could be written more mathematically, but just to set the idea

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

none really, this service is unique, so maybe only the other add-on which sets speeds automatically (and doesnt allow for manual precision)

Additional context
Add any other context or screenshots about the feature request here.

Enable the addon breaks HA API

After installation of argon40 custom component, my HA instance is not responding.

Version of HA

arch armv7l
chassis embedded
dev false
docker true
docker_version 19.03.8
hassio true
host_os HassOS 4.10
installation_type Home Assistant
os_name Linux
os_version 4.19.126-v7l
python_version 3.7.7
supervisor 227
timezone Europe/Paris
version 0.111.3
virtualenv false

Version of the custom_component

0.0.1

Configuration

#...
argon40:
#...

Describe the bug

I install the custom_component from HACS, as a custom repository.
I check that the custom_component is installed in custom_components directory (it is)
I add argon40: to my configuration.yaml file
I restart HA
HA won't start, the UI is still unavailable

Debug log

Log level set to:

logger:
  default: critical
  logs:
    homeassistant.core: error
    homeassistant.components.api: debug
    custom_components.argon40: debug

docker logs homeassistant
output:

[cont-init.d] executing container initialization scripts...
[cont-init.d] udev.sh: executing...
[14:08:15] INFO: Update udev information
[cont-init.d] udev.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
2020-06-22 14:08:23 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs 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.
2020-06-22 14:08:23 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for argon40 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.
2020-06-22 14:08:31 INFO (MainThread) [custom_components.argon40]
-------------------------------------------------------------------
Argon40
Version: 0.0.1
This is a custom integration!
If you have any issues with this you need to open an issue here:
https://github.com/Misiu/argon40/issues
-------------------------------------------------------------------

If you need more logs, or logs from another location, tell me.

Invalid config

The following integrations and platforms could not be set up:

argon40 (Show logs)
Please check your config and logs.

Logger: homeassistant.setup
Source: setup.py:162
First occurred: 12:20:39 (1 occurrences)
Last logged: 12:20:39

Setup failed for custom integration argon40: Requirements for argon40 not found: ['RPi.GPIO==0.7.1a4'].

Home Assistant 2022.7.6
Supervisor 2022.07.0
Operating System 8.2
Frontend 20220707.1 - latest

HomeAssistant Container

Version of the custom_component

latest version

Configuration

argon40:

Describe the bug

HomeAssistant installed as a container on docker on a RasperryPi 4 (4GB).
All argon40 files have been added in the custom components folder.
When I add the "argon40:" text in the configuration.yaml of HomeAssistant and I do the configuration check I receive an error (see below) and if I restart HA, the argon40 integration is not loaded.
The error states that the module should be used on a RaspberryPi while actually it is.

Do I perhaps need to forward some devices/port in the docker configuration?

Debug log

Logger: aiohttp.server
Source: custom_components/argon40/init.py:5
Integration: argon40 (documentation, issues)
First occurred: 00:19:49 (1 occurrences)
Last logged: 00:19:49

Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 74, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 135, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 131, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/core.py", line 29, in post
errors = await async_check_ha_config_file(request.app["hass"])
File "/usr/src/homeassistant/homeassistant/config.py", line 904, in async_check_ha_config_file
res = await check_config.async_check_ha_config_file(hass)
File "/usr/src/homeassistant/homeassistant/helpers/check_config.py", line 133, in async_check_ha_config_file
component = integration.get_component()
File "/usr/src/homeassistant/homeassistant/loader.py", line 485, in get_component
cache[self.domain] = importlib.import_module(self.pkg_path)
File "/usr/local/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 783, in exec_module
File "", line 219, in _call_with_frames_removed
File "/config/custom_components/argon40/init.py", line 5, in
from RPi import GPIO # pylint: disable=import-error
File "/usr/local/lib/python3.8/site-packages/RPi/GPIO/init.py", line 23, in
from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!

Invalid config

Version of the custom_component

VERSION = "0.0.1"

Configuration

argon40:

Describe the bug

Followed the instructions copied the argon40 folder to custom_components, added argon40: to configuration.yaml.

Reboot HA, received Invalid config notification when reboot completed.

Debug log


Log Details (ERROR)
Logger: homeassistant.setup
Source: custom_components/argon40/__init__.py:79
First occurred: 5:29:52 PM (1 occurrences)
Last logged: 5:29:52 PM

Error during setup of component argon40
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/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 38, in async_setup
    bus = SMBus(1)
  File "/usr/local/lib/python3.8/site-packages/smbus/smbus.py", line 56, in __init__
    self.open(bus)
  File "/usr/local/lib/python3.8/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 193, in _async_setup_component
    result = await asyncio.wait_for(task, SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.8/asyncio/tasks.py", line 483, in wait_for
    return fut.result()
  File "/config/custom_components/argon40/__init__.py", line 79, in async_setup
    address,
UnboundLocalError: local variable 'address' referenced before assignment
Home Assistant has started!


Cannot find Argon integration

Version of the custom_component

Configuration

Describe the bug

Hi,
I cannot find the Argon integration when try to search it.
I followed your steps here.
Do I need to do something else before that?
I started a fresh HA installation on RSP PI4 (64bit) and followed the instruction here.
I don't know what else I should bring you

Do I also need to follow these instructions: https://www.home-assistant.io/hassio/enable_i2c/ ?

No argon40 integration in core-2021.11.3

Hi,
core-2021.11.3
supervisor-2021.10.8

I have copied argon40 folder from master branch
So I have the 4 files
custom_components/argon40/init.py
custom_components/argon40/const.py
custom_components/argon40/manifest.json
custom_components/argon40/services.yaml

I restarted home assistant twice, clear navigator cache but I don't have any argon integration in configuration add integration.

It is a compatibility problem ?

i2c not enabled?

I get a error on argon4

i have a raspberry pi4band i cant get enabled i2c?

some help?

Logger: homeassistant.setup
Source: custom_components/argon40/init.py:64
First occurred: 21:01:21 (1 occurrences)
Last logged: 21:01:21

Error during setup of component argon40
Traceback (most recent call last):
File "/usr/local/lib/python3.8/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.8/site-packages/smbus/smbus.py", line 56, in init
self.open(bus)
File "/usr/local/lib/python3.8/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 213, in _async_setup_component
result = await task
File "/config/custom_components/argon40/init.py", line 64, in async_setup
address,
UnboundLocalError: local variable 'address' referenced before assignment

Error Loading Argon40 - HA startup

I use HA 2023.10.3 core installation on a PI4.

I did all the necessary steps - i2c is activated - checked in terminal and as well downloaded the i2c configurated which told me that i2c is activated. here results from terminal:

lsmod | grep i2c

i2c_dev 20480 2
i2c_mux_pinctrl 16384 0
i2c_mux 16384 1 i2c_mux_pinctrl
i2c_bcm2835 16384 1

Version of the custom_component - newest

Configuration

Add your logs here.

This error originated from a custom integration.

Logger: custom_components.argon40
Source: custom_components/argon40/__init__.py:73
Integration: argon40 (documentation, issues)
First occurred: 21:54:03 (1 occurrences)
Last logged: 21:54:03

Bad logger message: Error %d, %s accessing 0x%02X: Check your I2C address ((None, None, 26))
Traceback (most recent call last):
  File "/config/custom_components/argon40/__init__.py", line 73, in async_setup
    bus.write_byte(I2C_ADDRESS, 26)
  File "/usr/local/lib/python3.11/site-packages/smbus/util.py", line 59, in validator
    return fn(*args, **kwdefaults)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/smbus/smbus.py", line 121, in write_byte
    raise IOError(ffi.errno)
OSError: 121

I still cannot get I2C enabled.

I still cannot get I2C enabled. I followed the instructions above and created the file rpi-i2c.conf in the /etc/modules-load.d folder and edited config.txt, but it still says it cannot set up Argon40. When I went to edit the config.txt, I did not find a line that said #dtparam=i2c1=on. So, I added it without the #. I still get the following in the logs. Any ideas?

`Logger: homeassistant.setup
Source: custom_components/argon40/init.py:64
First occurred: 11:41:33 PM (1 occurrences)
Last logged: 11:41:33 PM

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 193, 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`

Originally posted by @digitalMedic in #1 (comment)

Integration failed to initialize.

Version of the custom_component

0.0.2

Configuration

argon40:

Describe the bug

Argon 40 does not appear in Integration list after. I have redownloaded it from Github, copied it over, added to my configuration.yaml, restarted but it still isn't in the integration list. Have restarted several times

Debug log


Argon40
Version: 0.0.2
This is a custom integration!
If you have any issues with this you need to open an issue here:
https://github.com/Misiu/argon40/issues
-------------------------------------------------------------------
2021-04-10 17:07:24 INFO (MainThread) [homeassistant.setup] Setup of domain argon40 took 0.0 seconds
2021-04-10 17:07:24 ERROR (MainThread) [homeassistant.setup] Setup failed for argon40: Integration failed to initialize.

Argon 40 Won't Load

Version of the custom_component

  • Argon40 Version: 0.0.2

Configuration

configuration.yaml
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

argon40:

sensor:
  - platform: command_line
    name: CPU Temp
    command: "cat /sys/class/thermal/thermal_zone0/temp"
    unit_of_measurement: "°C"
    value_template: "{{ value | multiply(0.001) | round(1) }}"
    
logger:
  default: info
  logs:
    homeassistant.components.yamaha: critical
    custom_components.my_integration: debug
    homeassistant.setup: debug

Description

Hello @Misiu, I hope you are doing well, and thank you for maintaining this extension.

I followed the instructions, and confirmed that i2c is functioning and reporting. I created the custom_components/argon40 directory and uploaded the files, and added argon40: to my configuration.yaml. However, when restarting the server the plugin errors out when loading and fails to initialize.

I would be happy to provide any other data, and I apologize if I missed something. I only dabble with development, and I don't do any hardware stuff.

Version Info

  • Machine model: Raspberry Pi 4 Model B Rev 1.4
  • HassOS Image: 5.13
  • Linux version: 5.4.83-v8
  • Supervisor: 2021.04.3
  • Core: 2021.5.4
  • Argon40 Version: 0.0.2

Debug log

2021-05-18 11:57:00 INFO (MainThread) [homeassistant.setup] Setting up argon40
2021-05-18 11:57:00 INFO (MainThread) [custom_components.argon40]
-------------------------------------------------------------------
Argon40
Version: 0.0.2
This is a custom integration!
If you have any issues with this you need to open an issue here:
https://github.com/Misiu/argon40/issues
-------------------------------------------------------------------
2021-05-18 11:57:00 INFO (MainThread) [homeassistant.setup] Setup of domain argon40 took 0.0 seconds
2021-05-18 11:57:00 ERROR (MainThread) [homeassistant.setup] Setup failed for argon40: Integration failed to initialize.
2021-05-18 11:57:00 ERROR (Thread-2) [root] Uncaught thread exception
Traceback (most recent call last):
File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.8/logging/handlers.py", line 1487, in _monitor
self.handle(record)
File "/usr/local/lib/python3.8/logging/handlers.py", line 1468, in handle
handler.handle(record)
File "/usr/local/lib/python3.8/logging/__init__.py", line 954, in handle
self.emit(record)
File "/usr/src/homeassistant/homeassistant/components/system_log/__init__.py", line 192, in emit
entry = LogEntry(record, stack, _figure_out_source(record, stack, self.hass))
File "/usr/src/homeassistant/homeassistant/components/system_log/__init__.py", line 99, in __init__
self.message = deque([record.getMessage()], maxlen=5)
File "/usr/local/lib/python3.8/logging/__init__.py", line 373, in getMessage
msg = msg % self.args

Argon40 services not loaded anymore since at least HA 2024.6

Hi,

It was working for years and now suddenly not recognized anymore - HA 2024.6 & 2024.7 got same behavior.
Argon40 services (set fan speed) are not loaded anymore, not available via developer tools either.
I suspect a change within HA that impact custom_components/argon40/init.py file.

Below logs:
2024-07-12 15:28:23.762 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration argon40 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
2024-07-12 15:28:27.155 WARNING (MainThread) [homeassistant.components.meteo_france] 1 hour rain forecast not available. Thusy - Rhône-Alpes (74) - FR is not in covered zone
2024-07-12 15:28:30.067 WARNING (ImportExecutor_0) [homeassistant.helpers.typing] HomeAssistantType was used from argon40, this is a deprecated alias which will be removed in HA Core 2025.5. Use homeassistant.core.HomeAssistant instead, please report it to the author of the 'argon40' custom integration
2024-07-12 15:28:30.075 ERROR (MainThread) [homeassistant.setup] Error during setup of component argon40
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 404, in _async_setup_component
result = await task
^^^^^^^^^^
File "/config/custom_components/argon40/init.py", line 71, in async_setup
GPIO.add_event_detect(shutdown_pin, GPIO.BOTH, callback=event_detect_callback)
RuntimeError: Failed to add edge detection
2024-07-12 15:28:40.758 ERROR (MainThread) [homeassistant.components.automation.argon_one_fan_speed_0_50degc_init] Argon One: Fan speed 0% (<50°C) - INIT: Error executing script. Service not found for call_service at pos 1: Service argon40.set_fan_speed not found
2024-07-12 15:28:46.005 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open with args ('/usr/local/lib/python3.12/site-packages/pysiaalarm/data/sia_codes.json', 'rb') in /usr/local/lib/python3.12/site-packages/pkg_resources/init.py, line 1758: return open(self._fn(self.module_path, resource_name), 'rb') inside the event loop; This is causing stability issues. Please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#open
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/usr/src/homeassistant/homeassistant/main.py", line 223, in
sys.exit(main())
File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main
exit_code = runner.run(runtime_conf)
File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run
return loop.run_until_complete(setup_and_run_hass(runtime_config))
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
self._run_once()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once
handle._run()
File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/lib/python3.12/site-packages/pysiaalarm/aio/server.py", line 54, in handle_line
event = self.parse_and_check_event(data)
File "/usr/local/lib/python3.12/site-packages/pysiaalarm/base_server.py", line 64, in parse_and_check_event
event = SIAEvent.from_line(line, self.accounts)
File "/usr/local/lib/python3.12/site-packages/pysiaalarm/event.py", line 161, in from_line
return SIAEvent(
File "", line 28, in init
File "/usr/local/lib/python3.12/site-packages/pysiaalarm/event.py", line 266, in post_init
self.set_sia_code()
File "/usr/local/lib/python3.12/site-packages/pysiaalarm/event.py", line 106, in set_sia_code
self.sia_code = _load_sia_codes().get(self.code) # pylint: disable=E1101
File "/usr/local/lib/python3.12/site-packages/pysiaalarm/data/data.py", line 44, in _load_sia_codes
data = _load_data(FILE_SIA_CODES)
File "/usr/local/lib/python3.12/site-packages/pysiaalarm/data/data.py", line 38, in _load_data
stream = pkg_resources.resource_stream(name, file)
File "/usr/local/lib/python3.12/site-packages/pkg_resources/init.py", line 1248, in resource_stream
return get_provider(package_or_requirement).get_resource_stream(
File "/usr/local/lib/python3.12/site-packages/pkg_resources/init.py", line 1758, in get_resource_stream
return open(self._fn(self.module_path, resource_name), 'rb')

2024-07-12 15:33:30.670 ERROR (MainThread) [homeassistant.components.automation.argon_one_fan_speed_10_50degc] Argon One: Fan speed 10% (>50°C): Error executing script. Service not found for call_service at pos 1: Service argon40.set_fan_speed not found
2024-07-12 15:37:00.677 ERROR (MainThread) [homeassistant.components.automation.argon_one_fan_speed_10_50degc] Argon One: Fan speed 10% (>50°C): Error executing script. Service not found for call_service at pos 1: Service argon40.set_fan_speed not found
2024-07-12 15:38:40.478 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.home_to_gva_p51 is taking over 10 seconds

No 'version' key in the manifest file - breaking change in upcoming Home Assistant release

Current release results in the following message being logged in the Home Assistant core logs (Configuration > Logs):

2021-04-07 21:28:57 WARNING (MainThread) [homeassistant.loader] No 'version' key in the manifest file for custom integration 'argon40'. This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'argon40'

I've checked manifest.json and there is already a version key present, however for some reason it is not being recognised.

More details can be found here: https://www.home-assistant.io/blog/2021/03/03/release-20213/#breaking-changes and here: https://developers.home-assistant.io/docs/creating_integration_manifest/

Unable to load since 2022.6

Version of the custom_component

Configuration

2022-06-06 08:44:45 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration argon40 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
2022-06-06 08:44:57 ERROR (MainThread) [homeassistant.setup] Setup failed for custom integration argon40: Unable to import component: cannot import name 'SMBus' from 'smbus' (/usr/local/lib/python3.9/site-packages/smbus/__init__.py)
2022-06-06 08:48:25 ERROR (MainThread) [homeassistant.components.automation.argon_one_fan_speed_0_50degc] Argon One: Fan speed 0% (<50°C): Error executing script. Service not found for call_service at pos 1: Unable to find service argon40.set_fan_speed
2022-06-06 08:48:25 ERROR (MainThread) [homeassistant.components.automation.argon_one_fan_speed_0_50degc] Error while executing automation automation.argon_one_fan_speed_0_50degc: Unable to find service argon40.set_fan_speed

Describe the bug

The integration cannot be load because this python module cannot be found :

Unable to import component: cannot import name 'SMBus' from 'smbus' (/usr/local/lib/python3.9/site-packages/smbus/__init__.py

Debug log


Add your logs here.

Just a query

This would be better suited under discussions but I don't see the option.

Is this only for HA installed on the argon?

My HA is installed on another server but would like to control the remote argons fan from HA, is this possible with this?

Also, is this compatible with the argon eon?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.