mirror of
https://github.com/bourquep/mysa-js-sdk.git
synced 2026-02-04 09:41:07 +00:00
## Feat. Add Support for Mysa AC-V1-1 Devices
### Overview
This PR aims to extend **mysa2mqtt** to support **Mysa AC-V1-1**
thermostats in addition to the existing baseboard models.
AC-V1 devices use different operating modes and fan modes, which
required updates to both mode translation and MQTT behavior.
Tested with `BB-V1-1` and `AC-V1-1`.
*Note: I'm no typescript expert so code might not look the best but is
fully tested*
### Key Changes
- Supports `cool`, `dry`, `fan_only`, and `auto` in addition to `off`
and `heat`.
- New fan modes: `auto`, `low`, `medium`, `high`, and `max`.
### Does not support yet
- Vertical swing
- Horizontal swing
### Technical stuff
`AC-V1-1` payload:
`"body":{"success":1,"type":2,"trig_src":3,"state":{"md":3,"sp":23.5,"lk":0,"ho":1,"br":100,"da":2,"fn":5,"ss":4,"ssh":12,"it":0}}}}`
Fan mode values: 1 = 'auto', 3 = 'low', 5 = 'medium', 7 = 'high', 8 =
'max'
**I named the value 8 max as I needed a 4th value but is not tied to
anything in HA or Mysa**
### Testing
```
npm run example
[23:13:06.300] INFO (example/3281203): [example] 'Office Room' status changed: 21.9°C, 49%, 0W
[23:13:21.701] INFO (example/3281203): [example] 'Office Room' status changed: 21.9°C, 49%, 0W
[23:13:21.938] INFO (example/3281203): [example] 'Family Room' state changed. {"deviceId":"<redacted>","mode":"heat","setPoint":23,"fanSpeed":"auto"}
[23:13:33.282] INFO (example/3281203): [example] 'Family Room' state changed. {"deviceId":"<redacted>","mode":"heat","setPoint":23.5,"fanSpeed":"auto"}
[23:13:38.132] INFO (example/3281203): [example] 'Family Room' state changed. {"deviceId":"<redacted>","mode":"heat","setPoint":23.5,"fanSpeed":"high"}
[23:13:44.380] INFO (example/3281203): [example] 'Family Room' state changed. {"deviceId":"<redacted>","mode":"fan_only","setPoint":23.5,"fanSpeed":"high"}
[23:13:52.609] INFO (example/3281203): [example] 'Family Room' state changed. {"deviceId":"<redacted>","mode":"cool","setPoint":23.5,"fanSpeed":"high"}
[23:13:57.942] INFO (example/3281203): [example] 'Family Room' state changed. {"deviceId":"<redacted>","mode":"heat","setPoint":23.5,"fanSpeed":"high"}
[23:14:01.052] INFO (example/3281203): [example] 'Family Room' state changed. {"deviceId":"<redacted>","mode":"heat","setPoint":23.5,"fanSpeed":"auto"}
```
PR to `mysa2mqtt` coming right after
20 lines
829 B
TypeScript
20 lines
829 B
TypeScript
import { MysaDeviceMode, MysaFanSpeedMode } from '@/api/MysaDeviceMode';
|
|
|
|
/**
|
|
* Interface representing a device state change event for a Mysa device.
|
|
*
|
|
* This event is emitted when a device's operational parameters are modified, such as changing the operating mode or
|
|
* temperature setpoint. State changes can be initiated through user interaction, scheduling, or programmatic control
|
|
* through the API.
|
|
*/
|
|
export interface StateChange {
|
|
/** Unique identifier of the device whose state was changed */
|
|
deviceId: string;
|
|
/** The device's operating mode (e.g., 'heat', 'off'), if available */
|
|
mode?: MysaDeviceMode;
|
|
/** Current temperature setpoint after the state change */
|
|
setPoint: number;
|
|
/** Optional fan speed (1 = auto, 3 = low, 5 = medium, 7 = high, 8 = max). AC only */
|
|
fanSpeed?: MysaFanSpeedMode;
|
|
}
|