Invert_logic: on pi gpio switch

Ive had a look round this forum but cant seem to find an answer. I have a relay which is on when the pi pin is set high and off when set low. So with everything set to default it works in complete reverse in HA i.e. in the Overview if its marked as on its off and conversely if its marked as off its on.

So Ive used the following entry in the config with invert_logic, which, I assumed would reverse the setting of the pin on the PI. But, what actually happens is, when HA is started up the relay is off and the overview shows it as off (which is good), when I then turn the (switch:) on nothing happens, then when I turn it off again the relay comes on and it then works as before. i.e. displayed on relay is off, displayed off relay is on.

any ideas anyone?

switch:

  • platform: remote_rpi_gpio
    host: 192.168.0.25
    ports:
    14: TVpi 14 Sub Woofer
    invert_logic: true

hello

i fixed it in brute force style,
i file:

homeassistant/components/remote_rpi_gpio/switch.py

i exchange rows:

remote_rpi_gpio.write_output(self._switch, 1 if self._invert_logic else 0)
remote_rpi_gpio.write_output(self._switch, 0 if self._invert_logic else 1)

fragment after changes:

def turn_on(self, **kwargs):
    """Turn the device on."""
    remote_rpi_gpio.write_output(self._switch, 1 if self._invert_logic else 0)
    self._state = True
    self.schedule_update_ha_state()

def turn_off(self, **kwargs):
    """Turn the device off."""
    remote_rpi_gpio.write_output(self._switch, 0 if self._invert_logic else 1)
    self._state = False
    self.schedule_update_ha_state()

ps. sorry for my terrible english

Hey Jarek, Ive got over it by using MQTT, works perfectly.