What is a valid "pattern" when using "smarthome:items list"?

Tags: #<Tag:0x00007fc20204cb78>
  • Platform information:
    • OS: OpenHabian
    • openHAB version: 2.5.0

I am using smarthome:items list.

Usage states the following:

 Usage: smarthome:items list [<pattern>] - lists names and types of all items (matching the pattern, if given)

Nothing I input as a pattern is returning a targeted list of items

openhab> smarthome:items list [astro.]
No item found for this pattern.
openhab> smarthome:items list [astro]
No item found for this pattern.
openhab> smarthome:items list [astro?]
No item found for this pattern.
openhab> smarthome:items list [astro!]
No item found for this pattern.
openhab> smarthome:items list [astro*]
No item found for this pattern.
openhab> smarthome:items list [astro%]
Error executing command: bad expression: astro%

Yes Astro is installed and a simple “smarthome:items list” returns all the items. Even putting in the full item name of one I see on the list returns no matches.

I am using OpenHAB 2.5 which I downloaded yesterday on Openhabian. No clue what I am doing wrong

You want to use grep to filter the results.

smarthome:items list | grep astro

The command is pretty much the same as the grep you run from the command line.

What is the output of smarthome:links list ?

openhab> smarthome:items list
astro_sun_local_nauticDawn_duration (Type=NumberItem, State=29 min, Label=Duration, Category=null)
astro_sun_local_morningNight_start (Type=DateTimeItem, State=2020-01-09T00:00:00.000-0600, Label=Start Time, Category=null)
astro_sun_local_zodiac_sign (Type=StringItem, State=CAPRICORN, Label=Sign, Category=null)
astro_sun_local_radiation_direct (Type=NumberItem, State=258.8090704595419 W/m², Label=Direct Radiation, Category=null)
astro_moon_local_phase_agePercent (Type=NumberItem, State=48.760443441172114 %, Label=Moon Age, Category=null)
astro_moon_local_phase_full (Type=DateTimeItem, State=2020-01-10T13:22:00.000-0600, Label=Full Moon, Category=null)
astro_moon_local_phase_illumination (Type=NumberItem, State=98.43614287132019 %, Label=Moon Illumination, Category=null)
astro_sun_local_civilDusk_start (Type=DateTimeItem, State=2020-01-09T17:53:00.000-0600, Label=Start Time, Category=null)
astro_sun_local_eclipse_partial (Type=DateTimeItem, State=2022-04-30T15:42:00.000-0500, Label=Partial Eclipse, Category=null)
astro_moon_local_phase_name (Type=StringItem, State=WANING_GIBBOUS, Label=Moon Phase Name, Category=null)
astro_sun_local_civilDusk_end (Type=DateTimeItem, State=2020-01-09T18:19:00.000-0600, Label=End Time, Category=null)
astro_sun_local_night_end (Type=DateTimeItem, State=2020-01-10T06:08:00.000-0600, Label=End Time, Category=null)
astro_sun_local_nauticDusk_start (Type=DateTimeItem, State=2020-01-09T18:19:00.000-0600, Label=Start Time, Category=null)
astro_sun_local_astroDusk_start (Type=DateTimeItem, State=2020-01-09T18:49:00.000-0600, Label=Start Time, Category=null)
astro_sun_local_eveningNight_start (Type=DateTimeItem, State=2020-01-09T19:18:00.000-0600, Label=Start Time, Category=null)
astro_moon_local_eclipse_total (Type=DateTimeItem, State=2022-05-15T23:12:00.000-0500, Label=Total Eclipse, Category=null)
astro_moon_local_phase_age (Type=NumberItem, State=15 day, Label=Moon Age, Category=null)
astro_sun_local_morningNight_duration (Type=NumberItem, State=368 min, Label=Duration, Category=null)
astro_moon_local_rise_start (Type=DateTimeItem, State=2020-01-09T16:57:00.000-0600, Label=Start Time, Category=null)
astro_moon_local_phase_thirdQuarter (Type=DateTimeItem, State=2020-01-17T07:00:00.000-0600, Label=Third Quarter, Category=null)
astro_sun_local_astroDawn_duration (Type=NumberItem, State=29 min, Label=Duration, Category=null)
astro_sun_local_rise_end (Type=DateTimeItem, State=2020-01-09T07:35:00.000-0600, Label=End Time, Category=null)
astro_sun_local_season_winter (Type=DateTimeItem, State=2020-12-21T04:04:00.000-0600, Label=Winter, Category=null)
astro_sun_local_set_start (Type=DateTimeItem, State=2020-01-09T17:50:00.000-0600, Label=Start Time, Category=null)
astro_sun_local_nauticDawn_start (Type=DateTimeItem, State=2020-01-09T06:37:00.000-0600, Label=Start Time, Category=null)
astro_moon_local_position_elevation (Type=NumberItem, State=-36.06061417686476 °, Label=Elevation, Category=null)
astro_moon_local_perigee_distance (Type=NumberItem, State=14407956989.08219055118110236220472 in, Label=Distance, Category=null)
astro_sun_local_civilDawn_duration (Type=NumberItem, State=26 min, Label=Duration, Category=null)
astro_sun_local_season_name (Type=StringItem, State=WINTER, Label=Season Name, Category=null)
astro_sun_local_season_spring (Type=DateTimeItem, State=2020-03-19T22:51:00.000-0500, Label=Spring, Category=null)
astro_sun_local_nauticDusk_duration (Type=NumberItem, State=30 min, Label=Duration, Category=null)
zwave_serial_zstick_7ad11a9a_serial_can (Type=NumberItem, State=NULL, Label=Frames Cancelled, Category=)
zwave_device_7ad11a9a_node7_switch_dimmer (Type=DimmerItem, State=NULL, Label=Dimmer, Category=DimmableLight)
astro_sun_local_civilDusk_duration (Type=NumberItem, State=26 min, Label=Duration, Category=null)
astro_sun_local_set_end (Type=DateTimeItem, State=2020-01-09T17:53:00.000-0600, Label=End Time, Category=null)
astro_sun_local_season_autumn (Type=DateTimeItem, State=2020-09-22T08:32:00.000-0500, Label=Autumn, Category=null)
astro_sun_local_zodiac_start (Type=DateTimeItem, State=2019-12-22T00:00:00.000-0600, Label=Start Time, Category=null)
astro_moon_local_phase_new (Type=DateTimeItem, State=2020-01-24T15:43:00.000-0600, Label=New Moon, Category=null)
astro_sun_local_civilDawn_end (Type=DateTimeItem, State=2020-01-09T07:32:00.000-0600, Label=End Time, Category=null)
astro_moon_local_phase_ageDegree (Type=NumberItem, State=175.5375963882196 °, Label=Moon Age, Category=null)
astro_moon_local_perigee_date (Type=DateTimeItem, State=2020-01-13T14:23:00.000-0600, Label=Date, Category=null)
astro_sun_local_set_duration (Type=NumberItem, State=3 min, Label=Duration, Category=null)
astro_sun_local_astroDawn_end (Type=DateTimeItem, State=2020-01-09T06:37:00.000-0600, Label=End Time, Category=null)
astro_sun_local_zodiac_end (Type=DateTimeItem, State=2020-01-19T23:59:59.999-0600, Label=End Time, Category=null)
astro_sun_local_eclipse_ring (Type=DateTimeItem, State=2020-06-21T01:41:00.000-0500, Label=Ring Eclipse, Category=null)
astro_sun_local_position_shadeLength (Type=NumberItem, State=1.71, Label=Shade Length Ratio, Category=null)
astro_sun_local_rise_start (Type=DateTimeItem, State=2020-01-09T07:32:00.000-0600, Label=Start Time, Category=null)
astro_sun_local_night_duration (Type=NumberItem, State=650 min, Label=Duration, Category=null)
astro_sun_local_radiation_diffuse (Type=NumberItem, State=116.8024687612915 W/m², Label=Diffuse Radiation, Category=null)
astro_sun_local_astroDusk_duration (Type=NumberItem, State=29 min, Label=Duration, Category=null)
zwave_serial_zstick_7ad11a9a_serial_cse (Type=NumberItem, State=NULL, Label=Received Checksum Errors, Category=)
astro_sun_local_season_summer (Type=DateTimeItem, State=2020-06-20T16:45:00.000-0500, Label=Summer, Category=null)
astro_sun_local_rise_duration (Type=NumberItem, State=3 min, Label=Duration, Category=null)
astro_moon_local_apogee_date (Type=DateTimeItem, State=2020-01-29T15:29:00.000-0600, Label=Date, Category=null)
ntp_ntp_local_dateTime (Type=DateTimeItem, State=2020-01-09T10:42:35.757-0600, Label=Date, Category=Date)
astro_sun_local_noon_end (Type=DateTimeItem, State=2020-01-09T12:44:00.000-0600, Label=End Time, Category=null)
astro_sun_local_position_elevation (Type=NumberItem, State=30.246914673518837 °, Label=Elevation, Category=null)
astro_moon_local_position_azimuth (Type=NumberItem, State=342.9138470236132 °, Label=Azimuth, Category=null)
astro_sun_local_eveningNight_duration (Type=NumberItem, State=282 min, Label=Duration, Category=null)
astro_sun_local_astroDusk_end (Type=DateTimeItem, State=2020-01-09T19:18:00.000-0600, Label=End Time, Category=null)
astro_moon_local_distance_distance (Type=NumberItem, State=14810416430.81187007874015748031496 in, Label=Distance, Category=null)
astro_sun_local_astroDawn_start (Type=DateTimeItem, State=2020-01-09T06:08:00.000-0600, Label=Start Time, Category=null)
astro_sun_local_eclipse_total (Type=DateTimeItem, State=2020-12-14T10:15:00.000-0600, Label=Total Eclipse, Category=null)
astro_sun_local_daylight_end (Type=DateTimeItem, State=2020-01-09T17:50:00.000-0600, Label=End Time, Category=null)
zwave_serial_zstick_7ad11a9a_serial_sof (Type=NumberItem, State=145, Label=Start Frames, Category=)
astro_moon_local_set_end (Type=DateTimeItem, State=2020-01-09T06:22:00.000-0600, Label=End Time, Category=null)
astro_sun_local_nauticDusk_end (Type=DateTimeItem, State=2020-01-09T18:49:00.000-0600, Label=End Time, Category=null)
astro_moon_local_eclipse_partial (Type=DateTimeItem, State=2021-05-26T06:20:00.000-0500, Label=Partial Eclipse, Category=null)
zwave_serial_zstick_7ad11a9a_serial_oof (Type=NumberItem, State=NULL, Label=OOF Bytes Received, Category=)
zwave_device_7ad11a9a_node5_switch_dimmer (Type=DimmerItem, State=NULL, Label=Dimmer, Category=DimmableLight)
astro_sun_local_noon_duration (Type=NumberItem, State=1 min, Label=Duration, Category=null)
astro_sun_local_night_start (Type=DateTimeItem, State=2020-01-09T19:18:00.000-0600, Label=Start Time, Category=null)
zwave_serial_zstick_7ad11a9a_serial_ack (Type=NumberItem, State=74, Label=Frames Acknowledged, Category=)
astro_moon_local_rise_end (Type=DateTimeItem, State=2020-01-09T16:57:00.000-0600, Label=End Time, Category=null)
astro_sun_local_position_azimuth (Type=NumberItem, State=146.63828129745565 °, Label=Azimuth, Category=null)
astro_sun_local_morningNight_end (Type=DateTimeItem, State=2020-01-09T06:08:00.000-0600, Label=End Time, Category=null)
astro_moon_local_set_start (Type=DateTimeItem, State=2020-01-09T06:22:00.000-0600, Label=Start Time, Category=null)
astro_sun_local_phase_name (Type=StringItem, State=DAYLIGHT, Label=Sun Phase Name, Category=null)
astro_moon_local_phase_firstQuarter (Type=DateTimeItem, State=2020-02-01T19:43:00.000-0600, Label=First Quarter, Category=null)
astro_moon_local_position_shadeLength (Type=NumberItem, State=0.00, Label=Shade Length Ratio, Category=null)
astro_sun_local_noon_start (Type=DateTimeItem, State=2020-01-09T12:43:00.000-0600, Label=Start Time, Category=null)
astro_moon_local_zodiac_sign (Type=StringItem, State=CANCER, Label=Sign, Category=null)
astro_sun_local_nauticDawn_end (Type=DateTimeItem, State=2020-01-09T07:06:00.000-0600, Label=End Time, Category=null)
zwave_serial_zstick_7ad11a9a_serial_nak (Type=NumberItem, State=NULL, Label=Frames Rejected, Category=)
astro_sun_local_radiation_total (Type=NumberItem, State=375.6115392208334 W/m², Label=Total Radiation, Category=null)
astro_sun_local_eveningNight_end (Type=DateTimeItem, State=2020-01-10T00:00:00.000-0600, Label=End Time, Category=null)
astro_moon_local_apogee_distance (Type=NumberItem, State=15960230644.10751574803149606299213 in, Label=Distance, Category=null)
astro_sun_local_civilDawn_start (Type=DateTimeItem, State=2020-01-09T07:06:00.000-0600, Label=Start Time, Category=null)
astro_moon_local_distance_date (Type=DateTimeItem, State=2020-01-09T10:38:36.118-0600, Label=Date, Category=null)
ntp_ntp_local_string (Type=StringItem, State=2020-01-09 10:42:35 CST, Label=Date, Category=Date)
astro_sun_local_daylight_duration (Type=NumberItem, State=615 min, Label=Duration, Category=null)
astro_sun_local_daylight_start (Type=DateTimeItem, State=2020-01-09T07:35:00.000-0600, Label=Start Time, Category=null)

Thank you. For some reason I didn’t think the console would have grep available and didn’t even try. This is a good workaround, but I am still curious what it is that [<pattern>] wants or thinks is acceptable.

I think these will work, you just need to remove the brackets.
I have tried and for example:

smarthome:items list Astro*

Will return a list with the items which name starts with “Astro”.

1 Like

Well that seems to be the winner. It appears the --help for smarthome:items needs to be updated from:

Usage: smarthome:items list [<pattern>] - lists names and types of all items (matching the pattern, if given)

to

Usage: smarthome:items list <pattern> - lists names and types of all items (matching the pattern, if given)

Using square brackets is a general convention for command line options that something is optional. With your suggested change it reads as if pattern is required.

2 Likes

Thanks for the tip. I am new to the linux side of things.