Closed RomchikL closed 10 months ago
I think, this code fixes all problems:
- type: custom:mini-humidifier
entity: humidifier.deerma_jsq_befb_humidifier
name: Hum
model: 'deerma.humidifier.jsq'
target_humidity:
state:
attribute: humidifier.target_humidity
mapper: >
(val) => {
// eslint-disable-next-line use-isnan
if (val === NaN || val === undefined || val === 'unknown') {
return '';
}
return val;
}
min: 40
max: 100
step: 1
disabled: false
indicators:
temperature:
source:
entity: sensor.deerma_jsq_befb_temperature
humidity:
source:
entity: sensor.deerma_jsq_befb_relative_humidity
water_tank_empty:
empty: Empty
filled: Filled
source:
attribute: humidifier.water_status
mapper: >
val => (val ? this.empty : this.filled)
full_icon: mdi:tray-full
empty_icon: mdi:tray
detached_icon: mdi:tray-remove
icon:
template: >
(value, entity) => {
if (entity.attributes.tank_status === false) {
return this.detached_icon;
}
if (value === this.empty) {
return this.empty_icon;
}
if (value === this.filled) {
return this.full_icon;
}
return this.detached_icon;
}
style: >
(value, entity) => {
if (value === this.empty || entity.attributes.tank_status === false)
return { color: 'red' };
if (value === this.filled)
return { color: '#FD451D' };
}
buttons:
mode:
state:
attribute: mode
active: (state, entity) => (entity.state !== 'off')
source:
ConstHumidity: 'Auto'
Low: 'Low'
Medium: 'Medium'
High: 'High'
led:
state:
entity: light.deerma_jsq_befb_indicator_light
toggle_action: >
(state,entity) => {
const service = state === 'on' ? 'turn_off' : 'turn_on';
const options = { entity_id: entity.entity_id };
return this.call_service('light', service, options);
}
buzzer:
state:
entity: switch.deerma_jsq_befb_alarm
toggle_action: >
(state,entity) => {
const service = state === 'on' ? 'turn_off' : 'turn_on';
const options = { entity_id: entity.entity_id };
return this.call_service('switch', service, options);
}
Hello!
I have a question with my hum deerma.humidifier.jsq. Early I used xiaomi_airpurifier integration to connect my hum to HA. But I had to declare all switches, input number, ... manually. Now I use hass-xiaomi-miot. By default, the hum is connected with the following sensors.
Screenshot
![image](https://github.com/artem-sedykh/mini-humidifier/assets/81814142/044b5a14-4546-4537-b069-7e600f05eb6d)And the mini-card looks like![image](https://github.com/artem-sedykh/mini-humidifier/assets/81814142/6322fa85-e4e7-41a8-b626-52bf1fcb0476)
I fixed the indicators, but services on the buttons do not work properly.
code of the card
``` - type: custom:mini-humidifier entity: humidifier.deerma_jsq_befb_humidifier name: Hum model: 'deerma.humidifier.jsq' indicators: temperature: source: entity: sensor.deerma_jsq_befb_temperature humidity: source: entity: sensor.deerma_jsq_befb_relative_humidity status: icon: mdi:tray-full empty: Em filled: Fi source: attribute: humidifier.water_status mapper: > val => (val ? this.empty : this.filled) buttons: mode: state: attribute: mode led: state: attribute: indicator_light.on mapper: "(state) => (state ? 'on' : 'off')" change_action: > (entity) => { const options = { entity_id:light.deerma_jsq_befb_indicator_light }; return this.call_service('light', 'toggle', options); } buzzer: state: attribute: alarm target_humidity: state: attribute: humidifier.target_humidity hide_indicator: false hide: false change_action: | (selected, state, entity) => { const options = { entity_id: entity.entity_id, humidity: selected }; return this.call_service('xiaomi_miot', 'set_miot_property', options); } ```I tryed to use xiaomi_miot.set_miot_property, light.toggle and xiaomi_miot.set_property services, but in the card they do not work. In HA services block they work, here an example of service to change the light (from 'on' to 'off'). Here siid and piid are miot service and property ID, e.g. (4,1) is the light.
Here all attributes of the hum
``` min_humidity: 40 max_humidity: 99 available_modes: Off, Low, Medium, High, ConstHumidity humidity: 63 mode: Off model: deerma.humidifier.jsq lan_ip: 192.168.2.13 mac_address: 44:23:7C:BE:BE:FB entity_class: MiotHumidifierEntity exclude_miot_services: custom miot_type: urn:miot-spec-v2:device:humidifier:0000A00E:deerma-jsq:1 humidifier.on: false humidifier.target_humidity: 63 humidifier.water_status: true humidifier.tank_status: true humidifier.fan_level: 4 alarm: true indicator_light.on: false environment.relative_humidity: 55 environment.temperature: 24 state_updater: lan sub_entities: alarm-5.alarm-1, environment-3.relative_humidity-1, environment-3.temperature-2, indicator_light-4 device_class: humidifier friendly_name: Дуся Humidifier supported_features: 1 ```