MQTT2 refresh rate?

Begonnen von xypzo, 28 Mai 2019, 17:42:37

Vorheriges Thema - Nächstes Thema

xypzo

Hi,
Is it possible to set a fixed refresh rate for my MQTT2 devices? Now they only update when i refresh the fhem page ... (power usage and switch / tasmota sonoff)

thnx

amenomade

See longpoll attribute in CommandRef.
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

xypzo

Longpoll is set to 1, ofcourse. Still no updates from (only) the MQTT powermeter

amenomade

What do you have in attribute readingList? Could we see a "list" of your MQTT2 Device and MQTT2 Server?
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

xypzo

#4

define Smartplug2 MQTT2_DEVICE DVES_2A3436
attr Smartplug2 IODev mqqt2
attr Smartplug2 autocreate 1
attr Smartplug2 devStateIcon ON:message_socket@red:on OFF:message_socket@green:off
attr Smartplug2 genericDeviceType outlet
attr Smartplug2 icon message_socket
attr Smartplug2 readingList DVES_2A3436:tele/stekker2/LWT:.* LWT\
                                         DVES_2A3436:cmnd/stekker2/POWER:.* POWER\
                                         DVES_2A3436:tele/stekker2/INFO1:.* { json2nameValue($EVENT) }\
                                         DVES_2A3436:tele/stekker2/INFO2:.* { json2nameValue($EVENT) }\
                                         DVES_2A3436:tele/stekker2/INFO3:.* { json2nameValue($EVENT) }\
                                         DVES_2A3436:stat/stekker2/RESULT:.* { json2nameValue($EVENT) }\
                                         DVES_2A3436:stat/stekker2/POWER:.* POWER\
                                         DVES_2A3436:tele/stekker2/STATE:.* { json2nameValue($EVENT) }\
                                         DVES_2A3436:tele/stekker2/SENSOR:.* { json2nameValue($EVENT) }\
                                         DVES_2A3436:tele/stekker2/UPTIME:.* { json2nameValue($EVENT) }\
                                         DVES_2A3436:stat/stekker2/UPGRADE:.* UPGRADE
attr Smartplug2 room GoogleAssistant,MQTT2_DEVICE
attr Smartplug2 setList off:noArg cmnd/stekker2/POWER1 0\
                                  on:noArg cmnd/stekker2/POWER1 1\
                                  toggle:noArg cmnd/stekker2/POWER1 2
attr Smartplug2 setStateList on off toggle
attr Smartplug2 stateFormat POWER
attr Smartplug2 webCmd on: off

define FileLog_Smartplug2 FileLog ./log/Smartplug2-%Y.log Smartplug2
attr FileLog_Smartplug2 logtype text
attr FileLog_Smartplug2 room MQTT2_DEVICE


The broker is this:
define mqqt2 MQTT2_SERVER 1885 global
attr mqqt2 autocreate simple
attr mqqt2 icon mqtt_broker
attr mqqt2 room Interfaces

amenomade

This is not a "list", but the raw definition.
You get a "list" when you enter for example list Smartplug2in the command field of Fhem.

In a "list" one can normally see more things (for example the value of the readings and when they were set, and the internals values)
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

Beta-User

The snippet wasn't even a RAW definition but most likely just an excerpt from the fhem.cfg...

(Tipp: avoid direct edits aso. in the cfg; there are better ways like the mentionned RAW editor - there's a link at the end of the detail view)

Imo you should check network connections first and have a look what messages really are received at MQTT2_SERVER side (rawEvents attribute and perhaps verbose may help).

If tasmota firmware is not up to date, go for the latest (6.5?), there have been some bugs in the ESP platform code.

Additional tipps:
- as FHEM is the only controller used: change tasmota settings for on/off texts to lower case (in set ... attrTemplate ... there's a template that also will help to do so, see the output of "?"-"attrTemplate")
- "ON:message_socket@red:on OFF:message_socket@green:off" will not switch the relay, better use
"ON:message_socket@red:off OFF:message_socket@green:on" (or the lower case variant in case you change that)
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors

rudolfkoenig

ZitatIs it possible to set a fixed refresh rate for my MQTT2 devices? Now they only update when i refresh the fhem page ... (power usage and switch / tasmota sonoff)
...
Longpoll is set to 1, ofcourse. Still no updates from (only) the MQTT powermeter
I assume a problem in the FHEM<->browser connection, i.e. firewall/antivirus/etc.
You might see some more details in the JavaScript console of the Browser.

xypzo

#8
Zitat von: amenomade am 28 Mai 2019, 23:41:07
This is not a "list", but the raw definition.
You get a "list" when you enter for example list Smartplug2in the command field of Fhem.

In a "list" one can normally see more things (for example the value of the readings and when they were set, and the internals values)

Haha sorry, NOOB here :)




Internals:
   CID        DVES_3765E7
   DEF        DVES_3765E7
   DEVICETOPIC Smartplug1
   FUUID      5cec0ca5-f33f-c40a-1ab1-9d0ad138ac131420
   IODev      mqqt2
   LASTInputDev mqqt2
   MSGCNT     107
   NAME       Smartplug1
   NR         406
   STATE      OFF
   TYPE       MQTT2_DEVICE
   mqqt2_MSGCNT 107
   mqqt2_TIME 2019-05-29 11:14:27
   READINGS:
     2019-05-28 16:32:25   Command         Unknown
     2019-05-28 21:05:00   CurrentSetCal   1785
     2019-05-29 11:14:27   ENERGY_ApparentPower 0
     2019-05-29 11:14:27   ENERGY_Current  0.000
     2019-05-29 11:14:27   ENERGY_Factor   0.00
     2019-05-29 11:14:27   ENERGY_Period   0
     2019-05-29 11:14:27   ENERGY_Power    0
     2019-05-29 11:14:27   ENERGY_ReactivePower 0
     2019-05-29 11:14:27   ENERGY_Today    0.002
     2019-05-29 11:14:27   ENERGY_Total    0.012
     2019-05-29 11:14:27   ENERGY_TotalStartTime 2019-05-27T19:40:06
     2019-05-29 11:14:27   ENERGY_Voltage  0
     2019-05-29 11:14:27   ENERGY_Yesterday 0.010
     2019-05-28 21:12:24   FallbackTopic   cmnd/DVES_3765E7_fb/
     2019-05-28 21:12:24   GroupTopic      sonoffs
     2019-05-28 21:12:25   Hostname        stekker1-1511
     2019-05-28 21:12:25   IPAddress       192.168.0.215
     2019-05-29 11:13:37   LWT             Online
     2019-05-29 11:14:26   LoadAvg         19
     2019-05-28 21:12:24   Module          BlitzWolf SHP
     2019-05-29 11:14:26   POWER           OFF
     2019-05-28 18:05:18   POWER1          off
     2019-05-28 21:03:43   PowerSetCal     10247
     2019-05-28 18:05:48   Reset           Reset and Restarting
     2019-05-28 21:12:25   RestartReason   Power on
     2019-05-29 11:14:26   Sleep           50
     2019-05-29 11:14:26   SleepMode       Dynamic
     2019-05-28 16:13:12   Status_ButtonRetain 0
     2019-05-28 16:13:12   Status_ButtonTopic 0
     2019-05-28 16:13:12   Status_FriendlyName_1 Stekker#1
     2019-05-28 16:13:12   Status_LedState 1
     2019-05-28 16:13:12   Status_Module   0
     2019-05-28 16:13:12   Status_Power    0
     2019-05-28 16:13:12   Status_PowerOnState 3
     2019-05-28 16:13:12   Status_PowerRetain 0
     2019-05-28 16:13:12   Status_SaveData 1
     2019-05-28 16:13:12   Status_SaveState 1
     2019-05-28 16:13:12   Status_SensorRetain 0
     2019-05-28 16:13:12   Status_SwitchMode_1 0
     2019-05-28 16:13:12   Status_SwitchMode_2 0
     2019-05-28 16:13:12   Status_SwitchMode_3 0
     2019-05-28 16:13:12   Status_SwitchMode_4 0
     2019-05-28 16:13:12   Status_SwitchMode_5 0
     2019-05-28 16:13:12   Status_SwitchMode_6 0
     2019-05-28 16:13:12   Status_SwitchMode_7 0
     2019-05-28 16:13:12   Status_SwitchRetain 0
     2019-05-28 16:13:12   Status_SwitchTopic 0
     2019-05-28 16:13:12   Status_Topic    stekker1
     2019-05-29 11:14:27   Time            2019-05-29T10:14:26
     2019-05-29 11:14:26   Uptime          0T14:02:08
     2019-05-29 11:14:26   Vcc             3.102
     2019-05-28 21:12:24   Version         6.5.0(release-sonoff)
     2019-05-28 21:04:26   VoltageSetCal   1994
     2019-05-28 21:12:25   WebServerMode   Admin
     2019-05-29 11:14:26   Wifi_AP         1
     2019-05-29 11:14:26   Wifi_BSSId      E0:3F:49:09:E2:70
     2019-05-29 11:14:26   Wifi_Channel    2
     2019-05-29 11:14:26   Wifi_Downtime   0T00:00:04
     2019-05-29 11:14:26   Wifi_LinkCount  1
     2019-05-29 11:14:26   Wifi_RSSI       100
     2019-05-29 11:14:26   Wifi_SSId       C:\Virus.exe
     2019-05-28 21:10:31   state           set_on
Attributes:
   IODev      mqqt2
   autocreate 1
   devStateIcon ON:message_socket@red:on OFF:message_socket@green:off
   genericDeviceType outlet
   icon       message_socket
   readingList DVES_3765E7:tele/stekker1/LWT:.* LWT
DVES_3765E7:cmnd/stekker1/POWER:.* POWER
DVES_3765E7:tele/stekker1/INFO1:.* { json2nameValue($EVENT) }
DVES_3765E7:tele/stekker1/INFO2:.* { json2nameValue($EVENT) }
DVES_3765E7:tele/stekker1/INFO3:.* { json2nameValue($EVENT) }
DVES_3765E7:stat/stekker1/RESULT:.* { json2nameValue($EVENT) }
DVES_3765E7:stat/stekker1/POWER:.* POWER
DVES_3765E7:tele/stekker1/STATE:.* { json2nameValue($EVENT) }
DVES_3765E7:tele/stekker1/SENSOR:.* { json2nameValue($EVENT) }
DVES_3765E7:tele/stekker1/UPTIME:.* { json2nameValue($EVENT) }
DVES_3765E7:tele/sonoff/LWT:.* LWT
DVES_3765E7:cmnd/sonoff/POWER:.* POWER
DVES_3765E7:tele/sonoff/INFO1:.* { json2nameValue($EVENT) }
DVES_3765E7:tele/sonoff/INFO2:.* { json2nameValue($EVENT) }
DVES_3765E7:tele/sonoff/INFO3:.* { json2nameValue($EVENT) }
DVES_3765E7:stat/sonoff/RESULT:.* { json2nameValue($EVENT) }
DVES_3765E7:stat/sonoff/POWER:.* POWER
DVES_3765E7:stat/stekker1/POWER1:.* POWER1
   room       GoogleAssistant,MQTT2_DEVICE
   setList    off:noArg cmnd/stekker1/POWER 0
on:noArg cmnd/stekker1/POWER 1
toggle:noArg cmnd/stekker1/POWER 2
   setStateList on off toggle
   stateFormat POWER





Internals:
   CONNECTS   27
   DEF        1885 global
   FD         16
   FUUID      5cd17204-f33f-c40a-9947-522781f8ac18ed8e
   NAME       mqqt2
   NR         404
   PORT       1885
   STATE      Initialized
   TYPE       MQTT2_SERVER
   READINGS:
     2019-05-29 11:13:37   RETAIN          {"tele/sonoff/LWT":"Online","tele/stekker1/LWT":"Online","tele/stekker2/LWT":"Offline"}
     2019-05-29 11:13:37   nrclients       1
     2019-05-29 07:46:47   state           Initialized
   clients:
     mqqt2_192.168.0.215_14071 1
   retain:
     tele/sonoff/LWT:
       ts         1559108807.89002
       val        Online
     tele/stekker1/LWT:
       ts         1559121217.79771
       val        Online
     tele/stekker2/LWT:
       ts         1559108807.89002
       val        Offline
Attributes:
   autocreate simple
   icon       mqtt_broker
   room       Interfaces

xypzo

Zitat von: Beta-User am 29 Mai 2019, 07:30:30
The snippet wasn't even a RAW definition but most likely just an excerpt from the fhem.cfg...

(Tipp: avoid direct edits aso. in the cfg; there are better ways like the mentionned RAW editor - there's a link at the end of the detail view)



Additional tipps:
- as FHEM is the only controller used: change tasmota settings for on/off texts to lower case (in set ... attrTemplate ... there's a template that also will help to do so, see the output of "?"-"attrTemplate")
- "ON:message_socket@red:on OFF:message_socket@green:off" will not switch the relay, better use
"ON:message_socket@red:off OFF:message_socket@green:on" (or the lower case variant in case you change that)

What raw editor is that? And where can i find this?

Beta-User

If you are in the detail view of any FHEM device, you'll find a link at the end of the page, see screenshots in https://wiki.fhem.de/wiki/Import_von_Code_Snippets (sorry, only german version available atm).

You might just play around a little with that tool it's kind of multiline command field and as such pretty self-explaining.



Wrt. to your problem, I'd suggest to follow the route Rudi has advised, your readings contents are up to date, so it's most likely a FHEM to browser problem.

Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors

xypzo

Zitat von: Beta-User am 29 Mai 2019, 11:37:54
If you are in the detail view of any FHEM device, you'll find a link at the end of the page, see screenshots in https://wiki.fhem.de/wiki/Import_von_Code_Snippets (sorry, only german version available atm).

You might just play around a little with that tool it's kind of multiline command field and as such pretty self-explaining.



Wrt. to your problem, I'd suggest to follow the route Rudi has advised, your readings contents are up to date, so it's most likely a FHEM to browser problem.


Thnx man! I will check the router for firewall settings!

xypzo

Ok, found a faulty antenna in my mysensors network, flooded the PI. Got it all solved now, thanks guys