13 Commits

Author SHA1 Message Date
Adrian Jagielak
31d293974c v1.1.2 2025-09-25 00:33:36 +02:00
dependabot[bot]
e09f84058e Bump home-assistant/builder from 2025.03.0 to 2025.09.0 (#6) 2025-09-25 00:31:45 +02:00
dependabot[bot]
a76ebf360b Bump actions/checkout from 4.2.2 to 5.0.0 (#2) 2025-09-25 00:31:45 +02:00
dependabot[bot]
aa74ff9f10 Bump docker/login-action from 3.4.0 to 3.5.0 (#1) 2025-09-25 00:31:45 +02:00
Adrian Jagielak
0c64d5e2da v1.1.1 2025-09-24 23:55:26 +02:00
Adrian Jagielak
c611be58de Add error handling for invalid FIMP messages 2025-09-24 23:52:39 +02:00
Andreas
f25c437ed3 Update installation.md (#7)
Clarify that users must select the MQTT Integration instead of the hub’s MQTT server, with step-by-step guidance provided.
2025-09-24 23:51:17 +02:00
Adrian Jagielak
e9caeb3656 v1.1.0 2025-09-24 21:33:31 +02:00
Adrian Jagielak
4948d2abbe Stop inclusion/exclusion after the first report 2025-09-24 21:23:16 +02:00
Adrian Jagielak
57124f6b4c Allow empty Thingsplex credentials (#3) 2025-09-24 21:22:28 +02:00
Jagi ᯅ
d57edc66b2 Improve GUI security by hiding passwords by default (#5) 2025-09-24 14:14:34 +02:00
Andreas
2681761a69 Merge pull request #1 from Andbli/gui-security-patch
Improve GUI security by hiding password by default.
2025-09-21 17:37:21 +02:00
Andreas
785864ae03 Improve GUI security by hiding password by default.
Replaced 'str?' with 'password?' for fh_password and tp_password
2025-09-21 17:36:21 +02:00
10 changed files with 37 additions and 368 deletions

View File

@@ -42,7 +42,7 @@ Some services are more common than others; some are deprecated entirely.
| Media player | [media_player](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/media_player.ts) | | ✅ | [Select](https://www.home-assistant.io/integrations/select/), [Number](https://www.home-assistant.io/integrations/number/), [Switch](https://www.home-assistant.io/integrations/switch/), [Image](https://www.home-assistant.io/integrations/image/), [Sensor](https://www.home-assistant.io/integrations/sensor/) | | Media player | [media_player](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/media_player.ts) | | ✅ | [Select](https://www.home-assistant.io/integrations/select/), [Number](https://www.home-assistant.io/integrations/number/), [Switch](https://www.home-assistant.io/integrations/switch/), [Image](https://www.home-assistant.io/integrations/image/), [Sensor](https://www.home-assistant.io/integrations/sensor/) |
| Meter | [meter_elec](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts), [meter_gas](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts), [meter_water](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts), [meter_heating](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts), [meter_cooling](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts) | [HAN-Sensor](https://www.futurehome.io/en/shop/han-sensor) | ✅ | [Sensor](https://www.home-assistant.io/integrations/sensor/), [Button](https://www.home-assistant.io/integrations/button/) | | Meter | [meter_elec](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts), [meter_gas](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts), [meter_water](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts), [meter_heating](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts), [meter_cooling](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts) | [HAN-Sensor](https://www.futurehome.io/en/shop/han-sensor) | ✅ | [Sensor](https://www.home-assistant.io/integrations/sensor/), [Button](https://www.home-assistant.io/integrations/button/) |
| Binary switch | [out_bin_switch](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/out_bin_switch.ts) | [16A Puck Relé](https://www.futurehome.io/en_no/shop/puck-relay-16a) | ✅ | [Switch](https://www.home-assistant.io/integrations/switch/) | | Binary switch | [out_bin_switch](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/out_bin_switch.ts) | [16A Puck Relé](https://www.futurehome.io/en_no/shop/puck-relay-16a) | ✅ | [Switch](https://www.home-assistant.io/integrations/switch/) |
| Level switch | [out_lvl_switch](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/out_lvl_switch.ts) | [Smart LED Dimmer](https://www.futurehome.io/en_no/shop/smart-led-dimmer-polar-white) | ✅ | [Light](https://www.home-assistant.io/integrations/light/), [Number](https://www.home-assistant.io/integrations/number/) | | Level switch | [out_lvl_switch](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/out_lvl_switch.ts) | [Smart LED Dimmer](https://www.futurehome.io/en_no/shop/smart-led-dimmer-polar-white) | ✅ | [Number](https://www.home-assistant.io/integrations/number/) |
| Button | [scene_ctrl](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/scene_ctrl.ts) | [Modusbryter](https://www.futurehome.io/en_no/shop/modeswitch-white) | ✅ | [Sensor](https://www.home-assistant.io/integrations/sensor/), [Select](https://www.home-assistant.io/integrations/select/) | | Button | [scene_ctrl](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/scene_ctrl.ts) | [Modusbryter](https://www.futurehome.io/en_no/shop/modeswitch-white) | ✅ | [Sensor](https://www.home-assistant.io/integrations/sensor/), [Select](https://www.home-assistant.io/integrations/select/) |
| Schedule entry | [schedule_entry](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/schedule_entry.ts) | | ✅ | [Number](https://www.home-assistant.io/integrations/number/), [Button](https://www.home-assistant.io/integrations/button/), [Binary sensor](https://www.home-assistant.io/integrations/binary_sensor/), [Sensor](https://www.home-assistant.io/integrations/sensor/) | | Schedule entry | [schedule_entry](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/schedule_entry.ts) | | ✅ | [Number](https://www.home-assistant.io/integrations/number/), [Button](https://www.home-assistant.io/integrations/button/), [Binary sensor](https://www.home-assistant.io/integrations/binary_sensor/), [Sensor](https://www.home-assistant.io/integrations/sensor/) |
| Binary sensor | [sensor_contact](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_sensor_binary.ts), [sensor_presence](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_sensor_binary.ts) | | ✅ | [Binary sensor](https://www.home-assistant.io/integrations/binary_sensor/) | | Binary sensor | [sensor_contact](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_sensor_binary.ts), [sensor_presence](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_sensor_binary.ts) | | ✅ | [Binary sensor](https://www.home-assistant.io/integrations/binary_sensor/) |

View File

@@ -1,38 +1,5 @@
<!-- https://developers.home-assistant.io/docs/add-ons/presentation#keeping-a-changelog --> <!-- https://developers.home-assistant.io/docs/add-ons/presentation#keeping-a-changelog -->
## 1.6.1 (16.10.2025)
- Tweaked 'Ignore Availability Reports' setting.
## 1.6.0 (16.10.2025)
- Added setting to always treat all devices as up.
## 1.5.0 (16.10.2025)
- Reverted: Add ability to specify a custom MQTT broker.
## 1.4.0 (13.10.2025)
- Added ability to specify a custom MQTT broker.
## 1.3.1 (28.09.2025)
- Revert upgrading dependencies.
## 1.3.0 (28.09.2025)
- Upgrade dependencies.
- Use proper `light` entity for out_lvl_switch if the device type is "light", instead of generic `number` level switch (thanks @Andbli for help!).
## 1.2.1 (26.09.2025)
- Revert 'Use `light` entity for out_lvl_switch if the device type is "light"'.
## 1.2.0 (26.09.2025)
- Use `light` entity for out_lvl_switch if the device type is "light".
## 1.1.2 (24.09.2025) ## 1.1.2 (24.09.2025)
- Bumped dependencies (#1, #2, #6). - Bumped dependencies (#1, #2, #6).

View File

@@ -41,7 +41,7 @@ Some services are more common than others; some are deprecated entirely.
| Media player | [media_player](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/media_player.ts) | | ✅ | [Select](https://www.home-assistant.io/integrations/select/), [Number](https://www.home-assistant.io/integrations/number/), [Switch](https://www.home-assistant.io/integrations/switch/), [Image](https://www.home-assistant.io/integrations/image/), [Sensor](https://www.home-assistant.io/integrations/sensor/) | | Media player | [media_player](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/media_player.ts) | | ✅ | [Select](https://www.home-assistant.io/integrations/select/), [Number](https://www.home-assistant.io/integrations/number/), [Switch](https://www.home-assistant.io/integrations/switch/), [Image](https://www.home-assistant.io/integrations/image/), [Sensor](https://www.home-assistant.io/integrations/sensor/) |
| Meter | [meter_elec](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts), [meter_gas](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts), [meter_water](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts), [meter_heating](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts), [meter_cooling](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts) | [HAN-Sensor](https://www.futurehome.io/en/shop/han-sensor) | ✅ | [Sensor](https://www.home-assistant.io/integrations/sensor/), [Button](https://www.home-assistant.io/integrations/button/) | | Meter | [meter_elec](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts), [meter_gas](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts), [meter_water](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts), [meter_heating](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts), [meter_cooling](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_meter.ts) | [HAN-Sensor](https://www.futurehome.io/en/shop/han-sensor) | ✅ | [Sensor](https://www.home-assistant.io/integrations/sensor/), [Button](https://www.home-assistant.io/integrations/button/) |
| Binary switch | [out_bin_switch](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/out_bin_switch.ts) | [16A Puck Relé](https://www.futurehome.io/en_no/shop/puck-relay-16a) | ✅ | [Switch](https://www.home-assistant.io/integrations/switch/) | | Binary switch | [out_bin_switch](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/out_bin_switch.ts) | [16A Puck Relé](https://www.futurehome.io/en_no/shop/puck-relay-16a) | ✅ | [Switch](https://www.home-assistant.io/integrations/switch/) |
| Level switch | [out_lvl_switch](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/out_lvl_switch.ts) | [Smart LED Dimmer](https://www.futurehome.io/en_no/shop/smart-led-dimmer-polar-white) | ✅ | [Light](https://www.home-assistant.io/integrations/light/), [Number](https://www.home-assistant.io/integrations/number/) | | Level switch | [out_lvl_switch](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/out_lvl_switch.ts) | [Smart LED Dimmer](https://www.futurehome.io/en_no/shop/smart-led-dimmer-polar-white) | ✅ | [Number](https://www.home-assistant.io/integrations/number/) |
| Button | [scene_ctrl](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/scene_ctrl.ts) | [Modusbryter](https://www.futurehome.io/en_no/shop/modeswitch-white) | ✅ | [Sensor](https://www.home-assistant.io/integrations/sensor/), [Select](https://www.home-assistant.io/integrations/select/) | | Button | [scene_ctrl](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/scene_ctrl.ts) | [Modusbryter](https://www.futurehome.io/en_no/shop/modeswitch-white) | ✅ | [Sensor](https://www.home-assistant.io/integrations/sensor/), [Select](https://www.home-assistant.io/integrations/select/) |
| Schedule entry | [schedule_entry](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/schedule_entry.ts) | | ✅ | [Number](https://www.home-assistant.io/integrations/number/), [Button](https://www.home-assistant.io/integrations/button/), [Binary sensor](https://www.home-assistant.io/integrations/binary_sensor/), [Sensor](https://www.home-assistant.io/integrations/sensor/) | | Schedule entry | [schedule_entry](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/schedule_entry.ts) | | ✅ | [Number](https://www.home-assistant.io/integrations/number/), [Button](https://www.home-assistant.io/integrations/button/), [Binary sensor](https://www.home-assistant.io/integrations/binary_sensor/), [Sensor](https://www.home-assistant.io/integrations/sensor/) |
| Binary sensor | [sensor_contact](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_sensor_binary.ts), [sensor_presence](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_sensor_binary.ts) | | ✅ | [Binary sensor](https://www.home-assistant.io/integrations/binary_sensor/) | | Binary sensor | [sensor_contact](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_sensor_binary.ts), [sensor_presence](https://github.com/adrianjagielak/home-assistant-futurehome/blob/master/futurehome/src/services/_sensor_binary.ts) | | ✅ | [Binary sensor](https://www.home-assistant.io/integrations/binary_sensor/) |

View File

@@ -1,6 +1,6 @@
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config # https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config
name: Futurehome name: Futurehome
version: '1.6.1' version: '1.1.2'
slug: futurehome slug: futurehome
description: Local Futurehome Smarthub integration description: Local Futurehome Smarthub integration
url: 'https://github.com/adrianjagielak/home-assistant-futurehome' url: 'https://github.com/adrianjagielak/home-assistant-futurehome'
@@ -22,7 +22,6 @@ options:
tp_username: '' tp_username: ''
tp_password: '' tp_password: ''
tp_allow_empty: false tp_allow_empty: false
ignore_availability_reports: false
demo_mode: false demo_mode: false
show_debug_log: false show_debug_log: false
@@ -33,7 +32,6 @@ schema:
tp_username: 'str?' tp_username: 'str?'
tp_password: 'password?' tp_password: 'password?'
tp_allow_empty: 'bool?' tp_allow_empty: 'bool?'
ignore_availability_reports: 'bool?'
demo_mode: 'bool?' demo_mode: 'bool?'
show_debug_log: 'bool?' show_debug_log: 'bool?'

View File

@@ -11,7 +11,6 @@ export FH_PASSWORD=$(bashio::config 'fh_password')
export TP_USERNAME=$(bashio::config 'tp_username') export TP_USERNAME=$(bashio::config 'tp_username')
export TP_PASSWORD=$(bashio::config 'tp_password') export TP_PASSWORD=$(bashio::config 'tp_password')
export TP_ALLOW_EMPTY=$(bashio::config 'tp_allow_empty') export TP_ALLOW_EMPTY=$(bashio::config 'tp_allow_empty')
export IGNORE_AVAILABILITY_REPORTS=$(bashio::config 'ignore_availability_reports')
export DEMO_MODE=$(bashio::config 'demo_mode') export DEMO_MODE=$(bashio::config 'demo_mode')
export SHOW_DEBUG_LOG=$(bashio::config 'show_debug_log') export SHOW_DEBUG_LOG=$(bashio::config 'show_debug_log')

View File

@@ -22,14 +22,7 @@ import { pollVinculum } from './fimp/vinculum';
const localApiPassword = process.env.FH_PASSWORD || ''; const localApiPassword = process.env.FH_PASSWORD || '';
const thingsplexUsername = process.env.TP_USERNAME || ''; const thingsplexUsername = process.env.TP_USERNAME || '';
const thingsplexPassword = process.env.TP_PASSWORD || ''; const thingsplexPassword = process.env.TP_PASSWORD || '';
const thingsplexAllowEmpty = (process.env.TP_ALLOW_EMPTY || '') const thingsplexAllowEmpty = (process.env.TP_ALLOW_EMPTY || '').toLowerCase().includes('true');
.toLowerCase()
.includes('true');
const ignoreAvailabilityReports = (
process.env.IGNORE_AVAILABILITY_REPORTS || ''
)
.toLowerCase()
.includes('true');
const demoMode = (process.env.DEMO_MODE || '').toLowerCase().includes('true'); const demoMode = (process.env.DEMO_MODE || '').toLowerCase().includes('true');
const showDebugLog = (process.env.SHOW_DEBUG_LOG || '') const showDebugLog = (process.env.SHOW_DEBUG_LOG || '')
.toLowerCase() .toLowerCase()
@@ -87,7 +80,9 @@ import { pollVinculum } from './fimp/vinculum';
const hubId = house.val.param.house.hubId; const hubId = house.val.param.house.hubId;
const devices = await pollVinculum('device'); const devices = await pollVinculum('device');
log.debug(`FIMP devices:\n${JSON.stringify(devices, null, 0)}`); log.debug(
`FIMP devices:\n${JSON.stringify(devices, null, 0)}`,
);
const haConfig = retainedMessages.filter((msg) => const haConfig = retainedMessages.filter((msg) =>
msg.topic.endsWith('/config'), msg.topic.endsWith('/config'),
@@ -196,11 +191,7 @@ import { pollVinculum } from './fimp/vinculum';
log.error('Failed publishing device', device, e); log.error('Failed publishing device', device, e);
} }
} }
if ( if (demoMode || thingsplexAllowEmpty || (thingsplexUsername && thingsplexPassword)) {
demoMode ||
thingsplexAllowEmpty ||
(thingsplexUsername && thingsplexPassword)
) {
Object.assign( Object.assign(
commandHandlers, commandHandlers,
exposeSmarthubTools({ exposeSmarthubTools({
@@ -274,9 +265,6 @@ import { pollVinculum } from './fimp/vinculum';
return; return;
} }
for (const deviceAvailability of devicesAvailability) { for (const deviceAvailability of devicesAvailability) {
if (ignoreAvailabilityReports) {
deviceAvailability.status = 'UP';
}
haUpdateAvailability({ hubId, deviceAvailability }); haUpdateAvailability({ hubId, deviceAvailability });
await delay(50); await delay(50);
} }

View File

@@ -2518,128 +2518,5 @@
"props": { "sup_units": ["km/h"] } "props": { "sup_units": ["km/h"] }
} }
} }
},
{
"client": { "name": "Spisestue" },
"fimp": { "adapter": "zwave-ad", "address": "6", "group": "ch_0" },
"functionality": "lighting",
"id": 1011,
"lrn": true,
"model": "zw_411_4_8705",
"param": {
"dimValue": 3,
"energy": 49.6100006103516,
"power": "off",
"timestamp": "2025-09-26 18:32:21 +0200",
"wattage": 0,
"zwaveConfigParameters": []
},
"problem": false,
"room": 1,
"services": {
"dev_sys": {
"addr": "/rt:dev/rn:zw/ad:1/sv:dev_sys/ad:1011_0",
"enabled": true,
"intf": [
"cmd.config.get_report",
"cmd.config.set",
"cmd.group.add_members",
"cmd.group.delete_members",
"cmd.group.get_members",
"cmd.ping.send",
"evt.config.report",
"evt.group.members_report",
"evt.ping.report"
],
"props": { "is_secure": false, "is_unsecure": true }
},
"indicator_ctrl": {
"addr": "/rt:dev/rn:zw/ad:1/sv:indicator_ctrl/ad:1011_0",
"enabled": true,
"intf": [
"cmd.indicator.identify",
"cmd.indicator.set_visual_element"
],
"props": { "is_secure": false, "is_unsecure": true }
},
"meter_elec": {
"addr": "/rt:dev/rn:zw/ad:1/sv:meter_elec/ad:1011_0",
"enabled": true,
"intf": [
"cmd.meter.get_report",
"cmd.meter.reset",
"evt.meter.report"
],
"props": {
"is_secure": false,
"is_unsecure": true,
"sup_export_units": [],
"sup_units": ["kWh", "W"]
}
},
"out_lvl_switch": {
"addr": "/rt:dev/rn:zw/ad:1/sv:out_lvl_switch/ad:1011_0",
"enabled": true,
"intf": [
"cmd.binary.set",
"cmd.lvl.get_report",
"cmd.lvl.set",
"cmd.lvl.start",
"cmd.lvl.stop",
"evt.binary.report",
"evt.lvl.report"
],
"props": {
"is_secure": false,
"is_unsecure": true,
"max_lvl": 100,
"min_lvl": 0
}
},
"scene_ctrl": {
"addr": "/rt:dev/rn:zw/ad:1/sv:scene_ctrl/ad:1011_0",
"enabled": true,
"intf": ["evt.scene.report"],
"props": {
"is_secure": false,
"is_unsecure": true,
"sup_scenes": [
"1.key_pressed_1_time",
"1.key_released",
"1.key_held_down",
"1.key_pressed_2_times",
"1.key_pressed_3_times",
"1.key_pressed_4_times",
"1.key_pressed_5_times",
"2.key_pressed_1_time",
"2.key_released",
"2.key_held_down",
"2.key_pressed_2_times",
"2.key_pressed_3_times",
"2.key_pressed_4_times",
"2.key_pressed_5_times"
]
}
},
"version": {
"addr": "/rt:dev/rn:zw/ad:1/sv:version/ad:1011_0",
"enabled": true,
"intf": ["cmd.version.get_report", "evt.version.report"],
"props": { "is_secure": false, "is_unsecure": true }
}
},
"supports": ["clear", "poll"],
"thing": 1,
"type": {
"subtype": null,
"supported": {
"appliance": [],
"blinds": [],
"fan": [],
"heater": [],
"light": []
},
"type": "light"
}
} }
] ]

View File

@@ -2380,79 +2380,5 @@
"name": "sensor_wind" "name": "sensor_wind"
} }
] ]
},
{
"id": 1011,
"services": [
{
"addr": "/rt:dev/rn:zw/ad:1/sv:out_lvl_switch/ad:1011_0",
"attributes": [
{
"name": "lvl",
"values": [
{
"ts": "2025-09-26 12:39:19 +0200",
"val": 22,
"val_t": "int"
}
]
},
{
"name": "binary",
"values": [
{
"ts": "2025-09-26 12:39:19 +0200",
"val": true,
"val_t": "bool"
}
]
}
],
"name": "out_lvl_switch"
},
{
"addr": "/rt:dev/rn:zw/ad:1/sv:dev_sys/ad:1011_0",
"attributes": [
{
"name": "state",
"values": [
{
"ts": "2025-09-08 21:06:32 +0200",
"val": "UP",
"val_t": "string"
}
]
}
],
"name": "dev_sys"
},
{
"addr": "/rt:dev/rn:zw/ad:1/sv:meter_elec/ad:1011_0",
"attributes": [
{
"name": "meter",
"values": [
{
"props": {
"delta_t": "774",
"prv_data": "31.290001",
"unit": "kWh"
},
"ts": "2025-09-26 18:32:21 +0200",
"val": 49.6100006103516,
"val_t": "float"
},
{
"props": { "unit": "W" },
"ts": "2025-09-26 18:32:21 +0200",
"val": 0,
"val_t": "float"
}
]
}
],
"name": "meter_elec"
}
]
} }
] ]

View File

@@ -4,7 +4,6 @@ import {
VinculumPd7Service, VinculumPd7Service,
} from '../fimp/vinculum_pd7_device'; } from '../fimp/vinculum_pd7_device';
import { ServiceComponentsCreationResult } from '../ha/publish_device'; import { ServiceComponentsCreationResult } from '../ha/publish_device';
import { haGetCachedState } from '../ha/update_state';
export function out_lvl_switch__components( export function out_lvl_switch__components(
topicPrefix: string, topicPrefix: string,
@@ -12,123 +11,41 @@ export function out_lvl_switch__components(
svc: VinculumPd7Service, svc: VinculumPd7Service,
_svcName: string, _svcName: string,
): ServiceComponentsCreationResult | undefined { ): ServiceComponentsCreationResult | undefined {
const lvlCommandTopic = `${topicPrefix}${svc.addr}/command`; const commandTopic = `${topicPrefix}${svc.addr}/command`;
const binaryCommandTopic = `${topicPrefix}${svc.addr}/binary/command`;
const stateTopic = `${topicPrefix}/state`;
const minLvl = svc.props?.min_lvl ?? 0; const minLvl = svc.props?.min_lvl ?? 0;
const maxLvl = svc.props?.max_lvl ?? 100; const maxLvl = svc.props?.max_lvl ?? 100;
const isLightDevice = device.type?.type === 'light'; return {
components: {
if (isLightDevice) { [svc.addr]: {
// Use light component for light devices unique_id: svc.addr,
return { platform: 'number',
components: { name: 'Level Switch',
[`${svc.addr}_light`]: { min: minLvl,
unique_id: `${svc.addr}_light`, max: maxLvl,
platform: 'light', step: 1,
name: 'Light', command_topic: commandTopic,
brightness: true, optimistic: false,
brightness_scale: maxLvl, value_template: `{{ value_json['${svc.addr}'].lvl }}`,
command_topic: binaryCommandTopic,
brightness_command_topic: lvlCommandTopic,
optimistic: false,
state_topic: stateTopic,
state_value_template: `{{ (value_json['${svc.addr}'].lvl > 0) | iif('ON', 'OFF') }}`,
brightness_state_topic: stateTopic,
brightness_value_template: `{{ value_json['${svc.addr}'].lvl }}`,
},
}, },
commandHandlers: { },
[lvlCommandTopic]: async (payload: string) => {
const lvl = parseInt(payload, 10);
if (Number.isNaN(lvl)) {
return;
}
await sendFimpMsg({ commandHandlers: {
address: svc.addr!, [commandTopic]: async (payload: string) => {
service: 'out_lvl_switch', const lvl = parseInt(payload, 10);
cmd: 'cmd.lvl.set', if (Number.isNaN(lvl)) {
val: lvl, return;
val_t: 'int', }
});
},
[binaryCommandTopic]: async (payload: string) => {
if (payload === 'ON') {
// Skip setting to max brightness if the device is already on, because Home Assistant also sends "ON" when only changing brightness.
const currentState = haGetCachedState({
topic: `${topicPrefix}/state`,
})?.[svc.addr];
if (currentState.lvl > 0) {
return;
}
if (svc.intf?.includes('cmd.binary.set')) { await sendFimpMsg({
// Set level to the last known non-zero value (not supported in add-on demo mode) address: svc.addr!,
await sendFimpMsg({ service: 'out_lvl_switch',
address: svc.addr!, cmd: 'cmd.lvl.set',
service: 'out_lvl_switch', val: lvl,
cmd: 'cmd.binary.set', val_t: 'int',
val: payload === 'ON', });
val_t: 'bool',
});
} else {
// Set level to max brightness
await sendFimpMsg({
address: svc.addr!,
service: 'out_lvl_switch',
cmd: 'cmd.lvl.set',
val: maxLvl,
val_t: 'int',
});
}
} else {
await sendFimpMsg({
address: svc.addr!,
service: 'out_lvl_switch',
cmd: 'cmd.lvl.set',
val: minLvl,
val_t: 'int',
});
}
},
}, },
}; },
} else { };
// Use number component for non-light devices
return {
components: {
[svc.addr]: {
unique_id: svc.addr,
platform: 'number',
name: 'Level Switch',
min: minLvl,
max: maxLvl,
step: 1,
command_topic: lvlCommandTopic,
optimistic: false,
value_template: `{{ value_json['${svc.addr}'].lvl }}`,
},
},
commandHandlers: {
[lvlCommandTopic]: async (payload: string) => {
const lvl = parseInt(payload, 10);
if (Number.isNaN(lvl)) {
return;
}
await sendFimpMsg({
address: svc.addr!,
service: 'out_lvl_switch',
cmd: 'cmd.lvl.set',
val: lvl,
val_t: 'int',
});
},
},
};
}
} }

View File

@@ -17,9 +17,6 @@ configuration:
tp_allow_empty: tp_allow_empty:
name: Allow Empty Thingsplex Credentials name: Allow Empty Thingsplex Credentials
description: Allow empty Thingsplex username and/or password. description: Allow empty Thingsplex username and/or password.
ignore_availability_reports:
name: Ignore Availability Reports
description: Sometimes the hub incorrectly reports some devices as down. This setting forces all devices to always be treated as up.
demo_mode: demo_mode:
name: Demo Mode name: Demo Mode
description: Use a sample recorded state from a real Futurehome Smarthub to simulate devices. description: Use a sample recorded state from a real Futurehome Smarthub to simulate devices.