Skip to content
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

Russian Lang #5

Open
aleksandrdobrynin opened this issue Sep 25, 2019 · 3 comments
Open

Russian Lang #5

aleksandrdobrynin opened this issue Sep 25, 2019 · 3 comments

Comments

@aleksandrdobrynin
Copy link

Please add support Russian language.

@Olen
Copy link
Contributor

Olen commented Mar 14, 2020

Made a small patch that allows you to name the elements as you like:

-- miflora-card.js.orig        2020-03-14 16:14:42.086382421 +0100
+++ miflora-card.js     2020-03-14 17:20:32.828731909 +0100
@@ -67,6 +67,12 @@
         for (var i = 0; i < _sensors.length; i++) {
             var _name = _sensors[i][0];
             var _sensor = _sensors[i][1];
+            if (_sensors[i].length == 3) {
+                var _display_name = _sensors[i][2];
+            }
+            else {
+                var _display_name = _name[0].toUpperCase() + _name.slice(1);
+            }
             var _state = '';
             var _uom = '';
             if (hass.states[_sensor]) {
@@ -103,7 +109,7 @@
             this.shadowRoot.getElementById('sensors').innerHTML += `
                 <div id="sensor${i}" class="sensor">
                     <div class="icon"><ha-icon icon="${_icon}"></ha-icon></div>
-                    <div class="name">${_name}</div>
+                    <div class="name">${_display_name}</div>
                     <div class="state" style="${_alertStyle}">${_alertIcon}${_state}${_uom}</div>
                 </div>

Not in any way the perfect solution but now you can specify whatever name you want in the config by adding a second ":" and a custom name to the "entity"

entities:
  - moisture:sensor.mi_moisture:Moist
  - intensity:sensor.mi_intensity:Light
  - temperature:sensor.mi_temperature
  - conductivity:sensor.mi_conductivity:Fertilizer

@Olen
Copy link
Contributor

Olen commented Mar 25, 2020

I have cleaned this up and created a PR
Be aware that this will BREAK current configs as I changed it to a more common format:

entities:
  - entity: sensor.foo
    type: moisture
    name: Custom Name
  - entity: sensor.bar
    type: intensity
    name: Other Name

@Nikolay-Ch
Copy link

Nikolay-Ch commented Oct 22, 2020

Russian language is working now... Just create right entities configuration section:

entities:
  - 'Влажность:sensor.miflora_moi_3'
  - 'Освещение:sensor.miflora_lux_3'
  - 'Температура:sensor.miflora_tem_3'
  - 'Плодородие:sensor.miflora_fer_3'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants