Hello all,
I have a voltage sensor that detects the state of a lamp ON or OFF. I want this to show up under my light menu in HA but with the switch command having the ability to toggle the actual lamp ON and OFF while keeping the lamp status in sync.
To further complicate my request I have my lamp wired for 2 way switching, 1 from my wall switch and 2 from my relays wired to rpi gpio.
I have really been confused with this and would appreciate any assistance I can get. Thanks in advance
You need to define a template switch. Then convert that switch to a light using the light-switch integration.
As long as you get the value template correct (voltage > ?) in the template switch its state will follow switching from either the relay or physical switch.
thanks Tom
So my voltage detector feeds the rpi gpio so I only get On Off no actual voltage readouts,which is still ok.
I have a template switch that is linked to the state of the voltage detector. I then convert this using the light switch command.
Now I can can see the on off as a lamp icon, but is there anyway I can use the toggle part to be linked to activate my relay side for the actual switch?
thanks
This should be correct but its not behaving as it should. Ideally if my sensor triggers then by my light config the bulb should be on or off depending on the state of the sensor. The switch config should not toggle the relay but only do so when I toggle it.
I hope I have the correct understanding because what I am trying to do is tell the state of the lamp regardless if my physical switch is pressed and there by be able to not disrupt mess it up when I toggle the relay.
thanks much tom you have shed a lot of light on situation
Your switch will react to changes made in home assistant or by the physical switch as you have a voltage monitor for feedback.
The problem may be that you have not correctly wired the relay and physical switch to both be able to control the light. The switch and relay can not be simply wired in series, or in parallel. It requires this configuration:
So I had a chance to check it and it does not work as it should at all. The Light config is able to see the correct state of the bulb when it is ON/OFF. But the slider does not do anything at all to the relay to control it from under the Light card. Similarly the Template command is also not able to change the state when I move the slider slider either. Form the above the only control I get is using the switch command for the relay only.
Made some more checks and I have no control on either the switch template or my light. The lamp icon on the light works flawless with the light activation and the switch corresponds with the light icon status. But if I try to move the switch to off if the light is on, it goes to the off position momentarily and then switches back on. What am I missing that will allow me to get control of the light and not have it stay locked to what ever state the voltage sensors is in?
So check through everything and realized because im using 2 way switching I needed to change my command from Switch to a Toggle and it all works fine.
Seems however that my sensors that are connected to my raspbian pi directly on GPIO pins are unable to be reliably detected by REMOTE pi command from my HA running on my next PI 3. If i encounter a power failure im stuck with my sensors not being detected and sometimes end up having to do multiple shutdown of both rasbian and HA pi and hope they play together. This is my new nightmare
Two questions come to mind as many have said their remote Gpio detection works flawless so is that because they are using the HA on docker on a virtual environment?
I have been looking at flyt method over mqtt and wanted to know if that may be a more reliable and viable method
retried flyte package and was able to download all the items including Cerberus but i got a new error
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with ‘-m pip’ instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pi-mqtt-gpio
AND then this
WARNING: The script pi_mqtt_gpio is installed in ‘/home/pi/.local/bin’ which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
I want to start building but I would like to know if you encountered any of these errors or how are you getting around the install without them being a problem?
So I am trying to create a file in my usr/bin/python folder and its being denied
The software part on the pi and navigating and creating files and folders are clearly my challenges.