Skip to content

Conversation

@baronorder
Copy link
Contributor

Device is unusual in that it does not follow the normal design of either a thermostat or HVAC device and is much more similar to a fan with a bunch of extra settings.

Also does a very non standard base64 encoded string to show current sensor readings that needs a set of template sensors to expose sadly - would be amazing to have the ability to do "virtual" DP's and base64 decoding/encoding natively.

I left the comments in for the bits that really need explaining as the device is weird - most people using this in HA will purely be looking to easily control the fan and speed rather than using all of the capabilities of the device.

Device is unusual in that it does not follow the normal design of either a thermostat or HVAC device and is much more similar to a fan. 

Also does a very non standard base64 encoded string to show current sensor readings that needs a set of template sensors to expose. 

Would be amazing to have the ability to do "virtual" DP's and base64 decoding easily. 

I left the comments in for the bits that really need explaining as the device is weird - most people using this in HA will purely be looking to easily control the fan speed rather than using all of the capabilities of the device.
Fixed device class issue for target temp
fixed comment not starting with a space on line 12 and boolean quote issue
mapping:
- dps_val: true
value: off
value: "off"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect, a switch should have boolean values

value: "c"
- dps_val: "f"
value: "f"
- entity: number
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be better as a light entity, with translation_key: display instead of name and icon.

min: 0
max: 100
- entity: number
name: Temperature Calibration
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use translation_key: temperature_calibration instead of this name and icon

@make-all
Copy link
Owner

I don't know why you conclude that this does not follow the normal design of a thermostat, as the basic features of a switch, a temperature setting and temperature reading are all there.

@make-all make-all added the needs rework Rework required before merge label Dec 28, 2025
@baronorder
Copy link
Contributor Author

Looking to rework at the moment - getting the mask extract to work has been a bit of a nightmare but I am almost there.
Having some issues with the returned values being x10 what they actually are as "scale" seems to be ignored on values returned from the base64 / mask extract? Would love some guidance on a neat way to work around that issue?

@make-all
Copy link
Owner

Scale works on masked values. It does need to be inside a mapping

@baronorder
Copy link
Contributor Author

Working through it, having a hard time getting the temperature/humidity high and low points working as they are both packed values for both high and low. I just can't get the config to work right and would appreciate any guidance you have.

the values appear to function like this using the humidity one as an example:
DP 102: 32-bit Integer Structure (Big Endian)
Total Value Example: 39,322,000 (0x02580190)

  High Setpoint (60.0%)           Low Setpoint (40.0%)

┌───────────────────────────────┐┌───────────────────────────────┐
│ 16 Bits (MSB) ││ 16 Bits (LSB) │
├─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┤├─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┤
│1│1│1│1│1│1│1│1│1│1│1│1│1│1│1│1││1│1│1│1│1│1│1│1│1│1│1│1│1│1│1│1│
└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
Hex: 0x0258 Hex: 0x0190
Decimal: 600 Decimal: 400
(Scaled / 10 = 60.0) (Scaled / 10 = 40.0)

 Mask: FFFF0000                   Mask: 0000FFFF

Is there an example you have on how values like this can be dealt with?
I have the previous base64 decode to get the sensor values out working fine now but at the very least writing to these is causing problems, the closest I have gotten to functional (after changing types to deal with errors when trying to set) is:

 ```
 - entity: number
name: Humidity High Setpoint
category: config
icon: "mdi:water-percent"
dps:
  - id: 102
    name: value
    type: integer
    mask: "FFFF0000"
    endianness: big
    mapping:
      - scale: 10
        step: 0.1
    unit: "%"
  • entity: number
    name: Humidity Low Setpoint
    category: config
    icon: "mdi:water"
    dps:
    • id: 102
      name: value
      type: integer
      mask: "0000FFFF"
      endianness: big
      mapping:
      • scale: 10
        step: 0.1
        unit: "%"

@make-all
Copy link
Owner

make-all commented Dec 29, 2025

I don't have any example of the raw data received in dp 102, but generally masked values will come through as either hex or base64 from the device. In theory integer should be supported if it really is coming through as an integer, but is untested. Edit: after checking the code, the mask requires a byte array to operate on, which integer does not provide, so a code modification would be required to handle masking integer values.

@baronorder
Copy link
Contributor Author

Just to make sure I am not going insane - this is the returned feedback from the tuya API explorer for that humidity value:

 "code": "humd_set",
        "custom_name": "",
        "dp_id": 102,
        "time": 1766984494037,
        "type": "value",
        "value": 39322000

@make-all make-all removed the needs rework Rework required before merge label Jan 7, 2026
Updated entity names and added new entities for temperature and humidity alarms. Adjusted mapping values and improved overall structure.
@make-all make-all merged commit 88b2664 into make-all:main Jan 7, 2026
4 checks passed
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Tuya Local Jan 7, 2026
make-all added a commit that referenced this pull request Jan 7, 2026
@make-all
Copy link
Owner

make-all commented Jan 7, 2026

The dp 102 decoding can be added in a subsequent PR

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

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants