Handle more state update events (evt.<name>.raport)

This commit is contained in:
Adrian Jagielak 2025-07-24 16:48:33 +02:00
parent 3c56a30d01
commit d9eca294e3
No known key found for this signature in database
GPG Key ID: 0818CF7AF6C62BFB
7 changed files with 20 additions and 14 deletions

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: "0.0.34" version: "0.0.35"
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"

View File

@ -227,12 +227,17 @@ import { delay } from './utils';
} }
break; break;
} }
case 'evt.sensor.report':
case 'evt.presence.report':
case 'evt.open.report':
case 'evt.lvl.report':
case 'evt.alarm.report': case 'evt.alarm.report':
case 'evt.binary.report': { case 'evt.binary.report':
case 'evt.color.report':
case 'evt.lvl.report':
case 'evt.mode.report':
case 'evt.open.report':
case 'evt.presence.report':
case 'evt.scene.report':
case 'evt.sensor.report':
case 'evt.setpoint.report': {
haUpdateStateSensorReport({ haUpdateStateSensorReport({
topic, topic,
value: msg.val, value: msg.val,
@ -240,6 +245,7 @@ import { delay } from './utils';
}); });
break; break;
} }
case 'evt.network.all_nodes_report': { case 'evt.network.all_nodes_report': {
const devicesAvailability = msg.val; const devicesAvailability = msg.val;
if (!devicesAvailability) { if (!devicesAvailability) {

View File

@ -35,7 +35,7 @@ export function basic__components(
max: MAX_LVL, max: MAX_LVL,
step: 1, step: 1,
command_topic: cmdTopic, command_topic: cmdTopic,
optimistic: true, optimistic: false,
value_template: `{{ value_json['${svc.addr}'].lvl }}`, value_template: `{{ value_json['${svc.addr}'].lvl }}`,
}, },
}, },

View File

@ -62,18 +62,18 @@ export function color_ctrl__components(
// Basic on/off control // Basic on/off control
command_topic: commandTopic, command_topic: commandTopic,
state_topic: stateTopic, state_topic: stateTopic,
state_value_template: `{{ 'ON' if (value_json['${svc.addr}'].red > 0 or value_json['${svc.addr}'].green > 0 or value_json['${svc.addr}'].blue > 0) else 'OFF' }}`, state_value_template: `{{ 'ON' if (value_json['${svc.addr}'].color.red > 0 or value_json['${svc.addr}'].color.green > 0 or value_json['${svc.addr}'].color.blue > 0) else 'OFF' }}`,
// RGB color control // RGB color control
rgb_command_topic: rgbCommandTopic, rgb_command_topic: rgbCommandTopic,
rgb_state_topic: stateTopic, rgb_state_topic: stateTopic,
rgb_value_template: `{{ value_json['${svc.addr}'].red }},{{ value_json['${svc.addr}'].green }},{{ value_json['${svc.addr}'].blue }}`, rgb_value_template: `{{ value_json['${svc.addr}'].color.red }},{{ value_json['${svc.addr}'].color.green }},{{ value_json['${svc.addr}'].color.blue }}`,
// Brightness support (derived from RGB values) // Brightness support (derived from RGB values)
brightness_state_topic: stateTopic, brightness_state_topic: stateTopic,
brightness_value_template: `{{ [value_json['${svc.addr}'].red, value_json['${svc.addr}'].green, value_json['${svc.addr}'].blue] | max }}`, brightness_value_template: `{{ [value_json['${svc.addr}'].color.red, value_json['${svc.addr}'].color.green, value_json['${svc.addr}'].color.blue] | max }}`,
optimistic: true, optimistic: false,
}; };
// Add color temperature support if available // Add color temperature support if available

View File

@ -22,7 +22,7 @@ export function fan_ctrl__components(
unique_id: svc.addr, unique_id: svc.addr,
platform: 'fan', platform: 'fan',
command_topic: commandTopic, command_topic: commandTopic,
optimistic: true, optimistic: false,
preset_modes: supModes, preset_modes: supModes,
preset_mode_command_topic: commandTopic, preset_mode_command_topic: commandTopic,
preset_mode_value_template: `{{ value_json['${svc.addr}'].mode }}`, preset_mode_value_template: `{{ value_json['${svc.addr}'].mode }}`,

View File

@ -59,7 +59,7 @@ export function scene_ctrl__components(
platform: 'select', platform: 'select',
options: supScenes, options: supScenes,
command_topic: commandTopic, command_topic: commandTopic,
optimistic: true, optimistic: false,
value_template: `{{ value_json['${svc.addr}'].scene }}`, value_template: `{{ value_json['${svc.addr}'].scene }}`,
}; };

View File

@ -76,7 +76,7 @@ export function thermostat__components(
max_temp: maxTemp, max_temp: maxTemp,
temp_step: step, temp_step: step,
optimistic: true, optimistic: false,
}; };
// ───────────── command handlers ───────────── // ───────────── command handlers ─────────────