superjunky / Domoticz-Brel-Plugin

A Python plugin for Domoticz to controll Brel Home Hub
MIT License
3 stars 3 forks source link

Homebridge and invalid value #4

Closed Heukers closed 3 years ago

Heukers commented 3 years ago

I tried the e-domoticz plugin and add the device to homebridge... this works but not perfectly, it freezes everything after a while.

The mqttThings works nice..... accept for getting the current % off the blind.... wenn adjusting the % open with homebridge, it is updated in domoticz and in brel app..... wen updates in brel or domoticz are not seen in homebridge.... looks like mqtt does not deliver (or homebridge does not read) the update....

Solution .... change the topic.... after using mqtt-explorer i found that my topic was domoticz after removing /mqtt/MQTTthing i got the values

however it generates an invalid value for target en current value

This plugin generated a warning from the characteristic 'Current Position': characteristic value expected valid finite number and received "NaN" (number). See https://git.io/JtMGR for more info.

Does this have anything to do with Math.round?? or the unit expected % ?

superjunky commented 3 years ago

I tried the e-domoticz plugin and add the device to homebridge... this works but not perfectly, it freezes everything after a while.

At the time Blinds were not supported by e-Domoticz, therefor I never tried it.

The mqttThings works nice..... accept for getting the current % off the blind.... wenn adjusting the % open with homebridge, it is updated in domoticz and in brel app..... wen updates in brel or domoticz are not seen in homebridge.... looks like mqtt does not deliver (or homebridge does not read) the update....

Solution .... change the topic.... after using mqtt-explorer i found that my topic was domoticz after removing /mqtt/MQTTthing i got the values

This is all depending on the settings of your MQTT Hardware in Domoticz. You can define how you want your Publish Topic to be. I am using Floor/Room, that way Domoticz does not publish every single device-update but only the ones I need.

however it generates an invalid value for target en current value

This plugin generated a warning from the characteristic 'Current Position': characteristic value expected valid finite number and received "NaN" (number). See https://git.io/JtMGR for more info.

Does this have anything to do with Math.round?? or the unit expected % ?

Probably yes. You would have to experiment with it. An alternative is to build your own MQTT coms.. This is a unrelated example to get the gist of it: MQTTthing out

"topics": {
    "setActive": {
        "topic": "domoticz/in",
        "apply": "return JSON.stringify({command: 'customevent', event: 'homekit_volume_switch', data: message})"
    },

DzVents in

return {
    on = {
        customEvents = {
            'homekit_volume_switch'
        }
    },

    logging = {
        level   = domoticz.LOG_ERROR,
        marker  = 'Volume Switch!'
    },

    execute = function(dz, item)

        dz.log('item data is ' .. item.data, dz.LOG_MODULE_EXEC_INFO)

        if tonumber(item.data) ~= nil then
            dz.devices('Volume Level Switch').dimTo(item.data)
        elseif item.data == 'Off' then
            dz.devices('Volume Level Switch').switchOff()
        end

    end

end

}

And the other way around: DzVents out

if item.active then

    local timer = dz.variables('Tuin Sproeier Minuten').value * 60

    item.switchOff().afterSec(timer)

    local myMessage = timer
    local myTopic = 'domoticz/out/mqtt/MQTTthing/sprinkler/timer'

    local function sendMQTT(message, topic)
        local MQTTTopic = topic or 'domoticz/out'
        dz.executeShellCommand( 'mosquitto_pub' ..  ' -t '  .. MQTTTopic .. " -m '" .. message .. "'" )
    end

    sendMQTT(myMessage, myTopic)

end

MQTTthing in

"getDuration": {
    "topic": "domoticz/out/mqtt/MQTTthing/sprinkler/timer",
    "apply": "return message"
},
Heukers commented 3 years ago

THNX and more issues like this are found on the github of mqttThings