Topic-icon Phc2Mqtt

Mehr
04 Mai 2021 13:02 #31 von simonjo
simonjo antwortete auf Phc2Mqtt
Hi Rick
I sent you a PM

mvg, Jo

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
07 Mai 2021 19:20 #32 von HenningW
HenningW antwortete auf Phc2Mqtt
OK, great. If you manage, I would certainly be interested in such PHC-Bridge-Module.

Have a nice weekend
Henning

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
14 Mai 2021 15:48 #33 von Ricotchet
Ricotchet antwortete auf Phc2Mqtt
Hi Jo thanks a lot, I get my module today.
Will give a try on weekend
BR Paul

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
14 Mai 2021 15:58 #34 von simonjo
simonjo antwortete auf Phc2Mqtt
Hi Paul,

Great


Jo

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
16 Mai 2021 12:38 #35 von Ricotchet
Ricotchet antwortete auf Phc2Mqtt
H Jo,
I get the module runnig and its prublishing the states to my mosquitto Broker.
No i use the app Mqttfx to test the commands over Mqtt.
i want to switch on module 7 out3
my <topic-prefix> is "Haus"
i tried to publishe
Haus/p2m/cmd/ccmd/omd.7.out3=on

i can see in the webconsole
2021-05-16,12:36:22,I,MQTC,<Haus/p2m/cmd/ccmd/omd.7.out3=on=
but it's not working the module 7 out3 stays off

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
16 Mai 2021 12:48 #36 von simonjo
simonjo antwortete auf Phc2Mqtt
Hi Paul,

Ok I should clarify this better in the manual.

The topic should be: Haus/p2m/cmd/ccmd
And the payload: omd.7.out3.on

Jo

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
16 Mai 2021 12:53 #37 von Ricotchet
Ricotchet antwortete auf Phc2Mqtt
thanks that works

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
16 Mai 2021 13:17 - 16 Mai 2021 13:35 #38 von Ricotchet
Ricotchet antwortete auf Phc2Mqtt
Hi now i have the possibilites to send commands and recive events via mqtt.
i start with a new openhab installation installing Mqtt binding and connecting it to my mosquitto broker.
but how i can map the payload correctly?
there are the following configuaration possible for a simple switch.


Channel
  • Büro Licht
    mqtt:topic:6cfb5163b8:buerodecke:Buerodecke 

Configuration
Show advanced 
  • MQTT State Topic
An MQTT topic that this thing will subscribe to, to receive the state. This can be left empty, the channel will be state-less command-only channel.
  • MQTT Command Topic
An MQTT topic that this thing will send a command to. If not set, this will be a read-only switch.
QoS
  • At most once (best effort delivery "fire and forget")
  • At least once (guaranteed that a message will be delivered at least once)
  • Exactly once (guarantees that each message is received only once by the counterpart)
MQTT QoS of this channel (0, 1, 2). Default is QoS of the broker connection.
  • Retained
The value will be published to the command topic as retained message. A retained value stays on the broker and can even be seen by MQTT clients that are subscribing at a later point in time.
  • Is Command
If the received MQTT value should not only update the state of linked items, but command them, enable this option.
  • Custom On/Open Value
A number (like 1, 10) or a string (like "enabled") that is additionally recognised as on/open state. You can use this parameter for a second keyword, next to ON (OPEN respectively on a Contact).
  • Custom Off/Closed Value
A number (like 0, -10) or a string (like "disabled") that is additionally recognised as off/closed state. You can use this parameter for a second keyword, next to OFF (CLOSED respectively on a Contact).
Transform Values
These configuration parameters allow you to alter a value before it is published to MQTT or before a received value is assigned to an item.
  • Incoming Value Transformations
Applies transformations to an incoming MQTT topic value. A transformation example for a received JSON would be "JSONPATH:$.device.status.temperature" for a json {device: {status: { temperature: 23.2 }}}. You can chain transformations by separating them with the intersection character ∩.
  • Outgoing Value Transformation
Applies a transformation before publishing a MQTT topic value. Transformations are specialised in extracting a value, but some transformations like the MAP one could be useful.
  • Outgoing Value Format
Format a value before it is published to the MQTT broker. The default is to just pass the channel/item state. If you want to apply a prefix, say "MYCOLOR,", you would use "MYCOLOR,%s". If you want to adjust the precision of a number to for example 4 digits, you would use "%.4f".

____________________________________________________________________________________________________________________

I use the following configuration for:
MQTT State Topic "Haus/p2m/sta/omd.7"
MQTT Command Topic "Haus/p2m/cmd/ccmd/"
Custom On/Open Value "1"
Custom Off/Closed Value "0"

but what hast to be in:
Incoming Value Transformations
Outgoing Value Transformation
Outgoing Value Format


if i use:
Custom On/Open Value
"omd.7.out3.on"
Custom Off/Closed Value "omd.7.out3.off"

i can switch on of the light but no state is given means if i manually activate the light via hardware switch the state is not updated!
Log says
2021-05-16 12:22:06.374 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '{"out3":1}' not supported by type 'OnOffValue': No enum constant org.openhab.core.library.types.OnOffType.{"out3":1}
Letzte Änderung: 16 Mai 2021 13:35 von Ricotchet.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
16 Mai 2021 13:47 #39 von simonjo
simonjo antwortete auf Phc2Mqtt
First of all, Phc2Mqtt uses Qos 0

Second: about the format of the MQTT notifications, you can select different formats in Configuration -> PHC Logging
- xPhcLogd compatible -> will send 1 msg per event or channel status
- text format
- JSON format

I am not a user of OpenHab, maybe someone else can help for that

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
16 Mai 2021 21:51 #40 von Ricotchet
Ricotchet antwortete auf Phc2Mqtt
Hi Jo i got it running now but the format of the MQTT Message is difficult to translate in openhab.
The Problem is the  payload/structure is different for event and command
Structure;
for Command 
Haus/p2m/cmd/ccmd/
for Event
Haus/p2m/sta/omd.7.out3

better will be 
for Command 
Haus/p2m/cmd/ccmd/omd.7.out3
for Event
Haus/p2m/sta/omd.7.out3

is this something  you can change maybe as additional format for openhab?


Next how is the payload for jrm modules?
I tried 
jrm.2.fb2.downon

the webconsole shows 
2021-05-16,21:49:33,I,MQTC,<Haus/p2m/cmd/ccmd/=jrm.2.fb2.downon

but it did not work maybe becausethe =sign is in?
 

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
16 Mai 2021 22:01 #41 von rick
rick antwortete auf Phc2Mqtt
Hi Ricotchet,

I just got my PHC2MQTT module working after some issues and will be trying next week to use it with the MQTT OpenHAB binding.
I can see the issues you have with the different structures for status updates and sending commands. Maybe it is solvable with the OpenHAB value transformations, but I'm not that familiar with OH3 yet.

You can find the payload for sending commands in the ccmd reference in the main menu of the PHC2MQTT web interface.

For the JRM it is like this:
jrm.<0-31>.out<0-3>.down.<prioLevel:0-5>.<prioLock:0-1>.<run:1-65535 1/10s>

In your example jrm.2.out2.down.1.0.600 or something. JRM module 2, output number 2 of that module, priority 1, no priority lock and let it run for 60 seconds.

The fb2 is for the feedback to let the user know that the command was received I think.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
16 Mai 2021 22:03 #42 von rick
rick antwortete auf Phc2Mqtt
I forgot the run: part in my example.
jrm.2.out2.down.1.0.run:600

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
16 Mai 2021 22:19 #43 von simonjo
simonjo antwortete auf Phc2Mqtt
About the syntax of the commands, these can be found in Main Menu -> Ccmd Reference

Where topic = <topic-prefix>/cmd/ccmd
And payload is the command like: omd.0.out0.toggle

In the Ccmd Reference you will see things like: jrm.<0-31>.out<0-3>.down.<prioLevel:0-5>.<prioLock:0-1>.<run:1-65535 1/10s>

This means you can enter: jrm.0.out0.down.0.0.200

Everything between <..> is possible input, if it shows a text like <prioLevel:0-5> then prioLevel is a textual description of the parameter and 0-5 is the input range.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
16 Mai 2021 22:23 - 16 Mai 2021 22:32 #44 von Ricotchet
Ricotchet antwortete auf Phc2Mqtt
Hi Rick i think this is not correct this works for me now
jrm.2.out1.down.0.0.200
jrm.2.out1.stop.0
jrm.2.out1.up.0.0.200
Letzte Änderung: 16 Mai 2021 22:32 von Ricotchet.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
16 Mai 2021 22:24 #45 von simonjo
simonjo antwortete auf Phc2Mqtt
Paul,

Can you try to select the xPhcLogd compatible Format in Configure PHC Logging to see if this is better for OpenHab

If needed we can implement another format that better suits OpenHab

About the jrm commands, checkout Main Menu -> CCmd Reference and then click on the link for 'jrm'

If you want to go up 20 seconds you send: jrm.0.out0.0.0.200

To stop send: jrm.0.out0.stop.0

The 'fb' commands are typical events that the jrm sends back to the stm to keep track of it's status.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Powered by Kunena Forum