Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code error #316

Closed
Pols88 opened this issue Nov 6, 2024 · 9 comments
Closed

code error #316

Pols88 opened this issue Nov 6, 2024 · 9 comments

Comments

@Pols88
Copy link

Pols88 commented Nov 6, 2024

my configuration file has an error: Invalid config for 'switch' from integration 'rpi_gpio' at configuration.yaml, line 33: 'ports' is an invalid option for 'rpi_gpio.switch', check: ports

This is my code:

Raspberry Pi Cooling Fan

sensor:

  • platform: command_line
    name: CPU Temperature
    command: "cat /sys/class/thermal/thermal_zone0/temp"
    unit_of_measurement: "°C"
    value_template: '{{ value | multiply(0.001) | round(1) }}'
    scan_interval: 10
    switch:
  • platform: rpi_gpio
    ports:
    18: RPI Cooling Fan
    climate:
  • platform: generic_thermostat
    name: RPI Cooling Fan Controller
    heater: switch.rpi_cooling_fan
    target_sensor: sensor.cpu_temperature
    min_temp: 55
    max_temp: 80
    ac_mode: true
    target_temp: 55
    cold_tolerance: 0.1
    hot_tolerance: 0.1
    min_cycle_duration:
    seconds: 30
    keep_alive:
    minutes: 5
    initial_hvac_mode: "cool"

TY

@tomer-w
Copy link
Collaborator

tomer-w commented Nov 9, 2024

The obsolete way to configure the integration was removed.

Instead:

switch:
  platform: rpi_gpio
  ports:
     18: RPI Cooling Fan

The way to set it up correctly is:

switch:
  - platform: rpi_gpio
    switches:
      - port: 18
        name: "RPI Cooling Fan"

Please let me know if this did the trick.

@jramsgaard
Copy link

Think im seeing a bit of the same. Happend after update to HA 2024.11.1. Have tried to change "pin" to "port", but it then gives me an validation error.

Error:

Logger: homeassistant.components.cover
Source: helpers/entity_platform.py:365
integration: Cover (documentation, issues)
First occurred: 11:25:17 PM (1 occurrences)
Last logged: 11:25:17 PM

Error while setting up rpi_gpio platform for cover
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 365, in async_setup_platform
await asyncio.shield(awaitable)
File "/config/custom_components/rpi_gpio/cover.py", line 85, in async_setup_platform
cover.get(CONF_UNIQUE_ID) or f"{DOMAIN}
{cover.get(CONF_RELAY_PORT) or cover.get("relay_pin")}{cover[CONF_NAME].lower().replace(' ', '')}",
^^^^^^^^^^^^^^^
NameError: name 'CONF_RELAY_PORT' is not defined. Did you mean: 'CONF_RELAY_PIN'?`

Config:

cover:
  - platform: rpi_gpio
    state_pull_mode: 'UP'
    invert_state: true
    relay_time: 3
    covers:
      - relay_pin: 27
        state_pin: 11
        name: 'GarageDoor1'
      - relay_pin: 23
        state_pin: 12
        name: 'GarageDoor2'

@thecode
Copy link
Owner

thecode commented Nov 9, 2024

Think im seeing a bit of the same. Happend after update to HA 2024.11.1. Have tried to change "pin" to "port", but it then gives me an validation error.

Error:

Logger: homeassistant.components.cover Source: helpers/entity_platform.py:365 integration: Cover (documentation, issues) First occurred: 11:25:17 PM (1 occurrences) Last logged: 11:25:17 PM

Error while setting up rpi_gpio platform for cover Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 365, in async_setup_platform await asyncio.shield(awaitable) File "/config/custom_components/rpi_gpio/cover.py", line 85, in async_setup_platform cover.get(CONF_UNIQUE_ID) or f"{DOMAIN}{cover.get(CONF_RELAY_PORT) or cover.get("relay_pin")}{cover[CONF_NAME].lower().replace(' ', '')}", ^^^^^^^^^^^^^^^ NameError: name 'CONF_RELAY_PORT' is not defined. Did you mean: 'CONF_RELAY_PIN'?`

Config:

cover:
  - platform: rpi_gpio
    state_pull_mode: 'UP'
    invert_state: true
    relay_time: 3
    covers:
      - relay_pin: 27
        state_pin: 11
        name: 'GarageDoor1'
      - relay_pin: 23
        state_pin: 12
        name: 'GarageDoor2'

This is another bug, as a workaround you can add unique_id to the cover until this is fixed. @tomer-w

@tomer-w
Copy link
Collaborator

tomer-w commented Nov 10, 2024

The issue @jramsgaard is a real issue and not just obsolete configuration as @Pols88 was facing.
Fix for the issue is here: #317

@jramsgaard
Copy link

It worked with the unique_id for the covers. Thanks for the fast response and great work on this project 👍

@tomer-w
Copy link
Collaborator

tomer-w commented Nov 10, 2024

@tomer-w tomer-w closed this as completed Nov 10, 2024
@Pols88
Copy link
Author

Pols88 commented Nov 11, 2024

Updated but show the same error:

Invalid config for 'switch' from integration 'rpi_gpio' at configuration.yaml, line 33: 'ports' is an invalid option for 'rpi_gpio.switch', check: ports, please check the docs at https://github.com/thecode/ha-rpi_gpio

@tomer-w
Copy link
Collaborator

tomer-w commented Nov 11, 2024

You should not have ports in your configuration. Take a look on the config I sent you in my first reply.

@Pols88
Copy link
Author

Pols88 commented Nov 12, 2024

Thankyou so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants