Juerd / eq3-max

Yet another thing that talks to the "eQ-3 MAX! Cube Lan Gateway"
Other
34 stars 15 forks source link

Display current temperature in summary too #14

Closed mzealey closed 2 years ago

mzealey commented 2 years ago

If I use http://www.dmitry-kazakov.de/ada/max_home_automation.htm I see the following:

image

But with eq3-max I only see:

* Office(1)          0.0 → 22.0    60%
* Hallway(2)         0.0 → 17.5    18%
* Our Bathroom(3)    0.0 → 17.5    16%
* Our Bedroom(4)     0.0 → 20.5    81%

It looks like I have the actual temperature values coming in the L: Date field instead, per https://github.com/Bouni/max-cube-protocol/blob/master/L-Message.md:

The (LSB of byte at offset 9 * 256) plus byte at offset 10 sometimes contains the heater thermostat actual temperature:

Not sure how this would be detected, but it's what's happening on all my devices.

Juerd commented 2 years ago

Mark Zealey skribis 2022-01-03 10:36 (-0800):

The (LSB of byte at offset 9 * 256) plus byte at offset 10 sometimes contains the heater thermostat actual temperature:

"sometimes"

Unfortunately, that's not useful for a program that doesn't run all the time to catch those rare occasions. My eq3-max project doesn't run in the background, and relies on the hardware to give the answers every time.

mzealey commented 2 years ago

This diff makes it work for all my devices, I'm guessing it wouldn't hurt too much?

diff --git a/lib/Max.pm b/lib/Max.pm
index 0351e74..9b40f07 100644
--- a/lib/Max.pm
+++ b/lib/Max.pm
@@ -138,6 +138,8 @@ sub _process_L {
             $temp |= !!($setpoint & 0x80) << 8;
             $setpoint &= 0x7F;

+             $temp = $date if $temp == 0 and $date > 0 and $device->has_temperature;
+
             $device->_set(
                 mode        => $flags & 0x0003,
                 setpoint    => $setpoint / 2,
diff --git a/lib/Max/Device.pm b/lib/Max/Device.pm
index 9ccb817..3cc2e12 100644
--- a/lib/Max/Device.pm
+++ b/lib/Max/Device.pm
@@ -69,7 +69,7 @@ sub flags_as_string {

 sub is_cube         { $_[0]->{type} == 0 }
 sub has_valve       { $_[0]->{type} == 1 or $_[0]->{type} == 2 }
-sub has_temperature { $_[0]->{type} == 3 }
+sub has_temperature { $_[0]->{type} >= 1 and $_[0]->{type} <= 3 }
 sub has_setpoint    { $_[0]->{type} >= 1 and $_[0]->{type} <= 3 }

 sub room {
mzealey commented 2 years ago

Mark Zealey skribis 2022-01-03 10:36 (-0800):

The (LSB of byte at offset 9 256) plus byte at offset 10 sometimes contains the heater thermostat actual temperature: "sometimes" Unfortunately, that's not useful for a program that doesn't run all the time to catch those rare occasions. My eq3-max project doesn't run in the background, and relies on the hardware to give the answers every* time.

So I think the "sometimes" here is not temporal so much as "some devices do this". But certainly it does come and go for each device as well.

It looks to me like the cube picks up the temperature reported by the trvs and then caches it for a while, if it didn't get an update for whatever reason then it goes back to zero after some time period.

Juerd commented 2 years ago

Hm, that's interesting. I guess you're right, it wouldn't hurt. Would love a PR!

mzealey commented 2 years ago

https://github.com/Juerd/eq3-max/pull/15

Juerd commented 2 years ago

Fixed by #15