Meraki Lux MQTT Feed Template Filter

Here is my goal… I would like to change the brightness of my Philips Hue bulbs in a desk lamp based of the MQTT LUX feed from a Meraki MV Camera. The feed looks like so…

{“lux”: 122.9}
{“lux”: 114.5}
{“lux”: 118.6}
{“lux”: 124.9}

I want to write logic to turn the brightness of a Philips Hue bulb up or down in brightness based off the lux value in the above mentioned feed. The action I have configured works if I trigger it but for whatever reason I am not writing my template filter correctly. Here is what I have so far for the template fitler…

condition:
  - condition: template
    value_template: "{{ trigger.payload_json['lux'] <= 20 }}"

Any suggestions or help would be much appreciated. BTW… this is phase one with additional reporting that I would like to do based off the lux values.

Thanks

How are you getting the Lux out of the MV camera?

I’m able to see a MQTT lux topic on the MV I have but it’s never publishing anything.

I’ve tried almost everything.

First, verify that your MQTT broker is alive and reachable by the camera. Second, you will have to subscribe to a topic similar to this…

/merakimv/Camera-SN/light

Everything seems to be fine.

I have 2x MV12. What model are you running?

From the screen shots you should be able to see the MQTT topics that are able to be scanned.
Perhaps there’s an issue with the MV12s.

People count and zones work fine. :roll_eyes:

As a side note, I’ll probably be getting a few MV72s and MV22s soon.

Not sure why your MV12’s wouldn’t send MQTT Lux. In my lab I have MV12’s, MV22’s, and MV72’s. They all work fine with sending MQTT lux. I am using Mosquitto as my broker.

I was able to get this working. First my code up above was good, it was just that I had forgotten to add another sensor in my configuration.yaml for the lux topic. Here is a snippet from my automations.yaml.

alias: Low Light Level in Office - MAX Lamp
  trigger:
  - platform: mqtt
    topic: /merakimv/Camera-SN/light
  condition:
  - condition: template
    value_template: '{{ trigger.payload_json[''lux''] < 100 }}'
  - condition: state
    entity_id: light.office
    state: 'On'
  action:
  - data:
      brightness_pct: 100
    entity_id: light.office
    service: light.turn_on
  alias: Low Light Level in Office - Dim Lamp
  trigger:
  - platform: mqtt
    topic: /merakimv/Camera-SN/light
  condition:
  - condition: template
    value_template: '{{ trigger.payload_json[''lux''] >= 100 }}'
  - condition: state
    entity_id: light.office
    state: 'On'
  action:
  - data:
      brightness_pct: 10
    entity_id: light.office
    service: light.turn_on