-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Amina S device #8191
Added Amina S device #8191
Conversation
src/devices/amina.ts
Outdated
}; | ||
|
||
const aminaAlarms = [ | ||
'Welded relay(s)', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make all of these snake_case
:
'Welded relay(s)', | |
'welded_relays', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, what is the purpose of converting those to snake case but not status texts for ev_status for instance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually text is free format, but for this use case it may be better to use a e.enum()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably enum would work, but as the value from the device is «bit encoded» one could in theory have multiple alarms as once? Probably not very likely tho, but possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, e.list()
with an e.enum()
as the type would be the best then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have any examples of how to do this, because whatever I do, the GUI only shows an array of strings, or is this expected behaviour?
I defined:
const aminaAlarms = [
'no_alarm',
'welded_relay', // Bit 0
'wrong_voltage_balance',
'rdc_dd_dc_leakage',
'rdc_dd_ac_leakage',
'high_temperature',
'overvoltage',
'undervoltage',
'overcurrent',
'car_communication_error',
'charger_processing_error',
'critical_overcurrent',
'critical_powerloss',
'unknown_alarm_bit_12',
'unknown_alarm_bit_13',
'unknown_alarm_bit_14',
'unknown_alarm_bit_15',
];
const aminaAlarmsEnum = e.enum('alarms', ea.STATE_GET, aminaAlarms);
In the fzLocal.alarms converter:
if (msg.data.alarms !== undefined) {
const activeAlarms = [];
result.alarm_active = false;
for (let i = 0; i < 16; i++) {
if ((msg.data['alarms'] >> i) & 0x01) {
activeAlarms.push(aminaAlarmsEnum.values[i+1]);
result.alarm_active = true;
}
}
if (result.alarm_active === false) {
activeAlarms.push(aminaAlarmsEnum.values[0]);
}
result.alarms = activeAlarms;
return result;
}
And finally the expose:
e.list('alarms', ea.STATE_GET, aminaAlarmsEnum).withDescription('List of active alarms'),
Example result with bit 1, 3 and 12 enabled:
Example result with no alarms:
I would perhaps expect something like this, not editable of course:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is expected indeed, the frontend should be improved a bit here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright then, this is implemented in 8263316
Thanks! |
Added new device Amina S, EV charger.
Device Zigbee documentation:
https://doc.clickup.com/9004130215/p/h/8cb07x7-18308/c750786359b035a
Device firmware update procedure (atleast FW 1.8.7 is required, currently at 1.8.50):
https://doc.clickup.com/9004130215/p/h/8cb07x7-30795/12688a97b1dfa55