Shelly PowerStripGen4 via MQTT

Hi,
I share this things channels to manage the new Shelly product Power strip gen4.
Both status reading and commands works fine:




- id: PSG4_switch_0
    channelTypeUID: mqtt:switch
    label: presa 0
    configuration:
      commandTopic: shellypstripg4-<REPLACE>/command/switch:0
      off: "off"
      on: "on"      
      stateTopic: shellypstripg4-<REPLACE>/status/switch:0
      transformationPattern:
        - JSONPATH:$.output
        - MAP:config:map:switch
  - id: PSG4_switch_0_pf
    channelTypeUID: mqtt:number
    label: cosfi 0
    configuration:
      stateTopic: shellypstripg4-<REPLACE>/status/switch:0
      transformationPattern:
        - JSONPATH:$.pf
  - id: PSG4_switch_1
    channelTypeUID: mqtt:switch
    label: presa 1
    configuration:
      commandTopic: shellypstripg4-<REPLACE>/command/switch:1
      off: "off"
      on: "on"      
      stateTopic: shellypstripg4-<REPLACE>/status/switch:1
      transformationPattern:
        - JSONPATH:$.output
        - MAP:config:map:switch
  - id: PSG4_switch_1_pf
    channelTypeUID: mqtt:number
    label: cosfi 1
    configuration:
      stateTopic: shellypstripg4-<REPLACE>/status/switch:1
      transformationPattern:
        - JSONPATH:$.pf
  - id: PSG4_switch_2
    channelTypeUID: mqtt:switch
    label: presa 2
    configuration:
      commandTopic: shellypstripg4-<REPLACE>/command/switch:2
      off: "off"
      on: "on"      
      stateTopic: shellypstripg4-<REPLACE>/status/switch:2
      transformationPattern:
        - JSONPATH:$.output
        - MAP:config:map:switch
  - id: PSG4_switch_2_pf
    channelTypeUID: mqtt:number
    label: cosfi 2
    configuration:
      stateTopic: shellypstripg4-<REPLACE>/status/switch:2
      transformationPattern:
        - JSONPATH:$.pf
  - id: PSG4_switch_3
    channelTypeUID: mqtt:switch
    label: presa 3
    configuration:
      commandTopic: shellypstripg4-<REPLACE>/command/switch:3
      off: "off"
      on: "on"      
      stateTopic: shellypstripg4-<REPLACE>/status/switch:3
      transformationPattern:
        - JSONPATH:$.output
        - MAP:config:map:switch
  - id: PSG4_switch_3_pf
    channelTypeUID: mqtt:number
    label: cosfi 3
    configuration:
      stateTopic: shellypstripg4-<REPLACE>/status/switch:3
      transformationPattern:
        - JSONPATH:$.pf
  - id: PSG4_switch_0_apower
    channelTypeUID: mqtt:number
    label: watt 0
    configuration:
      stateTopic: shellypstripg4-<REPLACE>/status/switch:0
      transformationPattern:
        - JSONPATH:$.apower
      unit: W
  - id: PSG4_switch_0_voltage
    channelTypeUID: mqtt:number
    label: volt 0
    configuration:
      stateTopic: shellypstripg4-<REPLACE>/status/switch:0
      transformationPattern:
        - JSONPATH:$.voltage
      unit: V
  - id: PSG4_switch_1_apower
    channelTypeUID: mqtt:number
    label: watt 1
    configuration:
      stateTopic: shellypstripg4-<REPLACE>/status/switch:1
      transformationPattern:
        - JSONPATH:$.apower
      unit: W
  - id: PSG4_switch_1_voltage
    channelTypeUID: mqtt:number
    label: volt 1
    configuration:
      stateTopic: shellypstripg4-<REPLACE>/status/switch:1
      transformationPattern:
        - JSONPATH:$.voltage
      unit: V
  - id: PSG4_switch_2_apower
    channelTypeUID: mqtt:number
    label: watt 2
    configuration:
      stateTopic: shellypstripg4-<REPLACE>/status/switch:2
      transformationPattern:
        - JSONPATH:$.apower
      unit: W
  - id: PSG4_switch_2_voltage
    channelTypeUID: mqtt:number
    label: volt 2
    configuration:
      stateTopic: shellypstripg4-<REPLACE>/status/switch:2
      transformationPattern:
        - JSONPATH:$.voltage
      unit: V
  - id: PSG4_switch_3_apower
    channelTypeUID: mqtt:number
    label: watt 3
    configuration:
      stateTopic: shellypstripg4-<REPLACE>/status/switch:3
      transformationPattern:
        - JSONPATH:$.apower
      unit: W
  - id: PSG4_switch_3_voltage
    channelTypeUID: mqtt:number
    label: volt 3
    configuration:
      stateTopic: shellypstripg4-<REPLACE>/status/switch:3
      transformationPattern:
        - JSONPATH:$.voltage
      unit: V

Just wondering if there’s a way to define prefix just in one place and reuse it as a tag?

1 Like

No, at least not yet and definitely not for managed Things. There is a PR open to create aliases and templates for the new YAML file format which should support this but it’s still in work or awaiting review.

Another approach is to create a wild card subscription and then use a rule to parse out the messages based on the topics and update the Items instead of defining Channels.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.