GithubHelp home page GithubHelp logo

Comments (21)

matej avatar matej commented on August 16, 2024 1

The inverse is also true. If the Switch is updated if homebridge is offline, the state will not be synced up - if you want the device to hold the ground truth of the system.

you would like mqtt-thing to republish all MQTT topics at start-up with current values in Homekit?

What I would find useful would be to have the plugin get the current state of the device on homebridge startup. E.g., with mqtt-switch-tasmota you could use the startup command for this:

"startCmd": "cmnd/lights/POWER1",
"startParameter": ""

from homebridge-mqttthing.

arachnetech avatar arachnetech commented on August 16, 2024

Hi,

What are you using "stateGet": "tele/sypialnia/STATE" for, if anything? This isn't a valid topic configuration setting for mqttthing. Is this the subject used by the physical switch on the wall?

If you want to control a light from a switch, you have two options:

  1. Publish the setOn topic from your switch to drive the light directly, and make sure that the light responds to a setOn with a corresponding getOn to update the homekit status.

  2. Add the switch separately to homekit (perhaps using mqttthing type Switch), and configure automations in Homekit to switch on/off the light when the switch state changes.

If your light doesn't publish to confirm that it's state has changed (through its getOn topic), you might be able to configure a simpler version fo the first option by using the same topic for the light and the switch and configuring this as the light's getOn and setOn, but I haven't tried this.

from homebridge-mqttthing.

hejsiri avatar hejsiri commented on August 16, 2024

I do not know how to configure it correctly :(
In the console in tasmota I have such topics:

16:14:07 MQT: stat/sypialnia/RESULT = {"POWER":"OFF"}
16:14:07 MQT: stat/sypialnia/POWER = OFF
16:14:13 MQT: stat/sypialnia/RESULT = {"POWER":"ON"}
16:14:13 MQT: stat/sypialnia/POWER = ON
16:14:27 MQT: tele/sypialnia/STATE = {"Time":"2018-08-15T16:14:27","Uptime":"24T22:48:40","Vcc":3.219,"POWER":"ON","Wifi":{"AP":1,"SSId":"Tenda_2G","RSSI":100,"APMac":"C8:3A:35:2B:E2:01"}}

from homebridge-mqttthing.

hejsiri avatar hejsiri commented on August 16, 2024

This work property with plugin "mqtt-switch-tasmota" :

   {
         "accessory": "mqtt-switch-tasmota",
         "switchType": "light",
        "type": "light",
        "url": "mqtt://192.168.99.100",
        "username": "",
        "password": "",
        "topics": {
            "statusGet": "stat/salon_lampa/POWER",
            "statusSet": "cmnd/salon_lampa/power",
            "stateGet": "tele/salon_lampa/STATE"
        },
        "onValue": "ON",
        "offValue": "OFF",
        "activityTopic": "tele/salon_lampa/LWT",
        "activityParameter": "Online",
        "startCmd": "cmnd/salon_lampa/TelePeriod",
        "startParameter": "120",
        "manufacturer": "Itead",
        "model": "Sonoff Basic",
        "serialNumberMAC": "5C:CF:7F:7A:6C:4D",
        "name": "Salon Lampa Switch"
    }

How do I properly set the light bulb accessories with mqttthing?

from homebridge-mqttthing.

hejsiri avatar hejsiri commented on August 16, 2024

OK I already know :) The meaning is case-sensitive in topic. Not "Power" but "POWER".

This is the correct configuration:

    {
        "accessory": "mqttthing",
        "type": "lightbulb",
        "name": "Salon lampa",
        "url": "mqtt://192.168.99.100",
        "username": "",
        "password": "",
        "caption": "",
        "topics": {
            "getOn": "stat/salon_lampa/POWER",
            "setOn": "cmnd/salon_lampa/power"
        },
        "integerValue": "true",
        "onValue": "ON",
        "offValue": "OFF"
    }

I do not understand the "integerValue" parameter until the end. Is he supposed to be "true" or "false" in my case?

from homebridge-mqttthing.

arachnetech avatar arachnetech commented on August 16, 2024

integerValue: true can be used as a shortcut for onValue: "1", offValue: "0" - as the default on/off values are "true" and "false". (If I remember correctly, integerValue was a configuration setting supported by one of the add-ins that I looked at before writing mqttthing - and I implemented it for compatibility before onValue and offValue.) However, since you're setting them to "ON" and "OFF" it will have no effect. Configuring onValue and offValue takes precedence over any integerValue setting.

Boolean types like on/off use true/false unless integerValue: true is configured, in which case they default to 1/0. Alternatively, specific values can be configured using onValue and offValue. Integer and string types are not affected by these settings.

... so in your configuration, you can leave out integerValue altogether.

from homebridge-mqttthing.

Kepete avatar Kepete commented on August 16, 2024

