Currently I’m pulling modbus register values from my Midnite Solar Classic 150 charge controller and returning values for binary sensors. One sensor in particular reports a positive value correctly, but when the value goes negative it starts at 65535 = -0.1, and 65534 = -0.2 . A value of 65536 = 0.0 and that does report as 0.
How do I write a calculation for that? I’ve never even seen anything like that before (let alone heard of it).
Here is my current binary sensor that report positive values correctly, but not the negative values.
Ok, I see now, but it doesn’t work… the if statement returns false when it should be true (at the current moment)… I’m testing inside the template area…
It’s working now (for the negative reading) and has the correct sensor value… now to wait until tomorrow to verify the the positive (although it should work as I tested that earlier when it was at a positive state).
Thanks, @tom_l m and @123 for your help. Trying to automate My Solar system and turn on and off circuits via arduino and mqtt (based on sunlight, charge, and discharge values).
I agree I may not, I’ve been using the Template page to get values and that string returned the correct value of “true”. I do appreciate the lessons and I’m learning as I go.
I’m not a programmer or coder (I’m a certified sr. systems engineer).
It’s not really a project. I read values from the Midnite Solar charge controllers (2 of them), write the values to files inside the home assistant configuration directory, then read those values every second. It’s a very complicated system, but it works. I created py services (2 of them) to read and create the files, the rest is handled within home assistant. It’s not something that is a program to install.