Skip to content

Conversation

@dwmw2
Copy link
Contributor

@dwmw2 dwmw2 commented Nov 22, 2025

We have lovely combined devices for Temp/Hum/Baro, and even for Evohome zones we have a combined setpoint/temp with a lovely graph that shows them together. Let's have the setpoint support for non-Evohome too.

This adds a pTypeThermostat6 type, with subtypes for the different hum/baro combinations. Uses the existing graph support for those in the UI and just has to enable it for the appropriate types, as well as the setpoint control.

Hook it up to Alexa, allow users to make them as virtual sensors, make MQTT 'climate' devices register a single combined Domoticz device where they can instead of the separate setpoint/temp/etc, and we have nice shiny thermostat support...

Screenshot from 2025-11-22 01-34-44 Screenshot from 2025-11-22 01-36-35

@dwmw2
Copy link
Contributor Author

dwmw2 commented Nov 22, 2025

PXL_20251122_103959231

@JurgenLB
Copy link
Contributor

There is now a warning from '=': conversion from 'double' to 'float', possible loss of data in main\mainworker.cpp 8410 & 8412

Great work for the rest.
Kind regards

@dwmw2
Copy link
Contributor Author

dwmw2 commented Nov 22, 2025

Thanks, will fix. Also going to make MQTT keep feeding the old devices if they exist rather than always creating the combined one. Users might be using those; they can delete them and rediscover to convert if they want to.

@dwmw2 dwmw2 force-pushed the thermostat branch 4 times, most recently from d02baaf to f15f471 Compare November 26, 2025 14:57
There are some hardware types we call directly into their SetSetpoint()
method, and for the rest we call WriteToHardware().

But pTypeRadiator1 is handled differently, and uses a RADIATOR1 struct
instead of the _tSetpoint. Where we call WriteToHardware(), we do the
right thing and use the RADIATOR1 struct both for that, and for the
subsequent PushAndWaitRxMessage() call.

But on a hardware type where we call SetSetpoint() directly, we fall
through to the PushAndWaitRxMessage() at the very end of the function,
which sends the wrong type of message for a pTypeRadiator1.

Switch it around just to set a bWriteToHardware flag for hardware that
isn't specially handled, then we build either the _tSetpoint or the
RADIATOR1 struct, and use the appropriate struct for both.
…ter support

- Add pTypeThermostat6 (0x49) with four subtypes:
  - sTypeThermostat6Temp (0x00): Temperature and setpoint
  - sTypeThermostat6TempHum (0x01): Temperature, humidity, and setpoint
  - sTypeThermostat6TempBaro (0x02): Temperature, barometer, and setpoint
  - sTypeThermostat6TempHumBaro (0x03): Temperature, humidity, barometer, and setpoint
- Support for creating virtual Thermostat6 devices via Dummy hardware
- Display temperature, setpoint, humidity, humidity status, barometer, and dew point in UI
- Graph support for temperature, setpoint, humidity, and barometer logging
- Clickable device icons and Set button open setpoint popup (not Evohome dialog)

UpdateDevice support:
- Parse sValue fields based on subtype (temp;setpoint[;hum;hum_status][;baro])
- Apply temperature and barometer adjustments from database
- Support partial updates: empty fields preserve existing database values
- Only apply adjustments to newly provided values
- Calculate temperature trend when new temperature is provided
- Call SetSetPoint() when setpoint field is provided (all hardware types)

decode_Thermostat6 support:
- Preserve fields not included in update using subtype-specific expected_flags
- Query existing values from database for partial updates

WebServer support:
- Add trend field to JSON API output (0=Unknown, 1=Stable, 2=Rising, 3=Falling)
- UI displays up/down arrows for rising/falling temperature trends

SetSetPointInt support:
- Construct _tThermostat6 messages with setpoint-only updates
Add Alexa discovery, control, and state reporting for pTypeThermostat6
devices (all subtypes: Temp, TempHum, TempBaro, TempHumBaro).

Changes:
- Discovery: Expose as THERMOSTAT with ThermostatController and
  TemperatureSensor capabilities
- Discovery: Add RangeController for humidity on TempHum/TempHumBaro
- SetTargetTemperature: Use SetSetPoint on the combined device
- ReportState: Report current temperature, target setpoint, and humidity
  (for TempHum/TempHumBaro subtypes)

All four Thermostat6 subtypes are supported.
- Look for selector switch with " Mode" suffix during discovery
- Store modeIdx in cookie and hide mode selector from device list
- Add thermostatMode capability configuration (HEAT/OFF)
- Report thermostatMode in state reports and after SetTargetTemperature
- Handle SetThermostatMode directive for Thermostat6 devices
Instead of creating separate pTypeTEMP and pTypeSetpoint devices for MQTT
climate entities, create a single pTypeThermostat6 (sTypeThermostat6Temp
or sTypeThermostat6TempHum) device that combines current temperature,
setpoint, and optionally humidity in one device.

This reduces the number of devices created and provides a better user
experience with a single widget showing all values.

Backward compatibility: Existing installations with separate pTypeTEMP
and pTypeSetpoint devices will continue to use those devices. The code
detects old devices on first message (when devType == 0) and uses legacy
update paths if they exist. New installations get Thermostat6. Users can
delete old devices and rediscover to convert to the combined device.

Changes:
- handle_auto_discovery_climate: Create Thermostat6 device instead of
  separate temp/setpoint devices when both current_temperature_topic
  and temperature_command_topic are present, unless old devices exist
- Add humidity support via current_humidity_topic for Thermostat6TempHum
- SetSetpoint: Handle Thermostat6 devices for setpoint commands,
  preserving current temperature and humidity when updating setpoint
- sValue format: "temp;setpoint" or "temp;setpoint;humidity;hum_status"
- Legacy devices continue to work via standalone handlers at end of function

High/low setpoint devices still use pTypeSetpoint as before.
@gizmocuz gizmocuz merged commit 183879f into domoticz:development Nov 29, 2025
1 of 2 checks passed
@gizmocuz
Copy link
Contributor

Thanks once again for your time and PR!!

@waltervl
Copy link
Collaborator

waltervl commented Dec 3, 2025

@dwmw2 How to use this as a virtual device?
What is the API call to update the device (setpoint and/or temperature)?
What is the python framework way to create and update this device?
Why is the device only visible as temperature device in the temperature tab and not in the Utility tab as any other setpoint device?
Edit: How can you edit from gui the setpoint device settings (min,max,uom, step)?
Edit2: why does the widget ribbon change color? It normally indicates a non working device or low battery (red/yellow). If it is a temperature range indication, the icon itself changes accordingly.

@dwmw2
Copy link
Contributor Author

dwmw2 commented Dec 3, 2025

It's creatable like any other virtual devices through the UI.
Screenshot_20251203-191651

The setsetpoint JSON call works as you'd expect, as does udevice with semi-colon separated fields in the sValue like many devices. It's mostly modelled on the behaviour of the Evohome devices. Showing colour-coded for temperature, and the way you interact with it to set the setpoint, are deliberately set up to be the same as the combined Evohome setpoint+temp devices. Including the fact that they are temperature devices.

It's possible that we are missing the ability to edit those options; I'll look into that. Thanks for pointing it out.

@dwmw2
Copy link
Contributor Author

dwmw2 commented Dec 3, 2025

For python example see tuk90/RemehaHome-Domoticz#40

@waltervl
Copy link
Collaborator

waltervl commented Dec 3, 2025

Thanks for the references.
What would be the API sValue format for this device? Just the same as for a normal temp or temp/hum or temp/hum/baro device?

And I do not have Evohome, so what does these ribbon colors mean? They are not documented in the evohome wiki as far as I can see.

@waltervl
Copy link
Collaborator

waltervl commented Dec 3, 2025

And the setpoint edit function is probably not working because the device is not in the Utility tab. So either it should also be visible there or copy the Edit setpoint javascript function to the temperature view.

@dwmw2
Copy link
Contributor Author

dwmw2 commented Dec 3, 2025

The sValue is something like setpoint;temp;hum;hum_status;baro for fields that actually exist (for the subtype). In udevice you can leave some empty if you don't want to update those (so you don't have to update the setpoint when you're updating the actual measurements, etc.

@dwmw2
Copy link
Contributor Author

dwmw2 commented Dec 4, 2025

For the editing part, please test #6477

Setting the Unit is hosed, because it behaves precisely like the Setpoint, which are also hosed. I don't even know how this is supposed to work. If we set the unit does that mean the incoming numbers for that device are in that unit, and should then be converted to the user's preference for display? Or does it mean not change the actual temperature, but only change how it's displayed to the user? A wild stab in the dark at dwmw2@b4ef5bc but without knowing what it's supposed to do it's hard to fix that part.

#6477 at least makes it behave the same as the existing standalone setpoints though, for any sane person who lives in the 21st century and would never use a unit other than °C for any of this stuff :)

Happy to take a closer look if there's a clear explanation of what it should be doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants