Giter Site home page Giter Site logo

Comments (21)

alexander-vitishchenko avatar alexander-vitishchenko commented on August 16, 2024

Are you sure it worked before? It would be great to learn using what QuickApp version.

There is a chance it is not a QuickApp defect, but Fibaro HC3 changed the way device type is named.

from hc3-to-mqtt.

MomosX avatar MomosX commented on August 16, 2024

Hmm i'm sure it worked. And yes, maybe Fibaro changed something in the last FW.

This is one the dimmers in swagger:
{ "id": 968, "name": "LightsHolGaraj", "roomID": 226, "view": [ { "assetsPath": "dynamic-plugins/com.fibaro.multilevelSwitch", "name": "com.fibaro.multilevelSwitch", "translatesPath": "/assets/i18n/com.fibaro.multilevelSwitch", "type": "ts" }, { "assetsPath": "dynamic-plugins/energy", "name": "energy", "translatesPath": "/assets/i18n/energy", "type": "ts" }, { "assetsPath": "", "name": "level-change", "translatesPath": "/assets/i18n/level-change", "type": "ts" }, { "assetsPath": "dynamic-plugins/power", "name": "power", "translatesPath": "/assets/i18n/power", "type": "ts" } ], "type": "com.fibaro.FGD212", "baseType": "com.fibaro.multilevelSwitch", "enabled": true, "visible": true, "isPlugin": false, "parentId": 965, "viewXml": false, "hasUIView": true, "configXml": false, "interfaces": [ "energy", "levelChange", "light", "power", "zwave", "zwaveAlarm", "zwaveMultiChannelAssociation", "zwaveProtection", "zwaveSceneActivation" ], "properties": { "parameters": [ { "id": 1, "lastReportedValue": 1, "lastSetValue": 1, "size": 1, "value": 1 }, { "id": 2, "lastReportedValue": 30, "lastSetValue": 30, "size": 1, "value": 30 }, { "id": 3, "lastReportedValue": 99, "lastSetValue": 99, "size": 1, "value": 99 }, { "id": 4, "lastReportedValue": 0, "lastSetValue": 0, "size": 2, "value": 0 }, { "id": 5, "lastReportedValue": 99, "lastSetValue": 99, "size": 1, "value": 99 }, { "id": 6, "lastReportedValue": 0, "lastSetValue": 0, "size": 2, "value": 0 }, { "id": 7, "lastReportedValue": 99, "lastSetValue": 99, "size": 1, "value": 99 }, { "id": 8, "lastReportedValue": 0, "lastSetValue": 0, "size": 2, "value": 0 }, { "id": 9, "lastReportedValue": 1, "lastSetValue": 1, "size": 1, "value": 1 }, { "id": 10, "lastReportedValue": 0, "lastSetValue": 0, "size": 2, "value": 0 }, { "id": 11, "lastReportedValue": 255, "lastSetValue": 255, "size": 2, "value": 255 }, { "id": 13, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 14, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 15, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 16, "lastReportedValue": 0, "lastSetValue": 0, "size": 2, "value": 0 }, { "id": 19, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 20, "lastReportedValue": 1, "lastSetValue": 1, "size": 1, "value": 1 }, { "id": 21, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 22, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 23, "lastReportedValue": 1, "lastSetValue": 1, "size": 1, "value": 1 }, { "id": 24, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 25, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 26, "lastReportedValue": 1, "lastSetValue": 1, "size": 1, "value": 1 }, { "id": 27, "lastReportedValue": 15, "lastSetValue": 15, "size": 1, "value": 15 }, { "id": 28, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 29, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 30, "lastReportedValue": 2, "lastSetValue": 2, "size": 1, "value": 2 }, { "id": 31, "lastReportedValue": 1, "lastSetValue": 1, "size": 1, "value": 1 }, { "id": 32, "lastReportedValue": 1, "lastSetValue": 1, "size": 1, "value": 1 }, { "id": 33, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 34, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 35, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 37, "lastReportedValue": 1, "lastSetValue": 1, "size": 1, "value": 1 }, { "id": 39, "lastReportedValue": 250, "lastSetValue": 250, "size": 2, "value": 250 }, { "id": 40, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 41, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 42, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 43, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 44, "lastReportedValue": 600, "lastSetValue": 600, "size": 2, "value": 600 }, { "id": 45, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 46, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 47, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 48, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 49, "lastReportedValue": 1, "lastSetValue": 1, "size": 1, "value": 1 }, { "id": 50, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 52, "lastReportedValue": 0, "lastSetValue": 0, "size": 2, "value": 0 }, { "id": 53, "lastReportedValue": 0, "lastSetValue": 0, "size": 2, "value": 0 }, { "id": 54, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 58, "lastReportedValue": 0, "lastSetValue": 0, "size": 1, "value": 0 }, { "id": 59, "lastReportedValue": 0, "lastSetValue": 0, "size": 2, "value": 0 } ], "pollingTimeSec": 0, "zwaveCompany": "Fibargroup", "zwaveInfo": "3,4,5", "zwaveVersion": "3.5", "RFProtectionState": 0, "RFProtectionSupport": 3, "alarmLevel": 0, "alarmType": 0, "categories": [ "lights" ], "configured": true, "dead": false, "deadReason": "", "deviceControlType": 2, "deviceIcon": 15, "deviceRole": "Light", "emailNotificationID": 0, "emailNotificationType": 0, "endPointId": 1, "energy": 31.16, "icon": { "path": "/assets/icon/fibaro/light/light0.png", "source": "HC" }, "isLight": true, "localProtectionState": 0, "localProtectionSupport": 5, "log": "", "logTemp": "", "manufacturer": "", "markAsDead": true, "model": "", "nodeId": 207, "parametersTemplate": "740", "power": 0, "productInfo": "1,15,1,2,16,0,3,5", "protectionExclusiveControl": 0, "protectionExclusiveControlSupport": false, "protectionState": 0, "protectionTimeout": 0, "protectionTimeoutSupport": false, "pushNotificationID": 0, "pushNotificationType": 0, "saveLogs": true, "saveToEnergyPanel": true, "sceneActivation": 0, "serialNumber": "h'0000000000006c3a", "showEnergy": true, "smsNotificationID": 0, "smsNotificationType": 0, "state": false, "storeEnergyData": true, "supportedDeviceRoles": [ "Light" ], "useTemplate": true, "userDescription": "", "value": 0 }, "actions": { "reconfigure": 0, "reset": 0, "sceneActivationSet": 0, "setValue": 1, "startLevelDecrease": 0, "startLevelIncrease": 0, "stopLevelChange": 0, "toggle": 0, "turnOff": 0, "turnOn": 0 }, "created": 1650490691, "modified": 1663354248, "sortOrder": 17 }

If you could describe the procedure to add a device or at least test if it works i'll gladly do that. I tried to edit stuff in the device_api.lua but nothing worked.

from hc3-to-mqtt.

alexander-vitishchenko avatar alexander-vitishchenko commented on August 16, 2024

Most likely Fibaro firmware, and it looks like I need to add more sophisticated device detection rules with wildcards - then WiickApp would work even if Fibaro device signature are changed in most cases

but it takes time and I wish there was more time during weekends (((

from hc3-to-mqtt.

alexander-vitishchenko avatar alexander-vitishchenko commented on August 16, 2024

By the way - do you need all the feature requests for yourself?

I guess it would be simpler if it was for commercial use by your clients $ (if any), then we could get it more people invest into more capabilities for QuickApp

from hc3-to-mqtt.

MomosX avatar MomosX commented on August 16, 2024

I could try and help if you can tell me where i have to modify. It would be good to have the typem basetype and overrites somewhere they could be easily modified so we do not bother you all the time. Just log in swagger , look at the json and input the new type / basetype in the respective fields in the QA code.

Or am i over simplifying things ?!

from hc3-to-mqtt.

MomosX avatar MomosX commented on August 16, 2024

unfortunatelly i need for myself only. But maybe if at some point it becomes very reliable, $ can be made.

I'm using HA for mobile/tablet interface between FIbaro and various other systems i have,

from hc3-to-mqtt.

MomosX avatar MomosX commented on August 16, 2024

One idea about making some $ would be to make it v. v. . good:) then encrypt it - as it is possible to do now. But first it needs rock solid and fast/ packed with features.

from hc3-to-mqtt.

MomosX avatar MomosX commented on August 16, 2024

@alexander-vitishchenko
So any idea how to fix the dimmers please ?

from hc3-to-mqtt.

rwijbenga avatar rwijbenga commented on August 16, 2024

Same problem here, after last update of the QA the dimmers are not there anymore. So I think something has changed in the QA itself in the last versions.

Couldn't recognize device #116 - 8 Spots - com.fibaro.multilevelSwitch - com.fibaro.dimmer

The previous QA did recognize it:

Device 8 Spots #116 (Keuken) identified as light-dimmer

The old version is one from 27-12-2021

Maybe also handy to add version numbering in the main QA file... :)

from hc3-to-mqtt.

alexander-vitishchenko avatar alexander-vitishchenko commented on August 16, 2024

I'll have a look and add your device signature + try to improve device detection algorithm, so it becomes more resilient when Fibaro changes it's device signautres

from hc3-to-mqtt.

MomosX avatar MomosX commented on August 16, 2024

cheers :)

from hc3-to-mqtt.

alexander-vitishchenko avatar alexander-vitishchenko commented on August 16, 2024

Hi @MomosX , @rwijbenga,

  1. I've tested the device from above "id": 968, "name": "LightsHolGaraj" => it appears to be fully functional dimmer:
  • I used the exactly device JSON that I got from you
  • You can check it by yourself by adding "developmentMode" variable and setting its value to "true"

I've redeployed the latest version of the QuickApp, can you please recheck if the issue persist?

  1. I'm using GitHub release/tag feature to do version control for the QuickApp, see at https://github.com/alexander-vitishchenko/hc3-to-mqtt/releases. It is currently used for major releases, e.g. once per quarter.

Thank you,
Alexander

from hc3-to-mqtt.

MomosX avatar MomosX commented on August 16, 2024

I copied again all the files. After that i deleted and reinstalled the QA.

Result:
image

By the way : as an addition, the code posted by someone here works for Fibaro FGT001 and for Danfoss Room thermostats.

function Thermostat.isSupported(fibaroDevice)
    if (fibaroDevice.type == "com.fibaro.hvacSystem" or fibaroDevice.type == "com.fibaro.FGT001" or fibaroDevice.type == "com.fibaro.thermostatDanfoss") then  
        return true 
    else 
        return false
    end
end

But it is not included in the QA yet. This solves the thermostats part.

For dimmers no idea why it still doesn't work.

from hc3-to-mqtt.

rwijbenga avatar rwijbenga commented on August 16, 2024

Same here with the lastest version, dimmers are not recognized anymore...

from hc3-to-mqtt.

MomosX avatar MomosX commented on August 16, 2024

So i found out what the problem is: there is no "light" interface in those dimmers. - i mean it looks like it is in the json but it doesn't work. ?!?!

So taking out the "light" interface check and inserting the type "com.fibaro.dimmer" seemed to do the trick.

Adjusted the code like this:

function Dimmer.isSupported(fibaroDevice)
   -- if fibaroDeviceHasType(fibaroDevice, "com.fibaro.multilevelSwitch") and fibaroDeviceHasInterface(fibaroDevice, "light") then
    if (fibaroDeviceHasType(fibaroDevice, "com.fibaro.multilevelSwitch") or fibaroDeviceHasType(fibaroDevice, "com.fibaro.dimmer")) then
        return true
    else 
        return false
    end
end

And it works !!!

from hc3-to-mqtt.

MomosX avatar MomosX commented on August 16, 2024

In fact i think there is a deeper issue here: all the devices that have the interface "light" should be imported in HA as lights. But they are not, they are imported as switches.
Taking out the "light" interface check from those dimmers for example made them show in HA as lights .

Looking even further i see that the binary switches are all imported as switches in HA, when some should be imported as lights and some as switches.

Lines 84 to 119 from device_api.lua devide those binnary switches into lights and switches - or so it should. But in HA it doesnt work, they all go as switches. I guess the fibaroDeviceHasInterface(fibaroDevice, "light") is not doing what is supposed to.

@rwijbenga can you check how your devices end up in HA? Lights or switches ?

from hc3-to-mqtt.

MomosX avatar MomosX commented on August 16, 2024

Also i think this goes even deeper as i see in main.lua lines 244 to 258 that the QA is supposed to create HA devices for battery level, but it does not. table_contains_value(fibaroDevice.interfaces, "battery")

This points back to the table reading as it seems none of the interfaces gets read properly.

@alexander-vitishchenko am i reading the code right or ?!

from hc3-to-mqtt.

MomosX avatar MomosX commented on August 16, 2024

Sooo, in device_api.lua line 499 where the QA defines what device attributes is looking for:

            attributes = {
                -- define the list of Fibaro device attributes we are interested in
                main = {
-- changed from "interface" to "interfaces"                    "id", "name", "roomID", "view", "type", "baseType", "enabled", "visible", "isPlugin", "parentId", "viewXml", "hasUIView", "configXml", "interface", "properties", "actions", "created", "modified", "sortOrder"
                    "id", "name", "roomID", "view", "type", "baseType", "enabled", "visible", "isPlugin", "parentId", "viewXml", "hasUIView", "configXml", "interfaces", "properties", "actions", "created", "modified", "sortOrder"

interface was missing an "s" . Modified it and it seems all interfaces are working now, HA even has power/batery sensors.

@alexander-vitishchenko can you please check all this if i'm correct or not ?

I reverted the modifications i did for dimmer as they are no longer neccessary after changing the "interfaces"

Thank you !

from hc3-to-mqtt.

alexander-vitishchenko avatar alexander-vitishchenko commented on August 16, 2024

@MomosX, @rwijbenga

  1. That's right - fixed.

  2. The wrong attribute name was caused by the inconsistency with my development environments at the home lab, resulting me into looking at the functional code, while publishing the wrong one to GitHub, i.e. human factor.

The human factor clearly need to be addresses. QuickApp is growing and new features may break the existing functionality, where dimmer's issue is just one of such examples:

  • I've reduced the development environments to a single instance at the home lab, so there is a less chance for me to make a mistake because of unnecessary complexity (by the cost of removing branching flexibility for my dev env, but I guess stability is more important)
  • I've automated the majority of the Fibaro HC3 -> GitHub deployment with Microsoft Power Automate. Now it take me 10 seconds to get ready for commit, and there smaller chance to make a mistake while executing executing repeatative steps over several minutes manually

Plus, what need to do - invest into setting up an Automated Regression Test framework for the QuickApp, at least on the "Smoke Testing" level. Not an easy thing to do with lua and Fibaro ecosystem, but something what I think should avoid breaking core functionality in a future.

  1. Once development environment is enabled with a higher quality code for the QuickApp - I should be able to add new features without a significant risk of breaking an existing functionality. Hope to get it done within a week.

from hc3-to-mqtt.

MomosX avatar MomosX commented on August 16, 2024

@alexander-vitishchenko you are doing a great job and i'm sure all who use this QA appreciate it.
Human factor is something i know very well ... happens.

So now you included the "interfaces" fix and the thermostats in the QA ? the thermostat i posted above also. And we can close the Danfoss RS, Fibaro FGT and Danfoss TRV issues as solved

from hc3-to-mqtt.

alexander-vitishchenko avatar alexander-vitishchenko commented on August 16, 2024

The fix applies to all devices that rely on "interfaces" for their type identification. So the fix applies to dimmers and other devices that work before.

Worth mentioning - the QuickApp had and still has limited support for thermostats overall. I plan to add better support for thermostats once stability improvements are implemented with the Regression/Smoke Testing framework.

from hc3-to-mqtt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.