Using Templating or Sensors

If I want to pull data from the weather table like below, do I need to create my own sensors? I didn’t want to have to create sensors for all of this data.

- element: forecast_day1
  state_action:
      - service: floorplan.text_set
         service_data: >-
                    {{ state_attr('weather.obx_house','forecast')[0]['condition'] }}

You haven’t specified an entity in the rule so you would need to use the hass object to access the attributes

Edit: here is some examples of that in use Floorplan does not detect changes in cover.* entities to "set class"? - #7 by Aephir

I’m not sure of that syntax since the weather data is in an array.

if I do this I get the temperature but the forecast data is in an array

{{ states["weather.obx_house"].attributes.temperature }}

need help with this syntax

 service_data: > -
             {{ state_attr('weather.obx_house','forecast')[0]['temperature'] }}

                    
 service_data: > - 
         {{ states[('weather.obx_house','forecast')[0]].attributes.datetime }}

I highly doubt this will work as ha-floorplan would have had to fully implement HA’s full script functionality. Based on what properties are needed, I don’t think it did that. This means you need to make a script that does the action.

Secondly, service_data requires a dictionary, not a single result. Just reading the docs, I can see you need the text key inside service_data.

If those services only exist in floorplan (Not inside HA’s service caller), then you need to make a template sensor.

template:
- trigger:
  - platform: time_pattern
    minutes: /30
  action:
  - service: weather.get_forecasts
    target:
      entity_id: weather.obx_house
    data:
      type: daily
    response_variable: forecast
  sensor:
  - name: Forcast Temperature
    state: >
      {{ forecast['weather.obx_house'].forecast[0].temperature }}

then in floorplan…

- element: forecast_day1
  state_action:
  - action: call-service
    service: floorplan.text_set
    service_data:
      text: "{{ states('sensor.forecast_temperature') }}"

EDIT: But at that point, you probably don’t need a service call for state_action. Just use the entity.