vincentwolsink / home_assistant_micronova_agua_iot

Home Assistant integration controlling heating devices connected via the Agua IOT platform of Micronova
Apache License 2.0
25 stars 15 forks source link

Prepare for additional sensors #46

Closed jipem01 closed 10 months ago

jipem01 commented 11 months ago

Add usage of "ENABLE" type refgisters to check if a register is in used by the stove model (and not only a "brand generic register". Helpfull to not create sensor and other entities not available on the stove.

vincentwolsink commented 11 months ago

I’m currently on vacation, so cannot check, but have you found any case where the enable register is actually useful?

I found that either the register is there and it is enabled (even when my stove doesn’t have the feature), or the register is just not there. That makes checking this enable register useless.

jipem01 commented 11 months ago

If found many of them on my Nobis stove :

thermostat_contact_1_enable / thermostat_contact_1_get "thermostat_contact_1_enable": { "app_image_name": "default", "reg_key": "thermostat_contact_1_enable", "reg_name": "Termostato contatto DX visibile", "reg_name_app": "Termostato DX Enable", "reg_key_group": "thermostat_contact_1", "reg_type": "ENABLE", "offset": 105, "eeprom": false, "is_word": true, "big_endian": false, "formula": "#/1024", "formula_inverse": "#*1024", "format_string": "{0}", "set_min": 0, "set_max": 1, "readonly": false, "mask": 1024, "is_hex": false, "is_temperature": false, "use_app": true, "display_dashboard": false, "display_manage": false, "display_info": false, "use_cat": true, "display_order": 0, "step": 1, "use_history": true, "use_history_output": true, "with_sign": false, "from_char_code": false, "notify_on_change": false, "is_test": false, "value_raw": "0", "value": 0 },

vent_rear_enable / vent_rear_set : "vent_rear_enable": { "app_image_name": "default", "reg_key": "vent_rear_enable", "reg_name": "Vent. Rear Enable", "reg_name_app": "Vent. Rear. Enable", "reg_key_group": "vent_rear", "reg_type": "ENABLE", "offset": 107, "eeprom": false, "is_word": true, "big_endian": false, "formula": "#/16", "formula_inverse": "#*16", "format_string": "{0}", "set_min": 0, "set_max": 1, "readonly": false, "mask": 16, "is_hex": false, "is_temperature": false, "use_app": true, "display_dashboard": false, "display_manage": false, "display_info": false, "use_cat": true, "display_order": 0, "step": 1, "use_history": true, "use_history_output": true, "with_sign": false, "from_char_code": false, "notify_on_change": false, "is_test": false, "value_raw": "0", "value": 0 },

jipem01 commented 11 months ago

I have a doubt on a specifi register : real_wood_power_enable / real_wood_power_get I have an hybrid Unica 10 (wood/pellet), And real_wood_power_enable is currently set as DISABLE. I fear it switch only switch to ENABLE once wood fire have been dectected. In this case it will not detected at the init.

But it's easy to solve by note providing an enable_key. There may be the risk to creat the real_power_wood_get entity on a non-wood stove, but I need diagnosis from another Nobis pellet-only stove to compare if this register is present on pellet-only stove. And in worst case, the entity could still be deactivated by user.

sonarcloud[bot] commented 10 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

jipem01 commented 10 months ago

I've added a commit to check if the "enable_key" register exist. If not, the enable_key is ignored and the entity created. Usefull if not all brand/models use sames "optionnals" parameters...

vincentwolsink commented 10 months ago

I also found that the value of an enable register is not always 0 or 1. This needs a bit more investigation.

        "temp_air_palm_enable": {
          "app_image_name": "default",
          "reg_key": "temp_air_palm_enable",
          "reg_name": "T. Amb. Palmare Enable",
          "reg_name_app": "Temp. Palm. Enable",
          "reg_key_group": "temp_air_palm",
          "reg_type": "ENABLE",
          "offset": 1,
          "eeprom": false,
          "is_word": false,
          "big_endian": false,
          "formula": "#",
          "formula_inverse": "#",
          "format_string": "{0}",
          "set_min": 0,
          "set_max": 255,
          "readonly": false,
          "mask": 65535,
          "is_hex": false,
          "is_temperature": false,
          "use_app": false,
          "display_dashboard": false,
          "display_manage": false,
          "display_info": false,
          "use_cat": true,
          "display_order": 0,
          "step": 1,
          "use_history": true,
          "use_history_output": true,
          "with_sign": false,
          "from_char_code": false,
          "notify_on_change": false,
          "is_test": false,
          "value_raw": "43",
          "value": 43
        },
vincentwolsink commented 10 months ago

There is also entries with enable values specified.

        "canalization_1_temp_air_enable": {
          "app_image_name": "default",
          "reg_key": "canalization_1_temp_air_enable",
          "reg_name": "Canalizzazione 1 Temperatura aria visibile",
          "reg_name_app": "Can. 1 Temp.",
          "reg_key_group": "canalization_1_temp_air",
          "reg_type": "ENABLE",
          "offset": 32817,
          "eeprom": true,
          "is_word": false,
          "big_endian": false,
          "formula": "#",
          "formula_inverse": "#",
          "format_string": "{0}",
          "set_min": 0,
          "set_max": 2,
          "readonly": false,
          "mask": 65535,
          "is_hex": false,
          "is_temperature": false,
          "use_app": true,
          "display_dashboard": false,
          "display_manage": false,
          "display_info": false,
          "use_cat": true,
          "display_order": 35,
          "step": 1,
          "use_history": true,
          "use_history_output": true,
          "with_sign": false,
          "from_char_code": false,
          "notify_on_change": false,
          "is_test": false,
          "enable_val": [
            {
              "value": 1
            },
            {
              "value": 2
            }
          ],
          "value_raw": "0",
          "value": 0
        },
vincentwolsink commented 10 months ago

For now I followed a more generic approach, and just check every register if it is enabled or not. If we need to customize at a later point we can implement your approach with the enable_key. See #56

vincentwolsink commented 10 months ago

I propose to close this one for now. We can reopen a new one once needed.

jipem01 commented 10 months ago

Things seems more complicated than expected... Cold weather yesterday, i've started back the stove. When switching from pellets to woods, i've seen a new parameter appearing on Nobis-Fi app ("livre"->book? I think bad translation from Italian...). Was not there last winter. On other hand, the mixed pellet/wood stove is a new model and I have one of the firsts models... Unfortunately it was not possible to check deeper this time (no access to my computer). I fear that the "enable" register is used to make the setting available or not in the app and could change during stove usage. We have to understand how it should be handled in HA : totally ignore "enable" parameters when creating entities? Ignore only for entities that have been identified switching to enabled/disabled during stove usage? Create entities but disabling entities in HA depending on enable register status (is it even possible?)?

Nb : no hurry, it's more important to stabilize the v0.2 now 😉.