I just don't get what the intention is of
Code: Select all
return (220-round(x))+round(x);
Code: Select all
return (220-round(x))+round(x);
Code: Select all
return (220-round(x))+round(x);
That's what I figured. How about
Code: Select all
return 220;
Your mains sensor's output is actually intended to be used as a digital signal feeding into a high-impedance digital input. You could potentially simplify your code (and get more stable results) by using GPIO33 as a digital input/"binary sensor".The thing is that voltage seems to fluctuate, and I was basically just looking for a kind of ON/OFF signal and not an actual voltage reading
Code: Select all
return (int(round(x*2, 1)) / 2);
Code: Select all
pool-sensors.yaml: In lambda function:
pool-sensors.yaml:81:25: error: no matching function for call to 'round(float&, int)'
In file included from /home/icebrian/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/cmath:45,
from src/esphome/core/component.h:5,
from src/esphome/components/adc/adc_sensor.h:3,
from src/esphome.h:3,
from src/main.cpp:3:
/home/icebrian/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/math.h:308:15: note: candidate: 'double round(double)'
extern double round (double);
^~~~~
Simplyanyone know any other way in which I can accomplish this?
Code: Select all
round(2*x)/2
Thermocouples by their nature are sensitive to the material of the conductor they are connected to, i.e. using "random" copper wires can cause issues. Basically, the thermocouple works via the thermoelectric effect at the junction between two specific alloys, and by bringing another metal into the circuit you create a second "parasitic" thermocouple in the loop.To use the sensor in my pool I needed to use an unused electricity cable to cover the distance
Code: Select all
esphome:
name: pool-sensors
esp32:
board: nodemcu-32s
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
password: ""
ota:
password: "REMOVED"
wifi:
ssid: "REMOVED"
password: "REMOVED"
dallas:
- pin: GPIO17
sensor:
- platform: dallas
address: 0xcff57a1e1e64ff28
name: "Pool Dallas Temperature Sensor"
resolution: 10
- platform: adc
pin: GPIO33
name: "Pool Voltage Sensor"
update_interval: 60s
accuracy_decimals: 0
raw: true
filters:
- multiply: 0.095238
- lambda: !lambda |-
if (x < 6) {
return 0;
} else {
return 220;
}
output:
Code: Select all
[14:56:22][W][dallas.sensor:263]: 'Pool Dallas Temperature Sensor' - Scratch pad config register invalid!
[14:56:22][D][sensor:094]: 'Pool Dallas Temperature Sensor': Sending state nan °C with 1 decimals of accuracy
Users browsing this forum: Majestic-12 [Bot] and 61 guests