Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 105753

Trigger Automation with Mqtt Topic with json content

$
0
0

Hi,

from wallbox: i want to use a json formattet mqtt topic for number.input
to wallbox: number.input to serve the mqtt topic json content

topic: openWB/vehicle/template/charge_template/1

json content:

{
    "name": "Ladeprofil i5",
    "disable_after_unplug": false,
    "prio": false,
    "load_default": false,
    "time_charging": {
        "active": false
    },
    "chargemode": {
        "selected": "pv_charging",
        "pv_charging": {
            "min_soc_current": 10,
            "min_current": 0,
            "feed_in_limit": false,
            "min_soc": 0,
            "max_soc": 101
        },
        "scheduled_charging": {},
        "instant_charging": {
            "current": 16,
            "limit": {
                "selected": "soc",
                "amount": 40000,
                "soc": 100
            }
        }
    }
}

for the needed entry chargemode.pv_charging.max_soc json pathfinder say

x.chargemode.pv_charging.max_soc

i tried a lot of things didn´t find the key how to use the json entry

my last try without success

incoming automation:

 ## von openWB Mac Soc
  - id: openwb2_maxsoc_auswahl
    alias: "openWB2 MaxSoc Auswahl"
    description: "receive max soc from openwb2"
    trigger:
      - platform: mqtt
        topic: "openWB/vehicle/template/charge_template/1/chargemode/pv_charging/max_soc"
    action:
      service: input_number.set_value
      data_template:
        entity_id: input_number.openwb2_maxsoc
        value: "{{ trigger.payload }}"
    mode: single

outgoing automation:

   ## in openWB Max SOC setzen
  - id: openwb2_maxsoc
    alias: "openWB2 MaxSoc"
    description: "send max soc to openwbw"
    trigger:
      platform: state
      entity_id: input_number.openwb2_maxsoc
    action:
      service: mqtt.publish
      data:
        topic: "openWB/set/vehicle/template/charge_template/1/chargemode/pv_charging/max_soc"
        retain: true
        payload_template: "{{ states('input_number.openwb2_maxsoc') | int(0) }}"
    mode: single

how can i do that?

2nd question
is it possible to use a entity eg. car_id (number of selected car) instead of the fixed number 1 in
topic: openWB/vehicle/template/charge_template/1

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 105753

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>