I know, I just used ml to test with to make it easier, then when calibrated to ml ill change it back to mm
Doesnt like something. Pretty sure the indentation is correct.
- platform: mlx90393
id: mlx
x_axis:
name: "mlx_x"
id: "x"
y_axis:
name: "mlx_y"
id: "y"
z_axis:
name: "mlx_z"
update_interval: 1s
filters:
- calibrate_linear:
- 0.0 -> 0.0
- 4095-> 360
- median:
window_size: 30
send_every: 30
send_first_at: 30
Failed config
sensor.mlx90393: [source /config/esphome/weather-station.yaml:130]
platform: mlx90393
id: mlx
x_axis:
name: mlx_x
id: x
y_axis:
name: mlx_y
id: y
z_axis:
name: mlx_z
update_interval: 1s
[filters] is an invalid option for [sensor.mlx90393]. Did you mean [filter]?
filters:
- calibrate_linear:
- 0.0 -> 0.0
- 4095-> 360
- median:
window_size: 30
send_every: 30
send_first_at: 30
Also, trying out this template. I have not put the values in yet, but U get the following error.
So what I understand from this is that this particular sensor does to print a STATE value?
Maybe use something else?
- platform: template
name: Cardinal Wind Direction
lambda: |-
if (id(mlx).state < 11.25 || id(mlx).state >= 348.75) {
return {"N"};
} else if (id(mlx).state >= 11.25 && id(mlx).state < 33.75) {
return {"NNE"};
} else if (id(mlx).state >= 33.75 && id(mlx).state < 56.25) {
return {"NE"};
} else if (id(mlx).state >= 56.25 && id(mlx).state < 78.75) {
return {"ENE"};
} else if (id(mlx).state >= 78.75 && id(mlx).state < 101.25) {
return {"E"};
} else if (id(mlx).state >= 101.25 && id(mlx).state < 123.75) {
return {"ESE"};
} else if (id(mlx).state >= 123.75 && id(mlx).state < 146.25) {
return {"SE"};
} else if (id(mlx).state >= 146.25 && id(mlx).state < 168.75) {
return {"SSE"};
} else if (id(mlx).state >= 168.75 && id(mlx).state < 191.25) {
return {"S"};
} else if (id(mlx).state >= 191.25 && id(mlx).state < 213.75) {
return {"SSW"};
} else if (id(mlx).state >= 213.75 && id(mlx).state < 236.25) {
return {"SW"};
} else if (id(mlx).state >= 236.25 && id(mlx).state < 258.75) {
return {"WSW"};
} else if (id(mlx).state >= 258.75 && id(mlx).state < 281.25) {
return {"W"};
} else if (id(mlx).state >= 281.25 && id(mlx).state < 303.75) {
return {"WNW"};
} else if (id(mlx).state >= 303.75 && id(mlx).state < 326.25) {
return {"NW"};
} else if (id(mlx).state >= 326.25 && id(mlx).state < 348.75) {
return {"NNW"};
} else return {"Something is not Right..."};
update_interval: 10s
Compiling /data/weather-station/.pioenvs/weather-station/src/main.cpp.o
/config/esphome/weather-station.yaml: In lambda function:
/config/esphome/weather-station.yaml:210:16: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
if (id(mlx).state < 11.25 || id(mlx).state >= 348.75) {
^~~~~
update
/config/esphome/weather-station.yaml:210:38: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
if (id(mlx).state < 11.25 || id(mlx).state >= 348.75) {
^~~~~
update
/config/esphome/weather-station.yaml:212:23: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 11.25 && id(mlx).state < 33.75) {
^~~~~
update
/config/esphome/weather-station.yaml:212:46: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 11.25 && id(mlx).state < 33.75) {
^~~~~
update
/config/esphome/weather-station.yaml:214:23: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 33.75 && id(mlx).state < 56.25) {
^~~~~
update
/config/esphome/weather-station.yaml:214:46: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 33.75 && id(mlx).state < 56.25) {
^~~~~
update
/config/esphome/weather-station.yaml:216:23: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 56.25 && id(mlx).state < 78.75) {
^~~~~
update
/config/esphome/weather-station.yaml:216:46: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 56.25 && id(mlx).state < 78.75) {
^~~~~
update
/config/esphome/weather-station.yaml:218:23: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 78.75 && id(mlx).state < 101.25) {
^~~~~
update
/config/esphome/weather-station.yaml:218:46: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 78.75 && id(mlx).state < 101.25) {
^~~~~
update
/config/esphome/weather-station.yaml:220:23: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 101.25 && id(mlx).state < 123.75) {
^~~~~
update
/config/esphome/weather-station.yaml:220:47: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 101.25 && id(mlx).state < 123.75) {
^~~~~
update
/config/esphome/weather-station.yaml:222:23: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 123.75 && id(mlx).state < 146.25) {
^~~~~
update
/config/esphome/weather-station.yaml:222:47: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 123.75 && id(mlx).state < 146.25) {
^~~~~
update
/config/esphome/weather-station.yaml:224:23: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 146.25 && id(mlx).state < 168.75) {
^~~~~
update
/config/esphome/weather-station.yaml:224:47: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 146.25 && id(mlx).state < 168.75) {
^~~~~
update
/config/esphome/weather-station.yaml:226:23: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 168.75 && id(mlx).state < 191.25) {
^~~~~
update
/config/esphome/weather-station.yaml:226:47: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 168.75 && id(mlx).state < 191.25) {
^~~~~
update
/config/esphome/weather-station.yaml:228:23: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 191.25 && id(mlx).state < 213.75) {
^~~~~
update
/config/esphome/weather-station.yaml:228:47: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 191.25 && id(mlx).state < 213.75) {
^~~~~
update
/config/esphome/weather-station.yaml:230:23: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 213.75 && id(mlx).state < 236.25) {
^~~~~
update
/config/esphome/weather-station.yaml:230:47: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 213.75 && id(mlx).state < 236.25) {
^~~~~
update
/config/esphome/weather-station.yaml:232:23: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 236.25 && id(mlx).state < 258.75) {
^~~~~
update
/config/esphome/weather-station.yaml:232:47: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 236.25 && id(mlx).state < 258.75) {
^~~~~
update
/config/esphome/weather-station.yaml:234:23: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 258.75 && id(mlx).state < 281.25) {
^~~~~
update
/config/esphome/weather-station.yaml:234:47: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 258.75 && id(mlx).state < 281.25) {
^~~~~
update
/config/esphome/weather-station.yaml:236:23: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 281.25 && id(mlx).state < 303.75) {
^~~~~
update
/config/esphome/weather-station.yaml:236:47: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 281.25 && id(mlx).state < 303.75) {
^~~~~
update
/config/esphome/weather-station.yaml:238:23: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 303.75 && id(mlx).state < 326.25) {
^~~~~
update
/config/esphome/weather-station.yaml:238:47: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 303.75 && id(mlx).state < 326.25) {
^~~~~
update
/config/esphome/weather-station.yaml:240:23: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 326.25 && id(mlx).state < 348.75) {
^~~~~
update
/config/esphome/weather-station.yaml:240:47: error: 'class esphome::mlx90393::MLX90393Cls' has no member named 'state'; did you mean 'update'?
} else if (id(mlx).state >= 326.25 && id(mlx).state < 348.75) {
^~~~~
update
/config/esphome/weather-station.yaml:243:3: warning: control reaches end of non-void function [-Wreturn-type]
update_interval: 10s
^
*** [/data/weather-station/.pioenvs/weather-station/src/main.cpp.o] Error 1
========================== [FAILED] Took 3.79 seconds ==========================
Ok sorry got this one,
Using the wrong sensor, was using the entire MLX instead of one of its actual sensors, X for example.
id(x).state
Ok, I tried this and that didnt work…
text_sensor:
# Cardinal Wind direction
- platform: template
name: Cardinal Wind Direction
lambda: |-
if (id(x).state < 318.10000 || id(x).state >= 2700.00000) {
return {"N"};
} else if (id(x).state >= 7200.10000 && id(x).state < 3320.00000) {
return {"NE"};
} else if (id(x).state >= 3320.10000 && id(x).state < 1600.00000) {
return {"E"};
} else if (id(x).state >= 1600.10000 && id(x).state < -815.00000) {
return {"SE"};
} else if (id(x).state >= -815.10000 && id(x).state < -2530.00000) {
return {"S"};
} else if (id(x).state >= 2530.1000 && id(x).state < -3330.00000) {
return {"SW"};
} else if (id(x).state >= 3330.10000 && id(x).state < -2140.00000) {
return {"W"};
} else if (id(x).state >= -2140.10000 && id(x).state < 318.00000) {
return {"NW"};
} else return {"Something is not Right..."};
update_interval: 10s
Just displays N and something is not Right…
N - start: 318.10000 finish 2700.00000
NE - start: 7200.10000 finish 3320.00000
E - start: 3320.10000 finish 1600.00000
SE - start: 1600.10000 finish -815.00000
S - start: -815.10000 finish -2530.00000
SW - start: 2530.1000 finish -3330.00000
W - start: 3330.10000 finish -2140.00000
NW - start -2140.10000 finish 318.00000
How about logging id(x).state and the return.
The log output of the state for X
[11:43:36][D][text_sensor:064]: 'Cardinal Wind Direction': Sending state 'N'
[11:43:36][D][mlx90393:070]: received 1109.359985 3087.979980 -12769.560547
[11:43:36][D][sensor:094]: 'mlx_x': Sending state 1109.35999 µT with 0 decimals of accuracy
[11:43:36][D][sensor:094]: 'mlx_y': Sending state 3087.97998 µT with 0 decimals of accuracy
[11:43:36][D][sensor:094]: 'mlx_z': Sending state -12769.56055 µT with 0 decimals of accuracy
And as you turn it, is it giving expected results?
Well, not sure what is expected,
But the value changes, yes.
Seems lie a real pain in the @ss for some sensor data that you can just import from a local weather api. Sure, you won’t get precise wind speed and rain measurement for your front yard but, it’s pretty accurate where I am. Plenty accurate to skip this headache. Just saying. Easier to buy a gallon of milk than it is to buy the cow and milk it.
From the esp log output.
I used my phone compass to point the vane to a known heading, eg N, then read the value printed by X axis.
Yea but I have this weather station, got it free, might aswell use it.
For a start, the Cardinal direction will only update every 10s, maybe increase to 1s for testing.
Next, the first if has an or operator ||, the rest have an and operator &&. I am having trouble getting my head around that.
yes I did change to 1s for instant updates
Looking again at
N - start: 318.10000 finish 2700.00000
NE - start: 7200.10000 finish 3320.00000
E - start: 3320.10000 finish 1600.00000
SE - start: 1600.10000 finish -815.00000
S - start: -815.10000 finish -2530.00000
SW - start: 2530.1000 finish -3330.00000
W - start: 3330.10000 finish -2140.00000
NW - start -2140.10000 finish 318.00000
Doesn’t make much sense. EG SW finishes at -3330, but W starts at 3330. Same with the S/SW transition. N/NE transition 2700 vs 7200.
Maybe some kind of decilination or offset?
There could even be a way to calibrate this think IDK.
Could we somehow offset it in code?
This is the magnetometer
So your observation definitely shows a jump from -3330 to +3330 when you go from SW to W?