With the risk of being told to read the documentation, I have, and am not an experienced coder, so…
Although this recommendation does work for some devices (I successfully fixed one device using this), it does not seem to work for: - platform: ultrasonic
This is my code for the ultrasonic sensors before adding any fixes:
I must admit that I re-used Pieter Brinkman’s water meter code, but looking at the HA Energy Dashboard it seems that the Pulse counter is not of importance, except for debugging/calibration purposes. Water meter total is the only measurement used for the dashboard.
Unfortunately I’m unable to test the code currently.
Awesome, thank you @MJV that worked perfectly. As I said, still learning and wasn’t aware the pin’s could be listed both ways (inline and indented below).
Typically I have the “raw” sensor which I mark as internal after set-up/debugging and then use copy sensors with filters for the processed results. I find it clean to debug and maintain like that.
I edited my last post, the idea is to use the ultrasonic sensor once only, give it an id and then refer to it by id for further calculations. I may have some indentations etc wrong, but the idea is there.
I am not overly familiar with the copy integration, but Mr Mahko is often right.
You either have a simple pin definition using only the pin number, or you have a pin section with several options under it. Your’s is an invalid combination.
Nope. Why would they do that when they can come here and have someone explicitly answer their question or write their code without having to make the slightest effort to help or educate themselves.
Hi Rob,
I am not an expert, but guess this is a question how you define your pin. I originally had the pin: A0 with same error likey you had when adding “allow_other_uses: True”. I then changed pin definition like below in alle places.
I have no idea why multiple pin uses is such a common issue. Theres only a few cases where that would be OK to do and thats only if the Copy integration or a Template wont work. Why someone would use the same ADC pin twice, i surely have no idea about that one.
You can do multiple actions for a single binary_sensor aka button by selecting multiple min/max times as well as single click, double click, multi-click if you want or need as well.
I highly suggest familiarizing yourself with the documentation. Browse through it and see whats available, what does what, like the difference between Switch, Button, and binary_sensor etc.
Here i use 1 button for 2 lights. 1 is basically a single button push(50ms -350ms) and the other is more of a “push and hold” that triggers the second light(action).