Need help storing URL for use in generic IP camera (over 255 chars)

Attributes can be longer than 255 characters; perhaps you could put the URL into an attribute instead, and some dummy value for the actual sensor? Or some other response (possibly even a truncated string) that you can ignore.

You can use the json_attributes thing to capture this other info.

Take a look at the file I attached to the first post in this thread
Monitor your Generac generator with Home Assistant for an example. Just an excerpt that might give you a sense of this:

  - platform: rest
    name: genmon_status_json
    hidden: true
    resource: http://generator.local:8000/cmd/status_json
    value_template: '{{ value_json["Status"]["Engine"]["Engine State"] }}'
    friendly_name: "Generator State"
    json_attributes:
      - "Status"
      - "Line State"
      - "Last Log Entries"
      - "Time"
    method: GET
    scan_interval: 65

and the template sensors that look like this:

  - platform: template
    sensors:

      # outage related sensors
      genmon_outage_status:
        entity_id: sensor.genmon_outage_json
        friendly_name: 'Generator Status'
        value_template: '{{ states.sensor.genmon_outage_json.attributes["Outage"]["Status"] }}'

which access the attributes that were previously squirreled away.

Perhaps something like this could be adapted to your problem?

2 Likes