IP Camera Binding IP from item value

  • Platform information:
    • Hardware: RPi 3
    • OS: OpenHabian
    • Java Runtime Environment: Zulu 11
    • openHAB version: 3.3.0

TLDR: How can I set Things configurations from Item values?

Hi all! I’ve been playing around with several ESP32 and ESP8266 devices and having a blast (first openHAB experience, even though I’m reading material for years now).

Last thing I started playing with was the ESP32-CAM with Tasmota. I added some channels for getting the IP and stream/snapshot URLs using INFO2 topic and incoming value transformations, but then it didn’t work over the cloud because it only supports traffic to the server.

Then I installed the IP Camera Binding and created a Camera Thing. It worked at first try and I could see the stream over the cloud using oh-image-card widget on a custom widget.

The issue is my cameras may change the IP address from now and then (yes, I know I can assign an static IP), so I was wondering if it was possible to use item values on Things configuration fields, like I do on widgets:


- component: oh-image-card
    action: photos
      lazy: true
      theme: dark
      type: popup
    actionPhotos: =[items[props.video].state]
    lazy: true
      border-radius: 6px
      margin: 0px
      width: 100%
    url: =items[props.snapshot].state

IP Camera Thing:

UID: ipcamera:generic:ip_camera_1
label: IP Camera 1
thingTypeUID: ipcamera:generic
  mjpegOptions: -q:v 5 -r 2 -vf scale=640:-2 -update 1
  updateImageWhen: "0"
  gifPreroll: 0
  ffmpegLocation: /usr/bin/ffmpeg
  ipWhitelist: DISABLE
  mp4OutOptions: -c:v copy -c:a copy
  pollTime: 1000
  port: 80
  snapshotOptions: -an -vsync vfr -q:v 2 -update 1
  hlsOutOptions: -strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy -hls_flags delete_segments -hls_time 2 -hls_list_size 4
  gifOutOptions: -r 2 -filter_complex scale=-2:360:flags=lanczos,setpts=0.5*PTS,split[o1][o2];[o1]palettegen[p];[o2]fifo[o3];[o3][p]paletteuse


No idea about what your wanting to do with using an item, never tried nor wanted to do that. These other ways are alternative ways to maybe do what your trying to do?

  1. Static IP set in either the camera or the routers DHCP server.
  2. Hostname can be set in the router so you can use a name instead of an IP.
  3. Config fields support a Mac address to be entered that uses ARP to turn the mac into an IP. This could be added to the cores framework but to my knowledge is not a current feature. If done then all bindings could take advantage of the core feature.
  4. REST api and scripts or rules to do a lookup and change the config value using ARP.

I would suggest you look at hostnames and static IP use as they already work and are easy to do. If your wanting to discuss the other ways, then please create a topic that does not mention a particular binding as you will greatly reduce the number of people that will join in the discussion.

Thanks for you answer!

I already assigned static IPs to the cameras and reserved a pool of addresses in my router for future devices.

I was just wondering if I could use item values as values in configuration fields like this:

UID: ipcamera:generic:ip_camera_1
label: IP Camera 1
thingTypeUID: ipcamera:generic
  ipAddress: =items["ip_camera_1_ip"].state
  mjpegUrl: "http://" + items["ip_camera_1_ip"].state + ":81/stream"
  snapshotUrl: "http://" + items["ip_camera_1_ip"].state + "/snapshot.jpg"

I have never tried it, have you tried it and what was the result? As mentioned you probably need to ask this question in a more generic way so more people join in.