Hello,
I would like to use Fhem via MQTT, so I installed the required modules. By the way here is a short description of what need to be done, after having updated fhem.
First download net-mqtt wich is required to run MQTT and MQTTBridge modules.
Unpack it in a directory, do to it with your terminal and do :
perl Makefile.PL
make
make test
make install
Ok then restart fhem, MQTT modules should load.
Here is my question now, I entered the following lines at the end of fhem.cfg :
define localMQTT MQTT 127.0.0.1:1883
define button_Salon MQTT_BRIDGE EnO_switch_002842C2
attr button_Salon IODev localMQTT
and I get a mosquitto server running on the Raspberry (wich of course also runb fhem). When I press the switch, I get no notification. I used clients on Android and windows to publish and subscribe. When I publish from one of these clients, others received the message (they all listen to #) but when I press the button nothing happen (I see the logs in the fhem webpage so fhem is aware that the switch was perssed/released).
Did I misconfigured something ?
MQTT_BRIDGE needs further configuration. You have to specify which reading is going to be published to what topic (and vice versa). Therefor you might want to add:
attr button_Salon publishState /fhem/button_Salon
to publish EnO_switch_002842C2s state to topic /fhem/button_Salon
you might also use attribute publishReading_<reading> <topic> to publish other readings. Don't know much about EnOcean so I cannot recommend anything special, depends on the reading your EnOthean-device produces.
The way back from mqtt to fhem goes by using the attributes 'subscribeState' and 'subscribeReading_<reading>'
see commandref.html (http://fhem.de/commandref.html#MQTT_BRIDGE) for details.
- Norbert
Hello,
I still get nothing :
define localMQTT MQTT 127.0.0.1:1883
define buttonSalon MQTT_BRIDGE EnO_switch_002842C2
attr buttonSalon IODev localMQTT
attr buttonSalon publishState /fhem/button/EnO_switch_002842C2/State
attr buttonSalon publishReading_buttons /fhem/button/EnO_switch_002842C2/State
attr buttonSalon publishReading_channelA /fhem/button/EnO_switch_002842C2/channelA
attr buttonSalon publishReading_channelB /fhem/button/EnO_switch_002842C2/channelB
attr buttonSalon publishReading_state /fhem/button/EnO_switch_002842C2/state
As you see I also pulish readings changes. Here is the description of the switch :
fhem> list EnO_switch_002842C2
Internals:
DEF 002842C2
IODev TCM310_0
LASTInputDev TCM310_0
MSGCNT 58
NAME EnO_switch_002842C2
NOTIFYDEV global
NR 35
NTFY_ORDER 50-EnO_switch_002842C2
STATE A0 B0
TCM310_0_DestinationID FFFFFFFF
TCM310_0_MSGCNT 58
TCM310_0_PacketType 1
TCM310_0_RSSI -77
TCM310_0_ReceivingQuality good
TCM310_0_RepeatingCounter 0
TCM310_0_SubTelNum 5
TCM310_0_TIME 2014-11-11 15:45:16
TYPE EnOcean
Readings:
2014-11-11 15:45:16 buttons released
2014-11-11 15:45:15 channelA A0
2014-11-11 15:45:15 channelB B0
2014-11-11 15:45:15 state A0 B0
Attributes:
IODev TCM310_0
room EnOcean
subType switch
I forgot to say that in the fhem weblog I get :
2014-11-11 15:55:29 MQTT_BRIDGE buttonSalon transmission-state: outgoing publish sent
2014-11-11 15:55:29 MQTT_BRIDGE buttonSalon transmission-state: outgoing publish sent
2014-11-11 15:55:29 MQTT_BRIDGE buttonSalon transmission-state: outgoing publish sent
2014-11-11 15:55:29 EnOcean EnO_switch_002842C2 buttons: pressed
2014-11-11 15:55:29 EnOcean EnO_switch_002842C2 channelB: BI
2014-11-11 15:55:29 EnOcean EnO_switch_002842C2 BI
2014-11-11 15:55:29 MQTT_BRIDGE buttonSalon transmission-state: outgoing publish sent
2014-11-11 15:55:29 MQTT_BRIDGE buttonSalon transmission-state: outgoing publish sent
2014-11-11 15:55:29 EnOcean EnO_switch_002842C2 buttons: released
2014-11-11 15:55:29 EnOcean EnO_switch_002842C2 buttons: released
2014-11-11 15:55:48 MQTT_BRIDGE buttonSalon transmission-state: outgoing publish sent
2014-11-11 15:55:48 MQTT_BRIDGE buttonSalon transmission-state: outgoing publish sent
2014-11-11 15:55:48 MQTT_BRIDGE buttonSalon transmission-state: outgoing publish sent
2014-11-11 15:55:48 MQTT_BRIDGE buttonSalon transmission-state: outgoing publish sent
2014-11-11 15:55:48 EnOcean EnO_switch_002842C2 buttons: pressed
2014-11-11 15:55:48 EnOcean EnO_switch_002842C2 channelA: AI
2014-11-11 15:55:48 EnOcean EnO_switch_002842C2 channelB: BI
2014-11-11 15:55:48 EnOcean EnO_switch_002842C2 AI BI
2014-11-11 15:55:48 MQTT_BRIDGE buttonSalon transmission-state: outgoing publish sent
2014-11-11 15:55:48 MQTT_BRIDGE buttonSalon transmission-state: outgoing publish sent
2014-11-11 15:55:48 EnOcean EnO_switch_002842C2 buttons: released
2014-11-11 15:55:48 EnOcean EnO_switch_002842C2 buttons: released
My fault :
attr buttonSalon publishReading_state /fhem/button/EnO_switch_002842C2/state[code]
to
attr buttonSalon publishReading_state fhem/button/EnO_switch_002842C2/state[/code]
does that mean it works now?
yes, at least for the switch :)
I'm going to test piloting plugs now. ^_^
It also works like a charm for piloting plugs :
define MQTB_EnO_UTE_008770A0 MQTT_BRIDGE EnO_UTE_008770A0
attr MQTB_EnO_UTE_008770A0 IODev localMQTT
attr MQTB_EnO_UTE_008770A0 subscribeSet fhem/plug/EnO_UTE_008770A0/command
then publish with MQTT :
channel : fhem/plug/EnO_UTE_008770A0/command
message : on 0 (or : off 0)
THANKS :)
Hello,
in the case of smart Plugs, I would like to retrieve energy consumption via MQTT. However, the Fhem command to do that is a "get ...." and it does not seem possible to trigger such a command via MQTT. I am wrong? Would it be possible to add such a command ?
In a same vein, would it be possible to trigger more general command (i.e. not associated to a specific device) via MQTT, such as listing all MQTT_devices ?
Alex.
executing a get-command from the mqtt-interface is not supported (yet). I'll take that into account for an update, but have to do some brainstorming about the semantics as mqtt is not designed to do synchronous method calls.
Most devices do put relevant values in state or readings so you most likely don't need to trigger the get-command, but configure that a change to state (or the reading in question) is being published to mqtt whenever it changes. Use attriutes publishState and/or publishReading_<reading> to do that.
- Norbert
I do agree with you,
actually the problem only appear for a very particular case : a specific smart plug for which you have to interrogate to get the consumption. I can understand that it may not be a hot topic.
I guess a workaround for me would be to add a script on Fhem side so that it regularly interrogate the smartplug.
Regards,
Alex.
best would be to change the smart-plug module such that it reports the value in regular intervals.