@mientki Did you solve the problem with state?
I can switch the light but it won't update the state if used with a wall switch.

My config:
`

    "accessory": "mqtt-switch-tasmota",
           "name": "NAME OF THIS ACCESSORY",
            "url": "mqtt://ip",
            "username": "",
            "password": "",
            "topics": {
                    "statusGet": "stat/sonoff_d_tuba/POWER",
                    "statusSet": "cmnd/sonoff_d_tuba/POWER",
                    "stateGet": "tele/sonoff_d_tuba/STATE"
                      },
            "onValue": "ON",
            "offValue": "OFF",
            "activityTopic": "tele/sonoff_d_tuba/LWT",
            "activityParameter": "Online",
            "startCmd": "cmnd/sonoff_d_tuba/TelePeriod",
            "startParameter": "60",
            "manufacturer": "Itead",
            "model": "Sonoff Basic",
            "serialNumberMAC": "11:11:11:11:11:11",
            "name": "test142"

`

What for are "startCmd": "cmnd/sonoff_d_tuba/TelePeriod", and "activityTopic": "tele/sonoff_d_tuba/LWT", ?

from homebridge-mqttthing.

hejsiri avatar hejsiri commented on August 16, 2024

try:

"statusSet": "cmnd/sonoff_d_tuba/power",

"power"small letters.

from homebridge-mqttthing.

Kepete avatar Kepete commented on August 16, 2024

@mientki Didn't help. Still not updating the state.

from homebridge-mqttthing.

hejsiri avatar hejsiri commented on August 16, 2024

It uses the addition of mqttting. It is much easier to configure. With a large number of accessors, the configuration file is more transparent. My configuration for the sample accessory is:

 {
   "accessory": "mqttthing",
   "type": "lightbulb",
   "name": "Salon lamp",
   "url": "mqtt: //192.168.99.100",
   "username": "",
   "password": "",
   "caption": "",
   "topics": {
          "getOn": "stat/salon_lampa/POWER",
          "setOn": "cmnd/salon_lampa/power"
          }
   "onValue": "ON",
   "offValue": "OFF"
   }

from homebridge-mqttthing.

Kepete avatar Kepete commented on August 16, 2024

@mientki
So I also tried mqttthings plugin. Set it up and exactly the same problem. I can switch the light, but I can't get the state. The state is not updating.
Is there any possibility to make sure that the topic is correct? I'm running mosquitto MQTT server.

from homebridge-mqttthing.

arachnetech avatar arachnetech commented on August 16, 2024

I recommend issuing a wildcard MQTT subscription externally to see what messages are being sent and when if you haven’t already tried this. For example:

mosquitto_sub -v -t "#"

It’s also possible to enable logging of the messages received by mqttthing by adding "logMqtt": true to your configuration.

from homebridge-mqttthing.

Kepete avatar Kepete commented on August 16, 2024

@mientki problem solved. Easy mistake. As I was using Sonoff dual, it had to be power1 and POWER1 (or power2 and POWER2).

The only problem now is if I restart the homebridge then the default is always light off. Even if it is actually on. Is there a possibility to fix this?

from homebridge-mqttthing.

hejsiri avatar hejsiri commented on August 16, 2024

The only problem now is if I restart the homebridge then the default is always light off. Even if it is actually on. Is there a possibility to fix this?

I noticed now that it is the same for me.

from homebridge-mqttthing.

Kepete avatar Kepete commented on August 16, 2024

Might not be possible to read older MQTT messages. If it is so, than it doesn't know the state and default is off until a new MQTT message comes...
But this is just a guess, maybe there is a fix

from homebridge-mqttthing.

Kepete avatar Kepete commented on August 16, 2024

Also, if a Sonoff is offline, then the status is not updated in the home app to not responding. Is there a fix for it?

from homebridge-mqttthing.

deon-wentzel avatar deon-wentzel commented on August 16, 2024

Hi, homebridge-mqtt-switch sees the status after a restart. Could this not be implemented into this plug-in?

from homebridge-mqttthing.

arachnetech avatar arachnetech commented on August 16, 2024

Just confirming the feature request here: you would like mqtt-thing to republish all MQTT topics at start-up with current values in Homekit?

from homebridge-mqttthing.

deon-wentzel avatar deon-wentzel commented on August 16, 2024

Hi, yes and to check the status of devices status continuously.

from homebridge-mqttthing.

mosaid88 avatar mosaid88 commented on August 16, 2024

Yes I believe we need the extra start cmnd,

"startCmd": "cmnd/lights/POWER1",
"startParameter": ""

startParameter is really handy as it can be used in 2 ways, Empty: will return current switch state, or if value provided (ON or OFF) then it can be used to set a default value on start of homebridge.

from homebridge-mqttthing.

arachnetech avatar arachnetech commented on August 16, 2024

Closing as feature request is now in separate issue #31.

from homebridge-mqttthing.

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.