9 Commits
v1.1.2 ... main

Author SHA1 Message Date
allcontributors[bot]
4069f24880 docs: add remiolivier as a contributor for code (#82)
Adds @remiolivier as a contributor for code.

This was requested by bourquep [in this
comment](https://github.com/bourquep/mysa2mqtt/pull/72#issuecomment-3476434699)

[skip ci]

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Co-authored-by: Pascal Bourque <pascal@cosmos.moi>
2025-11-01 10:55:59 -04:00
Pascal Bourque
a47cdbb45e fix: Don't crash on undefined values returned by the Mysa API (#81) 2025-11-01 10:49:27 -04:00
Pascal Bourque
2e075cd40d fix: Better resilience towards MQTT connection loss and errors (#80) 2025-11-01 09:05:05 -04:00
dependabot[bot]
f2d35a1ca5 chore(deps-dev): Bump the dev-dependencies group across 1 directory with 6 updates (#79) 2025-10-31 20:43:34 +00:00
dependabot[bot]
122ffde2f1 chore(deps): Bump pino from 10.0.0 to 10.1.0 (#76) 2025-10-31 20:38:17 +00:00
dependabot[bot]
c259557da0 chore(deps-dev): Bump typescript-eslint from 8.45.0 to 8.46.2 (#78) 2025-10-31 20:35:35 +00:00
dependabot[bot]
57bd430c98 chore(deps-dev): Bump @eslint/js from 9.37.0 to 9.38.0 (#75) 2025-10-31 20:35:08 +00:00
dependabot[bot]
8ca80acb49 chore(deps): Bump pino-pretty from 13.1.1 to 13.1.2 (#68) 2025-10-31 20:34:55 +00:00
Pascal Bourque
3b5dafeda9 fix: Fatal error when starting realtime updates. (#64)
Via https://github.com/bourquep/mysa-js-sdk/pull/144
2025-10-05 15:08:07 -04:00
5 changed files with 1740 additions and 1247 deletions

22
.all-contributorsrc Normal file
View File

@@ -0,0 +1,22 @@
{
"files": ["README.md"],
"imageSize": 100,
"commit": false,
"commitType": "docs",
"commitConvention": "angular",
"contributors": [
{
"login": "remiolivier",
"name": "remiolivier",
"avatar_url": "https://avatars.githubusercontent.com/u/1379047?v=4",
"profile": "https://github.com/remiolivier",
"contributions": ["code"]
}
],
"contributorsPerLine": 7,
"skipCi": true,
"repoType": "github",
"repoHost": "https://github.com",
"projectName": "mysa2mqtt",
"projectOwner": "bourquep"
}

View File

@@ -1,5 +1,11 @@
# mysa2mqtt
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
[![NPM Version](https://img.shields.io/npm/v/mysa2mqtt)](https://www.npmjs.com/package/mysa2mqtt)
[![Docker Hub](https://img.shields.io/docker/pulls/bourquep/mysa2mqtt)](https://hub.docker.com/r/bourquep/mysa2mqtt)
[![CodeQL](https://github.com/bourquep/mysa2mqtt/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/bourquep/mysa2mqtt/actions/workflows/github-code-scanning/codeql)
@@ -369,3 +375,26 @@ copyright notice and license text in any copy of the software or substantial por
- [mqtt2ha](https://github.com/bourquep/mqtt2ha) - MQTT to Home Assistant bridge library
- [Commander.js](https://github.com/tj/commander.js) - Command-line argument parsing
- [Pino](https://github.com/pinojs/pino) - Fast JSON logger
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/remiolivier"><img src="https://avatars.githubusercontent.com/u/1379047?v=4?s=100" width="100px;" alt="remiolivier"/><br /><sub><b>remiolivier</b></sub></a><br /><a href="https://github.com/bourquep/mysa2mqtt/commits?author=remiolivier" title="Code">💻</a></td>
</tr>
</tbody>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification.
Contributions of any kind welcome!

2884
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -49,26 +49,26 @@
"commander": "14.0.1",
"dotenv": "17.2.3",
"mqtt2ha": "4.1.2",
"mysa-js-sdk": "1.3.2",
"pino": "10.0.0",
"pino-pretty": "13.1.1"
"mysa-js-sdk": "2.0.0",
"pino": "10.1.0",
"pino-pretty": "13.1.2"
},
"devDependencies": {
"@commander-js/extra-typings": "14.0.0",
"@eslint/js": "9.37.0",
"@semantic-release/npm": "12.0.2",
"@types/node": "24.6.2",
"@eslint/js": "9.38.0",
"@semantic-release/npm": "13.1.1",
"@types/node": "24.9.2",
"conventional-changelog-conventionalcommits": "9.1.0",
"eslint": "9.37.0",
"eslint-plugin-jsdoc": "60.8.1",
"eslint": "9.39.0",
"eslint-plugin-jsdoc": "61.1.11",
"eslint-plugin-tsdoc": "0.4.0",
"prettier": "3.6.2",
"prettier-plugin-jsdoc": "1.3.3",
"prettier-plugin-jsdoc": "1.5.0",
"prettier-plugin-organize-imports": "4.3.0",
"semantic-release": "24.2.9",
"semantic-release": "25.0.1",
"tsup": "8.5.0",
"tsx": "4.20.6",
"typescript": "5.9.3",
"typescript-eslint": "8.45.0"
"typescript-eslint": "8.46.2"
}
}

View File

@@ -187,18 +187,22 @@ export class Thermostat {
try {
const deviceStates = await this.mysaApiClient.getDeviceStates();
const state = deviceStates.DeviceStatesObj[this.mysaDevice.Id];
const tstatMode = state.TstatMode?.v;
this.mqttClimate.currentTemperature = state.CorrectedTemp.v;
this.mqttClimate.currentHumidity = state.Humidity.v;
this.mqttClimate.currentMode = state.TstatMode.v === 1 ? 'off' : state.TstatMode.v === 3 ? 'heat' : undefined;
this.mqttClimate.currentAction = this.computeCurrentAction(undefined, state.Duty.v);
this.mqttClimate.targetTemperature = this.mqttClimate.currentMode !== 'off' ? state.SetPoint.v : undefined;
this.mqttClimate.currentTemperature = state.CorrectedTemp?.v;
this.mqttClimate.currentHumidity = state.Humidity?.v;
this.mqttClimate.currentMode = tstatMode === 1 ? 'off' : tstatMode === 3 ? 'heat' : undefined;
this.mqttClimate.currentAction = this.computeCurrentAction(undefined, state.Duty?.v);
this.mqttClimate.targetTemperature = this.mqttClimate.currentMode !== 'off' ? state.SetPoint?.v : undefined;
await this.mqttClimate.writeConfig();
await this.mqttTemperature.setState('state_topic', state.CorrectedTemp.v.toFixed(2));
await this.mqttTemperature.setState(
'state_topic',
state.CorrectedTemp != null ? state.CorrectedTemp.v.toFixed(2) : 'None'
);
await this.mqttTemperature.writeConfig();
await this.mqttHumidity.setState('state_topic', state.Humidity.v.toFixed(2));
await this.mqttHumidity.setState('state_topic', state.Humidity != null ? state.Humidity.v.toFixed(2) : 'None');
await this.mqttHumidity.writeConfig();
// `state.Current.v` always has a non-zero value, even for thermostats that are off, so we can't use it to determine initial power state.
@@ -242,7 +246,7 @@ export class Thermostat {
this.mqttClimate.currentHumidity = status.humidity;
this.mqttClimate.targetTemperature = this.mqttClimate.currentMode !== 'off' ? status.setPoint : undefined;
if (status.current != null) {
if (this.mysaDevice.Voltage != null && status.current != null) {
const watts = this.mysaDevice.Voltage * status.current;
await this.mqttPower.setState('state_topic', watts.toFixed(2));
} else {